Posts

Showing posts from September, 2011

algorithm - Minimum-size vertex cover of tree: Dynamic Programming Formulation -

i'm trying understand how formulate problem of finding minimum-size vertex cover of tree dynamic programming problem , having trouble. me non-dynamic programming formulation involving depth-first search makes intuitive sense. involves doing dfs leaf nodes, including parent nodes in minimum size vertex cover, , repeating root. pseudocode this: // dfs based solution find_minimum_vertex_cover_dfs(root) { // leaf nodes aren't in minimum size vertex cover if (root == null || isleafnode(root)) { return; } (each child node of root) { find_minimum_vertex_cover_dfs(child node); // child isn't in minimum size vertex cover need cover edge // current root child including current root if (!isinmincover(child node)) { include root in minimum vertex cover; } } } the dynamic programming formulation got here follows: dynamicvc(root): each child c: best[c][0], best[c][1] = dynamicvc(c) ...

osx - OS X 10.11.6 El Capitan SSLRead() return error -9841 -

after curl request in terminal https website had error curl: (56) sslread() return error -9841 curl --version curl 7.43.0 (x86_64-apple-darwin15.0) libcurl/7.43.0 securetransport zlib/1.2.5 protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp features: asynchdns ipv6 largefile gss-api kerberos spnego ntlm ntlm_wb ssl libz unixsockets how make curl work? p.s reinstalled curl command brew install --with-openssl curl after rebooting, error went away.

database design - how to change (update) a hbase row key value from aaa to bbb for example? -

how can change row key value in hbase row key made of column in table , values doesn't come in same time. after update value of column want update row key possible do? example have c1 , c2 , c3 columns , uniq value in each row c1, c2 , row key c1.value concatenate c2.value. first insert fill c1 , row key c1 next time fill c2 existing row (c1) , row key must set c1c2 c1 existing row at splice machine (open source) hit problem base table , index table updates in hbase. "update" delete , insert when primary key or index key modified (no way around that). in our system this... create table foo (col1, col2, primary key(col1)); insert foo values (1,2),(3,4); update foo set col1 = col2; we delete rows 1,3 , write rows 2,4 inside single transaction/buffer. hope helps , luck. here link our community site in case want @ our code. http://community.splicemachine.com/

ios - Issues resizing UITableView header with animation -

i'm tying animate table view's header height 0 its. current code using is: var newrect = headerview.frame newrect.size.height = 0 uiview.animatewithduration(0.6) { self.headerview.frame = newrect } headerview custom uiview , used so: func tableview(tableview: uitableview, viewforheaderinsection section: int) -> uiview? { return headerview } when run code seems animate headerview 's height half size , not 0. ideas might doing wrong here? pointers great. you have use heightforheaderinsection , uitableview reload system. bellow, there example of how it. it's dummy example (when use presses cell, makes section header (dis)appear. var displayexpandedheader = true let expandedheight = cgfloat(50) let colapsedheight = cgfloat(0) func tableview(tableview: uitableview, viewforheaderinsection section: int) -> uiview? { return headerview } func tableview(tableview: uitableview, didselectrowatindexpath ind...

Nothing is working. Realm Migration [Android 1.2] -

i updated latest version hoping fix issue, has not. using realmconfiguration config = new realmconfiguration.builder(this) .name("myrealm.realm") .migration(new migration()) .schemaversion(2) // 2 .build(); try { realm realm = realm.getinstance(config); // automatically run migration if needed realm.close(); } catch (exception e) { e.printstacktrace(); } realm.setdefaultconfiguration(config); this code update , add few new objects. here migration public class migration implements realmmigration { @override public void migrate(final dynamicrealm realm, long oldversion, long newversion) { // access realm schema in order create, modify or delete classes , fields. realmschema schema = realm.getschema(); // migrate version 1 version 2 if (oldversion == 1) { // create new classes realmobjectschema styleschema = schema.create("savedstyle").addf...

javascript - Modifying the following sort function so it returns numbers -

the following function following: 1) if isdefault === true , isdefault === false , former goes first. 2) if isdefault === true , isdefault === true , sort updatedat in descending fashion. 3) if isdefault === false , isdefault === false , sort name in ascending fashion. function sortpanoramas (panoramas) { panoramas.sort((a, b) => { if (a.isdefault !== b.isdefault) return a.isdefault < b.isdefault if (a.isdefault && b.isdefault) return a.updatedat < b.updatedat if (!a.isdefault && !b.isdefault) return a.name > b.name }) } this works in chrome not in safari, because told you're supposed return numbers in sort functions. how modify function return numbers? edit: sample data: [ { "id": "cbu2z5bz9w", "name": "a01", "updatedat": "2016-08-24t06:20:47.972z", "isdefault": true, "index": 0 }, { "id": ...

javascript - How to load an external HTML file -

i have html follows: select file : <input type="file"><br><br> html codes : <textarea id="displayhtml"></textarea><br><br> <div id="displaypage">display html page here</div> now how browse external html file local hard drive , display page preview in div #displaypage , html tags of file textarea #displayhtml ? have no idea how please help. my fiddle here: https://jsfiddle.net/zm6ga2ev/1/ you .load other page content div. //load full document $('#displaypage').load('http://same-domain.com/next-page.html'); // can use css selector load part of page $('#displaypage').load('http://same-domain.com/next-page.html #some-inner-id > *'); if #displaypage element not found in dom, no request performed! if #some-inner-id not found in request page dom, empty content. note loaded page must allow cross-origin request (usually means same domain reques...

sql - Create a Table to store shared attributes between tables, how to deal with Composite Keys? -

i'm looking database solution dealing scenario this: a lot tables: tablea, tableb, tablec ... share attributes(fields), want store these shared attributes in table, let's call shared table. this: tablea: | keya | shared attr.1 | ... | other attr. | | a_1 | a_svaluea1 | ... | a_ovaluea1 | tableb: | keyb | shared attr.1 | ... | other attr. | | b_1 | b_svaluea1 | ... | b_ovaluea1 | shared table: | keyshare | entitytype | shared attr.1 | ... | | a_1 | | a_svaluea1 | ... | | b_1 | b | b_svaluea1 | ... | of course i'll create 1 table store specific attributes each table. but need solve problem, table c, want store shared attributes in sharedtable, has composite keys, this: tablec: | keyc1 | keyc2 | shared attr.1 | ... | other attr. | | c1_1 | c1_2 | c_svaluea1 | ... | c_ovaluea1 | so can't deal tablea , tableb. there design deal composite keys in table c? i'm sure not new...

css - HTML table truncate text but fit as much as possible -

Image
i find posts in stack overflow doesn't work me. need specific help. this board page : when type long title post, looks : as can see here, ruins each table cell's width, text not being truncated.\ what want : if text reaches end of title field, should truncated anything should not ruin table format (width..etc) here html code (used in django ): {% extends 'chacha_dabang/skeleton/base.html' %} {% block content %} <div class="container inner"> <div class="row"> <div class="col-md-8 col-sm-9 center-block text-center"> <header> <h1> 차차다방 게시판 </h1> <p> 회원들의 게시글을 볼 수 있는 페이지 입니다.</p> </header> </div><!-- /.col --> </div><!-- /.row --> </div><!-- /.container --> <div class="container inner-bottom">...

php - Image resize not working in CodeIgniter 3 -

i developing web application. in application, uploading image server , resize it. uploaded server successfully. when resize image, not resizing image. not throwing error well. this image file upload model class file_helper extends ci_model{ function __construct() { parent::__construct(); $this->load->library('image_lib'); } function generaterandomfilename() { $rand = rand(10000,99999); $file_name = time().$rand; return time().$rand; } function uploadimage() { $name = $this->generaterandomfilename(); $config['upload_path'] = './'.upload_folder.'/'; $config['allowed_types'] = 'gif|jpg|png|jpeg'; $config['file_name'] = $name; $this->load->library('upload', $config); if ( !$this->upload->do_upload('userfile')) { return false; ...

python - How to resample a Numpy array of arbitrary dimensions? -

there scipy.misc.imresize resampling first 2 dimensions of 3d arrays. supports bilinear interpolation. however, there not seem existing function resizing dimensions of arrays number of dimensions. how can resample array given new shape of same rank, using multi-linear interpolation? you want scipy.ndimage.zoom , can used follows: >>> x = np.arange(8, dtype=np.float_).reshape(2, 2, 2) >>> scipy.ndimage.zoom(x, 1.5, order=1) array([[[ 0. , 0.5, 1. ], [ 1. , 1.5, 2. ], [ 2. , 2.5, 3. ]], [[ 2. , 2.5, 3. ], [ 3. , 3.5, 4. ], [ 4. , 4.5, 5. ]], [[ 4. , 4.5, 5. ], [ 5. , 5.5, 6. ], [ 6. , 6.5, 7. ]]]) note function preserves boundaries of image, resampling mesh node @ each pixel center. might want @ other functions in scipy.ndimage if need more control on resampling occurs

javascript - load ajax array data into select2 dropdown format -

Image
i have problem filling dropdown data ajax script. here's controller: public function ajax_get_kota($idprov='') { $kota = $this->data['namakota'] = $this->registrasi_model->get_nama_kota($idprov); echo json_encode($kota); } here's model: public function get_nama_kota($idprov='') { $query = $this->db->query('select id_kab, nama kabupaten id_prov = '.$idprov.' order nama asc'); return $dropdowns = $query->result(); } and view: <div class="form-group form-group-sm has-feedback <?php set_validation_style('kota')?>"> <?php echo form_label('kota / kabupaten', 'kota', array('class' => 'control-label col-sm-2')) ?> <div class="col-sm-3"> <?php $atribut_kota = 'class="form-control dropkota"'; echo form_dropdown('kota', $namakota, $values-...

Oracle data import utility PIPELINE_UTL_PKG.DATA_UNLOAD -

i trying understand 1 utility being used in sql query import data database file. below code being used same. can tell me if below utility( pipeline_utl_pkg.data_unload ) oracle utility. not find in google same. sql_exp='''select * table( pipeline_utl_pkg.data_unload( cursor( select /*+ no_parallel(a) */ * usr.tbl_extract a), 'usr_tbl_extract.txt', 'expdirectory', 'n', 'y') )''' cur.execute(sql_exp) it isn't oracle supplied package ; in organisation or supplier has created that. if aren't sure owns can schema/owner all_objects ; may see package , synonym. can see package doing looking @ source code, in user_source (if you're logged in owner) or all_source views. may wrapped code - isn't insurmountable - if may have source code stored externally, in source control system.

sql - Postgresql query gives less results for wider search -

i'm facing wierd issue query. my query complax i'll use simpler version of it. select distinct on (a.batch) c.id,a.partid,b.partname,c.stock_stock, components join parts b using(partid) left join (select * componentsreport($1)) c using (partid) join start_work d on d.batchid=a.batchid b.issub group c.id,a.partid,b.partname,c.stock order a.batch; this query gives many rows 1 row c.id=3436 : 3436 124 'cpu-a' 450 however when add criteria c.id=3436 : select distinct on (a.batch) c.id,a.partid,b.partname,c.stock_stock, components join parts b using(partid) left join (select * componentsreport($1)) c using (partid) join start_work d on d.batchid=a.batchid c.id=3436 , b.issub group c.id,a.partid,b.partname,c.stock order a.batch; i 6 rows: 3436 124 'cpu-a' 450 3436 125 'cpu-a' 130 3436 125 'cpu-a' 660 3436 126 'cpu-a' 0 3436 127 'cpu-a' 40 3436 128 'cpu-a' 40 which correct! i don't understa...

c# - Save data programmatically in a MVVM Devexpress project -

i created wpf mvvm project in devexpress scaffolding wizard , created works fine, modified grids call savecommand on rowupdated . now i'm trying insert new registers programmatically , strategy , instance of collectionviewmodel model , use save method sending object same model parameter. i reading this guide still couldn't find i'm doing wrong. this code transaction transaction = new transaction(); transaction.idclient = 1; transactioncollectionviewmodel tcvm = transactioncollectionviewmodel.create(unitofworksource.getunitofworkfactory()); tcvm.save(transaction); and gives me error on variable tcvm when calling save function system.nullreferenceexception unhandled user code hresult=-2147467261 message=object reference not set instance of object. source=devexpress.mvvm.v16.1.datamodel stacktrace: @ devexpress.mvvm.datamodel.repositoryextensions.<>c__displayclass1_0`3.<getprojectionprimarykey>b...

Update a column with sequence numbers without using ROW_NUMBER() in SQL Server -

i have table , have difficulty updating it code descd slnum --------------------- 10 0 10 b 0 12 c 0 12 d 0 11 e 0 12 f 0 i have update table without using row_number() using if else loops how can that? code descd slnum ---------------------- 10 1 10 b 2 12 c 1 12 d 2 11 e 1 12 f 3 for sql 2012+ ;with rownum(code, descd, slnum) ( select 10, 'a', 0 union select 10, 'b', 0 union select 12, 'c', 0 union select 12, 'd', 0 union select 11, 'e', 0 union select 12, 'f', 0 ) select code, descd, count(*) on (partition code order code rows unbounded preceding) rownum o order descd

html - Pre tag does not render correctly in blogger -

Image
the following code html content of web page: correctly rendered shown: same html in blogger post shows empty page. other interesting thing is, first time enter html in html page, characters remain pasted, once page refreshed, escape characters rendered in html pane shown in next image compose pane empty. it looks quirk of blogger. browser not seem matter (edge or firefox latest), the 'pre' tags added blogger. pasted shown on page submitted iis. feel file processing blogger reason behaviour. you have 1 many </pre> 's in html. browser tries autocorrect it, , goes wrong. (this why valid html important!) if use decent ide visual studio, sublime (free), phpstorm, netbeans(free), or dreamweaver, or notepad++(free) plugins, of these programs have notified on particular issue, can recommend using one.

Petapoco with factory design pattern for multiple server connections -

how can use multiple connections in petapoco .net mvc application using factory design pattern? there's no problem using factory pattern, use 1 petapoco db per request. you can use more 1 per request, creating more connections db, having performance costs. see answer more info how create dal using petapoco

html email - how to send link in emal using java mail sender -

hi trying send link in email using gmail smtp.but sending string.can body me. in advance. java: string url="localhost:8080/#/activateuser/5575/958104f7-557e-4703-bcf7-55c9e37b7ad7"; string content="<a href='"+url+"'>"+url+"</a>"; msg.setcontent(message1+" "+content,"text/html; charset=utf-8"); // sends e-mail transport.send(msg); logger.info("email sent succesfully"); response: verification token : 5575 set password click on url : localhost:8080/#/activateuser/5575/958104f7-557e-4703-bcf7-55c9e37b7ad7 (i want show url link) you might need add "http://" before "localhost:8080"

javascript - How can I write a ESLint rule for "linebreak-style", changing depending on Windows or Unix? -

as know, linebreaks (new line) used in windows carriage returns (cr) followed line feed (lf) i.e. (crlf) whereas, linux , unix use simple line feed (lf) now, in case, build server uses supports linux , unix format so, below rule working on build server: linebreak-style: ["error", "unix"] but doing development on windows , need update rule on each git pull/git push below, linebreak-style: ["error", "windows"] so, there way write generic linebreak-style rule support both environments, linux/unix , windows? note : using ecmascript6[js], webstorm[ide] development any solutions/suggestions highly appreciated. thanks! the eslint configuration file can a regular .js file (ie, not json, full js logic) exports configuration object. that means change configuration of linebreak-style rule depending on current environment (or other js logic can think of). for example, use different linebreak-style configuration when node ...

ruby - Cannot migrate Devise Token Auth project -

nomethoderror: undefined method `[]' #<activerecord::migration:0x00000001fe0fa0> this pops whenever try running rake:db migrate i've been following guide word word i'm having tremendous trouble interpreting stacktrace pastebin this unbelievable it's typo (or that?) @ migration file generated generator. see ..._devise_token_auth_create_users.rb file @ db/migrate directory. see @ first line of migration file there odd [4.2] string. class devisetokenauthcreateusers < activerecord::migration[4.2] just remove odd [4.2] string line , voila. however, must admit that, experience made me think twice using gem @ project.

java - why reactive programming replacing observer pattern -

reactive programming uses idea of observer pattern . not looking reasons why have use reactive approach instead of observer pattern.i seeing lot of similarities between observer pattern , reactive approach. why use reactive programming deprecating observer pattern? there many reasons, first take be: reactive programming much more using observer pattern. see reactive manifesto example. makes clear reactive programming has @ least 4 important corners - responsiveness, resilience, elasticity, , "message-busing". fundamental qualities; , none of them (directly) leads "observer pattern". in essence, reactive programming establishing whole new set of practices/ patterns ; reducing "replacing observer patterns" put ... wrong. in on words: think assessment over-simplification ignoring major parts of makes reactive programming . of course, when using observer pattern on place solve place, living in "reactive world" degree. ...

amazon web services - Independent python subprocess from AWS Lambda function -

i have created lambda function (app1) reads , writes rds. my lambda function written in python2.7 , uploaded zipped package. i created , tested zipped package on ec2 instance in same vpc rds , lambda function. next, added functionality lambda function popen independent subprocess (app2) using subprocess.popen , had app1 return while app2 subprocess continued on own. tested app1 return handler's output while app2 continued putting 60 second sleep in app2 , tailed output file of app2. i tested app1 , app2 functionality in ec2 instance. after uploading new package, app1 appears behave expected, , returns handler's output immediately, app2 functionality doesn't "appear" instantiated, there no logs, errors, or output capture app2. in app1, tested subprocess worked performing subprocess.check_output(['ls','-la']) prior , after independent subproccess.popen, , local folder displayed files. except there isn't app2output file created e...

theano - Issue excecuting studentT in PyMC3 -

i try execute studentt() receive error . error is "importerror: ('dll load failed: specified procedure not found.', '[elemwise{log1p,no_inplace}()]')" if use normal(), there no issue. thank in advance from pymc3 import studentt pm.model() model: pm.glm.glm('returns ~ aap+ctxs+cah+lll', data, family=glm.families.studentt()) start = pm.find_map() step = pm.nuts(scaling=start) trace = pm.sample(2000, step, start=start)

excel - VBA Asynchronous data call with HTTP -

i have made handy vba function returns http status of given url using msxml2.serverxmlhttp object. function executed synchronously , rest of code freezes until request resolved. how turn asynch call? current working function: function page_http_status(url) string dim xmlhttp object set xmlhttp = createobject("msxml2.serverxmlhttp") xmlhttp.open "get", url, false xmlhttp.setrequestheader "content-type", "application/x-www-form-urlencoded" xmlhttp.setrequestheader "user-agent", "mozilla/5.0 (windows nt 6.1; rv:25.0) gecko/20100101 firefox/25.0" xmlhttp.send page_http_status = xmlhttp.status end function onreadystatechange attempt i know there xmlhttp.onreadystatechange event can trigger named callback function, how can trigger function return value page_http_status() ? xmlhttp.onreadystatechange = functionreadystatechange an...

Indent second line of UILabel (swift) -

var testlabel = uilabel(frame: cgrectmake(8,0,tableview.frame.width-8,100)) let testdesc = "dsfdddfdsfdsfsdfdsfdsfdsfdsfdsfsdfdsfsdfsdfdsfdsfdsfdsfdsfdsfdsfdsfdsfdsfdsfdsfdsf" var labelstring = indexstring + ". " + testdesc testlabel.text = labelstring testlabel.linebreakmode = .bywordwrapping // or nslinebreakmode.bywordwrapping testlabel.numberoflines = 0 retcell.addsubview(testlabel) my output: 1. ksajdkasdsajdksajdksajd asjdkjassadkasldkalsdklsakdl how can make output following: 1. asdasdasdasdasdasdasds djaskdjsadjksadasjdjas make attributed string (nsmutableattributedstring) , set paragraph style's firstlineheadindent , headindent desired. set label's attributedtext attributed string.

javascript - Mandatory slider in oTree/django -

i want use otree alternative conducting experiments. purpose looking possibility include mandatory slider questions in forms, i. e. sliders required move before able proceed next question. start tried modify otrees survey template achieve solution future usage wasn't able integrate common approaches fieldtracker project. here 2 modified (yet after number of unsuccessful try-outs not functioning) versions of models.py , views.py files give hint in direction want go. there way work? # -*- coding: utf-8 -*- ## models.py # <standard imports> __future__ import division django.db import models django_countries.fields import countryfield model_utils import fieldtracker, otree import widgets otree.constants import baseconstants otree.db import models otree.models import basesubsession, basegroup, baseplayer class constants(baseconstants): name_in_url = 'survey' players_per_group = none num_rounds = 1 class subsession(basesubsession): pass cl...

c# - MVC File Upload return Parial View issue -

if razor coded @html.beginform (enctype = "multipart/form-data") file upload, return me new page instead of div tag column. @ajax.beginform offers div tag control, in circumstances, have use hack javascript , ie doesn't support on it. is there way me avoid page redirection using @html.beginform because want maintain web design as spa. thanks.

c# - Find the Last Match in a Regular Expression -

i have string , regular expression running against it. instead of first match, interested in last match of regular expression. is there quick/easy way this? i using regex.matches, returns matchcollection, doesn't accept parameters me, have go through collection , grab last one. seems there should easier way this. there? the .net regex flavor allows search matches right left instead of left right. it's flavor know of offers such feature. it's cleaner , more efficient traditional methods, such prefixing regex .* , or searching out matches can take last one. to use it, pass option when call match() (or other regex method): regexoptions.righttoleft more information can found here .

spring integration - How to manage payload during interaction with multiple endpoints in a SI flow -

i trying understand options available handling payload within si flow communicates multiple endpoints. i have web service entry point defined using int-ws:inbound-gateway . receives soap message below payload: soap request <soapenv:envelope> <soapenv:header/> <soapenv:body> <emp:employee> <emp:empid>sf</emp:empid> <emp:empname></emp:empname> </emp:employee> </soapenv:body> </soapenv:envelope> the si flow extracts empid , passes string payload jms queue. jms endpoint replies employee name string type. si flow maps employee name element empname in response message. soap response <soapenv:envelope> <soapenv:header/> <soapenv:body> <emp:employee> <emp:empid>sf</emp:empid> <emp:empname>spring framework</emp:empname> </emp:employee> </soapenv:body> </soapenv:envelope> to implement use case h...

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot...

visual studio android emulator NFC -

Image
i have installed visual studio android emulator in dell tablet venue 8 pro 5855. os windows 10 pro , came built-in nfc. did not see nfc settings in additional tools. is nfc supported in visual studio android emulator? looking inputs. in advance! this screenshot of emulator's additional tools you need have: 1- open nfc (sdk addon) 2-the open nfc core (last version 4.5.2) can download here

c# - Isolate https://*something*.com from a bunch of text -

this question has answer here: c# regex pattern extract urls given string - not full html urls bare links well 1 answer i have : string bunchoftext contains link starts https:// , ends .com . need isolate link , put in string. suggestions how? edit : text looks this: it popularised in 1960s release of letraset sheets containing lorem ipsum passages, , more desktop publishing software aldus pagemaker including versions of lorem ipsum. https://mydomain/randomgeneratedtext.com why use it? i want have new string string link ="https://mydomain/randomgeneratedtext.com" by time of edit, user : serhiyb, gave me perfect answer! regex linkparser = new regex(@"https:\/\/(www\.)?[-a-za-z0-9@:%._\+~#=]{2,256}\.com\b([-a-za-z0-9@:%_\+.~#?&//=]*)?", regexoptions.compiled | regexoptions.ignorecase); string rawstring = "some t...

typo3 - Typolink content in menu? -

i trying make menu displays page's first content element header , image , have them links. typolink part doesn't seem work me: lib.menu = hmenu lib.menu { 1 = tmenu 1.no { donotlinkit = 1 wrapitemandsub = <div>|</div> stdwrap.cobject = content stdwrap.cobject { table = tt_content select { pidinlist.field = uid } renderobj = coa renderobj { 10 = text 10.field = header 10.typolink.parameter.field = uid } } } } just add give full working example. using section.field = uid can link content element itself. lib.menu = hmenu lib.menu { 1 = tmenu 1.no { donotlinkit = 1 wrapitemandsub = <div>|</div> stdwrap.cobject = content stdwrap.cobject { table = tt_content select { pidinlist.field = uid } renderobj = coa renderobj { ...

php - Migrate drupal 7 full content type to drupal 8 -

i'm working on new drupal 8 website. have drupal 7 installation severals content type (custom field image, date etc ...) , dont know best pratice migrate thoses contents types new drupal 8 installation.. does know how ? regards. maybe this document can you?

c# - How to get all the contents of specified class from string? -

i trying make app windows phone forum. here function far (just taking xaml): private async void go_click(object sender, routedeventargs e) { httpclient wc = new httpclient(); httpresponsemessage response = await wc.getasync("http://www.myforum.com/"); response.ensuresuccessstatuscode(); string xaml = await response.content.readasstringasync(); textxaml.text = json; } there no errors in code , xaml. what want category names of forum. category names have class of "category-name". how can category names? can them string? have parse string or something? i think article on codeproject you: http://www.codeproject.com/tips/804660/how-to-parse-html-using-csharp it uses library called htmlagilitypack can install via nuget: http://www.nuget.org/packages/htmlagilitypack the below example may work purposes due firewall issues haven't been able test works , helps answer question. using system; us...

go - Change godep to a previous version -

i trying revert godep previous version. need v52 go installed latest v74 when ran go godep. i tried replacing godep binary in $gopath/bin. , go picking up. but problem when try run godep godep restore or errors below. i'm not sure go here. godep: dep (github.com/burntsushi/toml) restored, unable load error: package (bufio) not found godep: dep (github.com/datadog/datadog-go/statsd) restored, unable load error: package (bytes) not found godep: dep (github.com/armon/go-metrics) restored, unable load error: package (bufio) not found godep: dep (github.com/aws/aws-sdk-go/aws) restored, unable load error: package (io) not found godep: dep (github.com/aws/aws-sdk-go/private/endpoints) restored, unable load error: package (fmt) not found godep: dep (github.com/aws/aws-sdk-go/private/protocol) restored, unable load error: package (crypto/rand) not found godep: dep (github.com/aws/aws-sdk-go/private/signer/v4) restored, unable load error: package (cryp...

c# - Using an object in a single return line without declaration -

here piece of code public override bool equals(object obj) { var myobj= obj myclass; return obj == null || myobj== null || !referenceequals(this, obj) ? false : (this.v1== myobj.v1) && (this.v2== myobj.v2) && (this.v3== myobj.v3); } is possible use myobj in return line without declaring above? thank you! first of answer "yes", that's not sign. after doing cast, if going use result of cast several times, it's expected thing need put kind of temporary variable. in code presented, whole expression before ? can simplified referenceequals(this, obj) since reference-equals should safe nulls. also, since you're doing reference-equals, , return false when fails, don't need other checks. right-side of : superfluous. activates when ref-equals returns true, such case means 2 variables under comparison same object - other comparisons return true anyways - no need them. so....

NULLS LAST flag in Denodo, MemSQL, Spark, VectorWise, and XtremeData -

i doing pseudo-orm personal project, , i'm compiling list of compatibility checks 20+ different sql dialects out there. currently, doing research on whether dialect supports nulls last flag, i.e. when sorting table, have null come out last item 1, 2, 3, 4, null instead of null, 1, 2, 3, 4 . i have results languages dashdb/mysql/mssql, etc (yes - offer null last ) however, following dialects, unable find null-last-ability: denodo memsql spark vectorwise xtremedata a simple "yes" or "no" suffice in answer, however, if write query down on how perform null last operation, great too! i checked on memsql , afaik nulls last syntax not supported. said, can achieve doing this: select * foo order ifnull(bar, magic_value) asc change magic_value sorts last/first depending on data in column. if ok perf hit, can mutate value such if not null value starts prefix sorts high, , if null value sorts lower prefix. same thing can used implement...

c++ - Functions used by one function in header file -

context i'm writing function uses other functions needed in main function. purpose of main function make sort of kit call required functions. exemple int a(int x) // make x = 10 in recursive way , purpose limited // used function b { if (x == 10) return x; else if(x<10) return a(x+1); else return a(x-1); } int b(int x, int allow_b) // exemple, function b call function if required. { if (allow_b == 1) return a(x); else return x; } question since function 'a' exist used 'b', should there particular done in header file or should commented on function 'a' used 'b' ? is there wrong kind of approach? edit i mean should declared in header, i'm not talking writing function 'a' , 'b' in header file. if function a used b , see no need declared in header file. put both functions in same translation unit, , declare , define function a static linkage, additional constraint...

javascript - Maintaining Aspect Ratio with 100% Width & Height (Cropping Overflow in CSS) -

i'm working on full-screen background slideshow. my question is: how can set image take full screen , maintain aspect ratio? min-height , min-width work, not keep aspect ratio when both set. want image cropped full coverage of container. diagram of problem i believe need have 1 dimension fixed, , other auto; given image dimensions , view-port dimensions variable, i'm thinking need @ least 2 sets of css rules, , javascript calculate 1 should used. there simpler way this? i've drawn diagram illustrating problem. dark colors original images. median colors desired effect. lighter colors desired overflow scaled image. i'm working on ken-burns effect full-screen background. know have worry transitions, i'm hoping can handle after. tutorial ken burns effect: http://cssmojo.com/ken-burns-effect/ solved: maju introducing me background cover. changing images divs , changing javascript + css on ken burns code images divs worked well. script changes elemen...

python - check if pair of values is in pair of columns in pandas -

basically, have latitude , longitude (on grid) in 2 different columns. getting fed two-element lists (could numpy arrays) of new coordinate set , want check if duplicate before add it. for example, data: df = pd.dataframe([[4,8, 'wolf', 'predator', 10], [5,6,'cow', 'prey', 10], [8, 2, 'rabbit', 'prey', 10], [5, 3, 'rabbit', 'prey', 10], [3, 2, 'cow', 'prey', 10], [7, 5, 'rabbit', 'prey', 10]], columns = ['lat', 'long', 'name', 'kingdom', 'energy']) newcoords1 = [4,4] newcoords2 = [7,5] is possible write 1 if statement tell me whether there row latitude , longitude. in pseudo code: if newcoords1 in df['lat', 'long']: print('yes! ' + str(newcoords1)) (in example, newcoords1 should false , newcoords2 should true . sidenote: ...

Object Required Outlook VBA Copy Paste to Excel -

i trying copy body of email , paste new excel workbook. below code generating "object required" error on "set wb" line. new outlook vba, , having hard time trying find information on error anywhere. majority of code copied somewhere else, it's been while , forget where. appreciated. sub pastetoexcel() dim activemailmessage mailitem dim xlapp excel.application dim wb excel.workbook dim ws excel.worksheet if typename(activeexplorer.selection.item(1)) = "mailitem" 'get handle on email set activemailmessage = activeexplorer.selection.item(1) 'copy formatted text: activemailmessage.getinspector().wordeditor.range.formattedtext.copy 'ensure excel application open set xlapp = createobject("excel.application") 'make excel application visible xlapp.visible = true 'name excel file set wb = xlobject.object.workbooks("test.xlsx") 'paste email set ws = xlob...

c# - MVC Application_start localhost redirected you too many times -

i error: localhost redirected many times. when redirect error page application_start method. my code looks this: protected void application_start() { arearegistration.registerallareas(); routeconfig.registerroutes(routetable.routes); } protected void application_error(object sender, eventargs e) { var exception = server.getlasterror(); if (exception != null) { session["w"] = exception; response.clear(); server.clearerror(); response.redirect("~/admin/error"); } } } it not idea use session in case. if error triggered ihttphandler not marked irequiressessionstate , accessing session fail. so, have redirect loop. remove using of session , try use: response.redirect(string.format("~/admin/error?w={0}", exception.message));

Deploying Rails 5 to a Linux server -

i have computer set linux production server rails 5 application, don't know start. know of articles/guides me? tried searching didn't find outlines entire process. https://gorails.com/deploy/ubuntu/16.04 the thing different rails 5 rails gem version number

Using C# Ternary Operator -

probably simple syntax problem. attempt @ console program reads length of string received via user input. if length greater 144, user notified string length long, otherwise string inputted output console. string input = console.readline(); (input.length > 144) ? console.writeline("the message long"); : console.writeline(input); console.readline(); getting syntax errors in present state on line 2. missing parentheses? try: console.writeline((input.length > 144) ? "the message long" : input); you need use return value of operator, or receive compile-time error only assignment, call, increment, decrement, , new object expressions can used statement . none of these other answers compile, i'm not sure getting at.

Paperjs and Brackets -

is there way make paperscript work in adobe brackets? it's first time using paperjs , paperscript script doesn't work. basically text inside script not run @ all. not sure asking i'd make few points in hopes these you. you must write paperscript inside script tag in html document, if try link external .js file won't work because of cors . brackets live preview feature doesn't support javascript of kind knowledge (haven't used editor 6 months might outdated information).

How to use Scala defined function in Cassandra interpreter on Zeppelin Notebook? -

i have next function defined on zeppelin notebook: import java.util.date def timeformat(d: long) : string = { val l = (d * 1000).tolong val time = new date(l) time.tostring() } using single item: timeformat(1471887281116l) res2: string = thu apr 02 10:05:16 utc 48612 and want format timestamps cassandra using: %cassandra select timeformat(timestamp) time keyspace.table; without function query return result output is: com.datastax.driver.core.exceptions.invalidqueryexception: unknown function 'timeformat' in zeppelin tutorial , shows how get , format data using functions, concretely registering function with: sqlc.udf.register("functionname", functionname _) which allows access %sql interpreter, wonder how on %cassandra interpreter.

.net - Run all methods in a class C# -

i have class on 200 functions. need have function run of methods in class. all of functions return void , , take no parameters. this have: public void runallfunctions() { var methods = typeof(win10).getmethods(bindingflags.public | bindingflags.instance); object[] parameters = null; foreach (var method in methods) { if (method.name.startswith("wn10")) { method.invoke(null, parameters); } } } with code, error "non-static method requires target" how can run of methods? you have provide win10 class instance ; if runallfunctions method of win10 : public void runallfunctions() { var methods = gettype() .getmethods(bindingflags.public | bindingflags.instance) .where(item => item.name.startswith("wn10")); foreach (var method in methods) method.invoke(this, new object[0]); // please, notice "this" } ...

php - how to perform this join in laravel -

i have table in database called jobcardops , model jobcardop.php. fields of table include opnum , jobcardnum , prevopnum , opstatus . row uniquely identified jobcardnum , opnum pair. now, considered having field called previousopstatus contains status of previous op, wondered whether join. so clarify, when retrieve group of jobcardop models database want add field on end; 'previousopstatus'. know ill need like; $ops = jobcardop::where('jobcardnum', '=', $somejobnum) ->join('jobcardops jobcardops_1, constraint) ->select('jobcardops.*', 'jobcardops_1.opstatus previousopstatus') ->get(); where jobcardops_1 somehow offset 1 if makes sense. can if can done? thanks

java - How can I find Time from defined URL using Jsoup? -

i working in java , using jsoup . want find time below url. tried these unable it. time lies in span tag under id(timestamp--time timeago) trying not know problem. document doc; elements lin = null; string url = "http://www.dawn.com/news/1277133/this-is-how-pakistanis-around-the-country-are-celebrating-independence-day"; try { doc = jsoup.connect(url).timeout(20*1000).useragent("chrome").get(); lin = doc.getelementsbyclass("span.timestamp--time timeago"); // system.out.println(lin); } catch (ioexception e) { e.printstacktrace(); } int i=0; for(element l :lin){ system.out.println(""+i+ " : " +l.text()); i++; } replace lin = doc.getelementsbyclass("span.timestamp--time timeago"); with lin = doc.select(...

c - fprintf not working in wireshark source -

i trying make changes wireshark source code , added following code file: /epan/dissectors/packet-ssl-utils.c f=fopen("keys.txt","a+"); fflush(f); fprintf(f,"test"); ssl_print_data("client write key",c_wk,ssl_session->cipher_suite.bits/8); ssl_print_data("server write key",s_wk,ssl_session->cipher_suite.bits/8); fprintf(f,"%s %s",c_wk,s_wk); if(ssl_session->cipher_suite.block>1) { ssl_print_data("client write iv",c_iv,ssl_session->cipher_suite.block); ssl_print_data("server write iv",s_iv,ssl_session->cipher_suite.block); fprintf(f,"%s %s",c_iv,s_iv); } else { ssl_print_data("client write iv",c_iv,8); ssl_print_data("server write iv",s_iv,8); fprintf(f,"%s %s",c_iv,s_iv); } fflush(f); fclose(f); i declared file pointer 'f' @ start of function ssl_generate_keyring(). after multiple attempts of running scripts sudo ./con...