Posts

Showing posts from July, 2010

Android RecyclerView: How to avoid scroll interruption(scroll twice) when scroll state is not IDLE? -

how avoid recyclerview being scrolled when scrollstate not idle ? i have tried ideas overriding canscrollhorizontally() in linearlayoutmanager , return false when scrollstate != idle or same concept applied dispatchtouchevent() in activity , stuck screen forever. i tried asyntask method while loop made never escape doinbackground , go onpostexercute: @override public void onscrollstatechanged(recyclerview recyclerview, int newstate) { super.onscrollstatechanged(recyclerview, newstate); if (previousscrollstate != 0) { new asynctask<void, void, boolean>() { @override protected boolean doinbackground(void... params) { while (previousscrollstate != 0) { log.i(tag, "doinbackground " + previousscrollstate); } return true; } @overr

visual studio 2010 - Concatenate string and constant in resource file in C++ (MFC) -

i have c++ project mfc , resource file. in about-dialog want add constant contains version of programm. idd_aboutbox dialog discardable 34, 22, 237, 65 style ds_modalframe | ws_popup | ws_caption | ws_sysmenu caption "about monitor" font 8, "ms sans serif" begin icon idr_mainframe, idc_static, 11, 22, 20, 20 #ifdef __64bit__ ltext "communication monitor v" app_version " x86_64", idc_static, 40, 13, 150, 8 #else ltext "communication monitor v" app_version " x86_32", idc_static, 40, 13, 150, 8 #endif //__64bit__ defpushbutton "ok", idok, 200, 6, 32, 14 end if looks error 1>src\monitor.rc(80): error rc2116: expecting number id 1>src\monitor.rc(80): error rc2108: expected numerical dialog constant i tried concatenate + idd_aboutbox dialog discardable 34, 22, 237, 65 style ds_modalframe | ws_popup | ws_caption | ws_sysmenu caption "about monitor&

Set toplevel for Python package -

Image
i have folder structure: okay, have below code in main application ( main.py ) from modules.core import core1 print core1.housenumber() and below code in core1.py : from ..engine import engine1 def housenumber(): house = engine1.badluck() return house also code in engine1.py : def badluck(): return 13 this work without problem, alright. now, here interesting part, have below code in widget1.py def door(): return 'black' and code in core2.py : from ...widgets import widget1 def doorcolor(): door = widget1.door() return door and if change main.py to: from modules.core import core1, core2 print core1.housenumber() print core2.doorcolor() i error: attempted relative import beyond toplevel package . okay, if take main.py out of projectx in drive d , change main.py codes this: from projectx.modules.core import core1, core2 print core1.housenumber() print core2.doorcolor() it work perfectly. okay, understand if from

regex - Parsing text using grep -

i have textfile called netlist.txt following contents: m1 nmos1 m2 nmos2 p1 pmos1 m3 nmos3 m4 nmos4 p2 pmos2 i want retrieve line starts tab/space , matching "m" values indented, using regex. in order accomplish entered following expression in bash: egrep [:space:]*[m][0-9]+ netlist.txt but doesn't recognize space. retrieves lines regardless of having space or not. please give me advice on this. thanks, pedro you can use: grep '^[[:blank:]]m[0-9]' file output: m3 nmos3 [[:blank:]] matches either single space or single tab @ line start. [[:space:]] on other hand matches space or tab or newline.

mysql - fill a database using data of another database in c# -

i'am working on winform c# , phpmyadmin (database). have 2 differents databases(db1 , db2). i want fetch data of 1 column of table1 in db1 , store these information in table2 of db2 such if there modifications in column of db1, db2 should automacally updated. this logic used it's not working: using mysql.data.mysqlclient; namespace gnms { public partial class doublecoonection : form { dataset ds; mysqldataadapter da1; mysqldataadapter da2; mysqlconnection connec1; //for 1st database mysqlconnection connec2;//for 2nd 1 public doublecoonection() { initializecomponent(); } private void button1_click(object sender, eventargs e) { string str_conn = "server=localhost;username=root;password=****;port=3306"; string query1 = "select id,city enugro.city;"; //query1 1st db connec1 = new mysqlconnection(str_conn); try {

Android app sanity tests with appium using javascript -

my experience of writing tests has been casperjs javascript. have android app test automation using appium. have gone through many tutorials unable create first test using javascript appium. out there can me creating first test. p.s. have installed android studio , andriod sdk tools, set andriod_home , path environment variables. downloaded https://github.com/acolby/testdroid_example.git npm install run stuck while running npm install -g mocha , getting error npm err! darwin 14.0.0 npm err! argv "node" "/usr/local/bin/npm" "install" "-g" "mocha" npm err! node v0.12.4 npm err! npm v2.10.1 npm err! path /usr/local/lib/node_modules/mocha/changelog.md npm err! code eacces npm err! errno -13 npm err! error: eacces, unlink '/usr/local/lib/node_modules/mocha/changelog.md' npm err! @ error (native) npm err! { [error: eacces, unlink '/usr/local/lib/node_modules/mocha/changelog.md'] npm err! errno: -13, npm err

json - Android Volley JsonArrayRequest send and get List<Object> -

i want send jsonarrayrequest linkedlist param , same type result. error 400 means wrong request: requestqueue volleyqueue = volley.newrequestqueue(context); final type type = new typetoken<linkedlist<myclass>>() {}.gettype(); linkedlist<myclass> data = new linkedlist<>(); //populate data... try { jsonarrayrequest request = new jsonarrayrequest( request.method.get, base_url, new jsonarray(new gson().tojson(data)), new response.listener<jsonarray>() { @override public void onresponse(jsonarray response) { try { processresultdata((linkedlist<myclass>) new gson().fromjson(response.tostring(), type)); } catch (exception e) {} } },

java - JSoup - Parse HTML tag by tag -

i'm developping text parser in java , asked enhance parsing html it. parser's purpose divide file parsed 3 other files, 1 words contained in file, 1 sentences , other questions. the *.txt part works perfectly, got problem when parsing html. i create temporary file *.txt extension , pass in text parser, if pass url html file linked formed this: <!doctype html> <head> ... html here ... </head> <body> <ul class="some_menu"> <li class="some_menu_item">n1</li> <li class="some_menu_item">n2</li> <li class="some_menu_item">n2</li> </ul> <div> question ? sentence . ... other text ... </div> </body> </html> the question file filled with: n1 n2 n3 question so, wondering, there way parse jsoup tags tags can add lin

c# - JQuery Autocomplete/ASP.NET Webhandler to include value of another textbox -

so have been @ quite while (over week) searching google , stackoverflow , that. can't seem compilation of information make work. [aspx page] <span>make</span> <asp:textbox id="make_searchbox" runat="server" tooltip="enter make"></asp:textbox> <span>model</span> <asp:textbox id="model_searchbox" runat="server" tooltip="enter model"></asp:textbox> [javascript] <%--autocomplete function--%> <script type="text/javascript"> var value = ""; $(document).ready(function () { $("#pagecontent_make_searchbox").autocomplete("/webhandlers/autocomplete.ashx",{ extraparams: { field: "make" }, autofill: false }); $("#pagecontent_model_searchbox").autocomplete("/webhandlers/autocomplete.ashx", { extraparams: { field: &quo

c - How to make so that a field points to its structure? -

to sum have 2 structures, item , player , player structure contains 2 item structure in fields. item structure have field pointer player structure, pointer must points player owns item. when initialize player whith new_player() want make items points player being created inside function . me doesn't seems possible because items points structure created on stack, once structure returned items members points freed memory. made few tests seems confirm theory. code: struct item { int power; struct player* owner; }; struct item new_item(int power, struct player* owner) { struct item an_item; an_item.power = power; an_item.owner = owner; return an_item; } struct player { int age; struct item item_1; struct item item_2; }; struct player new_player(int age) { struct player a_player; a_player.age = age; a_player.item_1 = new_item(1, &a_player); a_player.item_2 = new_item(2, &a_player); return a_player; }

How to edit a row by uploading more images keeping its already inserted images as they are using php,mysql -

i have problem edit option in project.i have table 3 columns id,organisation name , image.i have inserted multiple images organisation using multiple image upload,now need edit rows , need add more images each organisation.how can without affecting inserted images in php , mysql in advance

cordova - Camera.DestinationType.FILE_URI is not working on IOS only -

we have migrated worklight 6.1 application t ibm mobilefirst 7.0 platform , functionalities working expected on android environment, in ios facing issue: there function called "quick receipt". on click on button device camera opens , photo taken. problem photo not displaying - returns complete blank page issue on ios device not on android device. camera.destinationtype.file_uri not working on ios. for security reason wont share code. here similar prototype code. html <div><img alt="quickreceipts" src="resources/img/camera.png" onclick="imgcapture();"</div> javascript imgcapture: function (){ navigator.camera.getpicture(this.onsuccess, this.onfail,{quality:80,destinationtype:camera.destinationtype.file_uri, targetwidth:600,targetheight:1050} }, onsuccess:function(imgdata) { // applying css , displaying img $("#imgreceipt").attr("src","data:image/jpeg;base64,"

What is the difference between Memory and Javascript Memory in Google Chrome Task Manager? -

Image
i stumbled upon google chrome task manager. difference between memory , javascript memory?

mysql - How to sum alias value if they are on same date and id? -

i want add values in column percent if department_id value same in same date. here query try, select date(r.date) date, d.department_id, ( ( select count(case when correct='yes' 1 end) )/100 * (select count(id) tbl_quest) ) percent tbl_show r left join get_admin on (r.get_admin_id = a.admin_id) left join get_department d on (a.department_id = d.department_id) group r.date here result of above query: date department_id percent 2015-11-17 3 0.1000 2015-11-17 1 0.5700 2015-11-17 3 0.2000 2015-11-18 1 0.5700 2015-11-18 1 0.0100 ........ now, want sum percent value if values same department id , same date. i want change following result, date department_id percent 2015-11-17 3 0.3000 2015-11-17 1 0.5700 2015-11-18 1 0.5800 ........ i appreciate suggestion. try use group on date & d

c# - Why HttpRequestValidationException has 500 http error code instead of 400? -

when tested web-app based on mvc5 found httprequestvalidationexception returns 500 gethttpcode() . catch exception during security testing of requests server. mvc performs request validation , throws exception, processed in application_error , got 500 code returned, but, in fact, if user passed wrong input server should return 400 error (bad request). don't understand why exception has 500 error. wrong ? there 4 reasons why 500 might considered more appropriate. one isn't clear when httprequestvalidationexception happens did wrong thing. user quite sent incorrect, it's possible server incorrectly rejected fine. considering default behaviour on many requests could malicious, it's probable majority of cases thrown in response non-malicious requests (the user isn't actively trying site harm) fall category. hence either should consider 4xx or 5xx , 5xx assumption (don't blame client when aren't sure it's client's fault). when happe

javascript - Css Chrome Firefox diff -

i have next code work differently in chrome in firefox. questions is: must should add fix firefox work exact chrome? link fiddle screens: screens: chrome firefox <table class="ui cellled striped table" id="table"> <thead> <tr> <td class="ui sticky">asdasd</td> <td class="ui sticky">asdasd</td> <td class="ui sticky">asddd</td> <td class="ui sticky">asdda</td> <td class="ui sticky">asdddd</td> </tr> </thead> <tbody> <tr> <td>raaarararar</td> <td>raaarararar</td> <td>raaarararar</td> <td>raaarararar</td> <td>raaarararar</td> </tr> </tbody> </table> and js: $('.ui

vb.net - Is there an alternative method to using 15 If statements? -

i have 15 items in combobox , when user selects item want present different in textbox . at moment have: if cb_dropdown.selectedindex = 0 rtb_sql.text = "update access set accessdesc = 'less 5' accessid < '5'" else if cb_dropdown.selectedindex = 1 rtb_sql.text = "update access set accessdesc = 'more 5' accessid > '5' , < '10' " else if cb_dropdown.selectedindex = 2 rtb_sql.text = "" etc.... is there nicer , more methodical way approach looks quite scruffy? yes, called select . select case cb_dropdown.selectedindex case 0 4 rtb_sql.text = "update access set accessdesc = 'less 5' accessid < '5'" case 5 rtb_sql.text = [...] case else rtb_sql.text = [...] end case although in case think looking < (less than) , > (greater than). if cb_dropdown.selectedindex < 5 rtb_sql.

html - Input-type range with custom css - thumb not showing correct in IE -

my web page looks in other browsers ie. here thumb of range sliders "cut off". my code here: https://jsfiddle.net/t1pw9rh2/ html: <form action="url-link-here" method="post"> <span id="mydiv">100</span> <input class="input-range" id="sizeid" onchange="test()" oninput="test()" type="range" name="size" value="100" min="5" max="250" step ="5"> </form> css: input[type=range] { -webkit-appearance: none; margin: 10px 0; width: 100%; } input[type=range]:focus { outline: none; } input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 10px; cursor: pointer; animate: 0.2s; box-shadow: 0px 0px 0px #000000; background: #fff; border-radius: 1px; border: 1px solid #39404d; } input[type=range]::-webkit-slider-thumb { box-shadow: 0px 0px 0px #000000; border: 1px solid #3940

osx - Virtual serial ports in ORSSerialPort -

i rewriting osx control application using orsserialport . in occasions, control serial device not directly connected machine, or mock communication of such device locally testing. using socat 1 can create virtual serial ports, example channel communication real serial device locally or on network. for example, here create pair of virtual devices /dev/master , /dev/slave : sudo socat -d -d -d -d -lf /tmp/socat pty,link=/dev/master,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,echo=0,crtscts=0,user=gerwin,group=staff pty,link=/dev/slave,rawer,echo=0,user=gerwin,group=staff using such setup, able connect virtual ports using pyserial. however, using orsserialport did not work me. when stepping through code seems originate orsserialport relying solely on iokit, in 'virtual' devices don't show on radar. when initialising instance path, e.g. /dev/master , corresponding io_object_t not exist -- , initialisation returns nil. i want avoid going deep iokit , kernel stuff ( as

jquery - Javascript Websocket to listen on port 80 -

i have web server deployed in port 80 websocket running in javascript. var wsurl = ws://localhost:80/ws" wsconn = new websocket(wsurl); but keep getting error: websocket connection 'ws://localhost/ws' failed: error in connection establishment: net::err_connection_refused i had no problem when run locally port other 80 in production need use port 80 , keep getting error. is there anyway can make websocket work port 80 ? using window.location.hostname clear url discrepancies have while in production. using localhost in url result in ws requests user's local machines opposed production server. hence connection refusal. note method meant when client directly served same websocket server, if servers ever different need way exact url of websocket server. --most type of redirect/forward/proxy backend (serving frontend) websocket server.

r - Find which colnames are undefined and create them -

Image
so have data frame povprecja.predmeti and in data.frame have columns named: "krediti_razporejanje_n_2" "krediti_razporejanje_n_3" "krediti_razporejanje_n_4" "krediti_razporejanje_n_5" i generate/define column name krediti_razporejanje_n_1 , i have 5 column names defined . because of different data frames have dinamic code, means i find (from krediti_razporejanje_n_1 krediti_razporejanje_n_5) colname undefined , define column name , fill values 0. if example mising column krediti_razporejanje_n_1 assign <- 0 i know hand like: povprecja.predmeti$krediti_razporejanje_n_1 <- rep(0,nrow(povprecja.predmeti)) but need function, if data there 2 colnames defined, find 1-5 undefined , define them. i can find 1 missing code which(paste0("krediti_razporejanje_n_", 1:5) %in% colnames(povprecja.predmeti)==false) but have dinamic function. miscol <- function(x){ # x = data.frame missing <- past

java - Double.parseDouble() gives "Multiple Points, NumberFormatException" -

i have compare 2 strings parsing them double . strings are: "2.1.10" , "2.1.9". here, need know whether first 1 greater second 1 or not? but, while parsing these using double.parsedouble("2.1.10") or double.parsedouble("2.1.9") giving nullpointerexception saying "multiple points". you don't compare doubles, compare version numbers, , not numbers, must compare each position. something like: string[] v1 = "2.1.9".split("\\."); string[] v2 = "2.1.10".split("\\."); if (v1.length != v2.length) return; (int pos = 0; pos < v1.length; pos++) { // compare v1[pos] v2[pos] necessary if (integer.parseint(v1[pos]) > integer.parseint(v2[pos])) { system.err.println("v1 greater"); } else if (integer.parseint(v1[pos]) < integer.parseint(v2[pos])) { system.err.println("v2 greater"); } } result: v2 greater

How can i create landscape PDF using android native PdfDocument API? -

i using pdfdocument api write pdf view using android problem if writing pdf of a4 size. how can make in landscape mode? thanks in advance. a typical use of android pdf apis looks this: // create new document pdfdocument document = new pdfdocument(); // crate page description pageinfo pageinfo = new pageinfo.builder(300, 300, 1).create(); // start page page page = document.startpage(pageinfo); // draw on page view content = getcontentview(); content.draw(page.getcanvas()); // finish page document.finishpage(page); . . . // add more pages . . . // write document content document.writeto(getoutputstream()); // close document document.close(); according developer.android.com reference : public pdfdocument.pageinfo.builder (int pagewidth, int pageheight, int pagenumber) added in api level 19 creates new builder mandatory page info attributes. parameters pagewidth page width in postscript (1/72th of inch). pageheight page h

c++ - Triangle Grid Not Rendering correctly [DirectX 11] -

Image
i'm trying make grid of triangles terrain generation project in directx 11, when gets drawn screen draws in 3 axis, instead of x , z. i correct amount of vertices , indices, in vector of indices has size of 972, first 486 of them set 0 instead of actual values. i wondering if clarification on whether setting vertex/index buffers correctly. below example 10 10 grid. generateterrain method void application::generateterrain(int vertrows, int vertcols) { hresult hr; // ------------------------------------- create vertex buffer -------------------------------------- totalcellrows = vertrows - 1; totalcellcols = vertcols - 1; // width , total width float dx = 1.0f; float totalwidth = totalcellcols * dx; // depth , total depth float dz = 1.0f; float totaldepth = totalcellrows * dz; // x , z offsets float xoffset = -totalwidth * 0.5f; float zoffset = totaldepth * 0.5f; totalvertices = vertrows * vertcols;

c# - What is the correct Content Type of an .xps file -

i'm creating asp.net web application in c# convert bunch of .xps files .pdf , want validate input file converted content type instead of file extension security reasons. according resource application/vnd.ms-xpsdocument or application/oxps depending on file

invalid initialization of non-const reference of type ‘std::string& -

i trying trim string using function rtrim() string header in c++ without using algorithm. did examine start , end position if there space exist, delete out using isspace() when compile, error: invalid initialization of non-const reference of type ‘std::string& {aka std::basic_string&}’ rvalue of type ‘const char*’ and here code #include <iostream> #include <string> using namespace std; string rtrim(string& s) { size_t i; for(i = s.length() - 1; != (size_t)-1; i--) { if(!(isspace(s[i]))){ break; } } return s.substr(0, + 1); } int main(){ cout << "|" << rtrim(" hello world\t ") << "|" << endl; } whenever set parameter such string s = ( "hello world\t "); , run cout << rtrim(s) << endl; seems working doesn't work above code. suggestions? thank you. the above code create temporary object of std::string on stack , pass functio

angularjs - AngularStrap - Popover in a Popover -

i have angular strap popover contains form elements: <button type="button" class="btn btn-success" bs-popover title="2nd popover" html="true" data-content="should become form of kind"> <span class='glyphicon glyphicon-plus'></span> </button> i load first popover <button type="button" "class="btn btn-default" bs-popover data-auto-close="1" data-html="true" data-content="{{popovercontent}}" data-animation="am-flip-x" title="1st popover"> button label </button> using: (function() { "use strict"; angular.module("app").controller("managercontroller", ["$scope", "imagehierarchyrepository", "$templatecache", "$compile", function ($scope, imagehierarchyrepository, $templatecache, $compile) { imagehierarchyrepository.query

javascript - Cross-Origin Resource Sharing issue -

i have been able access resource different origin in ie microsoft.xmlhttp , assume proper response headers coming other server. when try access same resouce using xmlhttprequest in chrome fails below error get http://example1.com/appname/app/home.aspx?option=2&s=1&d=1&c=us&c=1391 (anonymous function) @ vm514:2 injectedscript._evaluateon @ vm369:875 injectedscript._evaluateandwrap @ vm369:808 injectedscript.evaluate @ vm369:664 vm514:2 uncaught domexception: failed execute 'send' on 'xmlhttprequest': failed load 'http://example1.com/appname/app/home.aspx?option=2&s=1&d=1&c=us&c=1391' now don't know issue using chrome v47.x any idea???

c# - When should I use Neutral culture? What is the necessary for it? why not force using Specific Culture? -

when should use neutral culture? necessary it? why not force using specific culture? can tell me real time scenario, neutral cultures used specific culture? from msdn: a neutral culture culture associated language not country or region. differs specific culture, culture associated both language , country or region. example, fr name neutral french culture, while fr-fr name french culture in france. if property returns false, culture either specific culture or invariant culture. example in case speak spanish spain have friend speaks spanish mexico. both speak spanish there words different if want translation should use spanish spain (es-es) spanish people , spanish mexico (es-mx) mexican people. in cases can't translate software (gui) languages , cultures use spanish translation people speak spanish (spain,mexico,argentina,usa,philippines ...)

In-App Purchase basic app with additional premium features app in iOS -

i'm trying create application iap enabled. testing i'm creating sample application first. what need releasing small size application minimum features first , if user willing use features needs use iap. my question is, how can link full feature application inside basic application ? if clarify situation more, need have single application visible in app store name of "myappname" , basic application. need upload product app source code? in itunes connect have added details basic app (myappname). in features category, have given details product app. i'm not clear related code should uploaded review. is product means, different app different bundle id need add itunes connect new app? my product not assets code related augmented reality , it's related libraries. according apple documentation think scenario downloading whole new application enabled features apple's server. i hope guys can understand scenario now. hope can implement.

linux - Ways to get strace-like output for Heisenbug -

i'm chasing heisenbug in linux x64 process. (attaching process debugger or strace makes problem never occur.) i've been able put in infinite loop when code detects fault , attach gdb way, shows me file descriptor (fd) should working no longer valid. want history of fd, hence trying strace, of course won't let problem repo. other factors indicate problem gdb/strace timing. i've tried running strace -etrace=desc or -eraw=open , outputting ramdisk see if reduce strace overhead in right way trigger problem, no success. tried running strace+, order of magnitude slower strace. the process i'm attaching partly commercial binary don't have source access to, , partly code preload process space, printf -everywhere isn't 100% possible. do have suggestions how trace fd history? update: added note strace+ i solved tracing problem by: preloading wrapper stub functions around relevant system calls, open() , close() , poll() logging releva

python 2.7 - Why are the html tags displayed as text? -

my code looks this python: render = web.template.render('templates/', base="layout") . . . fileout_text = codecs.open(filename_text, 'r', 'utf-8').read() text = markdown.markdown(fileout_text) return render.text_temple(text=text) text_template.html: $def text < text>$text < /text> now $text should contain html tags insted of markdown syntax. problem is, tags stay text when website displayed. appreciated. sorry spelling english not first language.

java - Why does this incorrect "package" tag in MyBatis XML config work? -

usually define our queries in xml files, , mappers portion of our mybatis xml config looks this: <mappers> <mapper resource="mappers/example1.xml"/> <mapper resource="mappers/example2.xml"/> </mappers> and fine. now contributor added mappers java classes , have mixed configuration both xml files , java packages listed within mappers : <mappers> <mapper resource="mappers/example1.xml"/> <mapper resource="mappers/example2.xml"/> <package name="it.example.mappers1" /> <package name="it.example.mappers2" /> </mappers> i see document type definition http://ibatis.apache.org/dtd/ibatis-3-config.dtd not include package correct content mappers , , told eclipse, gives me error: the content of element type "mappers" must match "(mapper)+" however, still works fine when run application. on other hand, when try

mysql - SQL help needed - Migrating data from WordPress custom fields to CMB2 (custom meta boxes) -

i'm trying migrate data bunch of wordpress custom fields 50 posts cmb2 data i'm looking in wp_postmeta table wpcf-contact-[field-name] meta keys , target meta key _program_contact_contact_group array , looks demo content: a:1{i:0;a:7{s:12:"contact_name";s:5:"cname";s:16:"contact_position";s:6:"ctitle";s:13:"contact_email";s:6:"cemail";s:15:"contact_address";s:8:"caddress";s:20:"contact_organization";s:13:"corganization";s:13:"contact_phone";s:6:"cphone";s:11:"contact_fax";s:4:"cfax";}} any how done sql appreciated. thanks!

asciidoctor - How can I add mutiple anchors to the same block? -

i'm using asciidoctor create html manual. in order keep existing links valid, need multiple anchors @ same header. basically want output: <a id="historic1"></a> <a id="historic2"></a> <h2 id="current">caption</h2> while possible create multiple inline anchors this inline [[historic1]] [[historic2]] [[current]] anchor inline <a id="historic1"></a> <a id="historic2"></a> <a id="current"></a> anchor it looks additional anchor macros in front of blocks swallowed: [[historic1]] [[historic2]] [[current]] == caption <h2 id="current">caption</h2> so options have multiple anchors in front of block? you can use shorthand version of solution. [#current] == [[historic1]][[historic2]]caption now 3 anchors on same heading.

Multiple If Statements VBA -

i'm new vba , sql, , i'm building table uploaded sql onto excel , using vba. want if column i(check market) or j(check m2) have value says #na go no further , don't carry out upload or rest of code. think 1 of problems might have if loop - successful , has no errors associated it. this code far 'where marked sht.cells(row,15) = "x" 'first if loop if sht.cells(lrow, 15) = "x" 'if or j columns #n/a not continue if iserror(sht.cells(lrow, 9).value) msgbox "error in column 'check market'" if iserror(sht.cells(lrow, 10).value) msgbox "error in column 'check m2'" ''''at moment above part isn't running, notifies user of error doesn't stop process. 'change blank spaces null ******* ssql = *******main part of code goes here****** 'execute queries ******** 'put 'null' values blank ''

ios - downloading video from youtube objective c -

i'm trying download video youtube getting error. error mention in code my code -(void)downloadvideo{ lbyoutubeextractor *extractor = [[lbyoutubeextractor alloc] initwithurl:[nsurl urlwithstring:[nsstring stringwithformat:(@"https://www.youtube.com/watch?v=%@"), videoidtodownload ]] quality:lbyoutubevideoqualitylarge]; [extractor extractvideourlwithcompletionblock:^(nsurl *videourl, nserror *error) { if(!error) { nslog(@"did extract video url using completion block: %@", videourl); dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ nserror* error = nil; nsdata* data1 = [nsdata datawithcontentsofurl:videourl options:nsdatareadinguncached error:&error]; //data1 nill if (error) { //error domain=nscocoaerrordomain code=256 "the file “3gpp;+codecs="mp4v.20.3,+mp4a.40.2"&fallback_host=tc.v8.cache4.googlevideo.com&itag=36” couldn’t opened."

Atom editor scrollbar size/color -

i'm using atom develop in php me, have issue editor, use 1 dark theme try change color , size of right scrollbar of opened file because small , hard see me i try info change atom-text-editor pane scrollbar colours but don't see changes. any ideas? thanks update: below answer applies atom < 1.13. starting atom 1.13 shadow dom abondoned , example should work original poster had put (that without ::shadow selector. for atom version 1.12: atom uses shadow dom editor, might reason not work you. style scrollbar both editor , tree view try this: .tree-view-resizer, atom-text-editor::shadow { ::-webkit-scrollbar { background-color: #262626; &-track {} &-thumb { background-color: #404040; &:window-inactive { background-color: rgb(116, 115, 105); } } &-corner { background-color: #262626; } } }

dependency injection - Register a list of implementations with Pico Container -

i have interface public interface iinterface{} and have list of implementations of interface: public class myclass1 implements iinterface{} public class myclass2 implements iinterface{} what i'd pico container: register implementations of iinterface able resolve them list: public class mytest { public mytest(iinterface[] list){} } and option able register implementation named key: container.addcomponent(iinterface.class, myclass1.class, "name1"); container.addcomponent(iinterface.class, myclass2.class, "name2"); to able like: container.getcomponent(iinterface.class, "name2"); is there built-in solution @ least 1st question? upd found implementation in pico quite strange , not intuitive. to able inject array it's necessary: container.addcomponent(myclass1.class); container.addcomponent(myclass2.class); container.addcomponent(mytest.class); mytest test = container.getcomponent(mytest.class); this inject arr

php - Wordpress - Getting the queried type (Category, archive, author etc) -

e.g 1. when clicks "curators" category, bring them curators category page , display posts of "curators" category own featured image. or 2. when clicks author "john", bring them john page posts , display "john" featured image. question how can retrieve "curators" or "john" want display featured image different pages. extract "john" go folder find john.jpg , display archived page header image. or go "explorers" category page , display category page explorer featured image. i got it's category: <? $cat = get_query_var('cat'); $yourcat = get_category ($cat); ?> #headerimg { background-image: url(<?php echo ithaka_directory_uri() .'/images/'. $yourcat- >slug .'.jpg'?>); } did pgk told me to: get_queried_object(); not working. <?php $term = $wp_query->get_queried_object(); ?> #headerimg { background-image: url(<?php echo ithaka_directo

javascript - <div> created through jquery not getting styled -

i'm trying create grid of square div s using jquery . problem though columns , content created, last column's div s not styled resulting in 0 height/width div . js $(document).ready(function() { (i = 0; < 4; i++) { var column = $("<div class='column'></div>"); (j = 0; j < 4; j++) { var unit = $("<div class='unit'></div>"); $('.unit').css("width", (960 / 4)); $('.unit').css("height", (960 / 4)); column.append(unit); } $("#container").append(column); } }); css #container { width: 100%; height: auto; text-align: center; } .unit { background-color: grey; margin: 1px; } .column { display: inline-block; } html <body> <div id="container"></div> </body> use defined variable unit have created instead $('.unit') var unit = $("<div class='

c# - How can I return a Dictionary<string,Dictionary<int,decimal>> from this method? -

i have linq statement returns iqueryable of class below. class: public class suppliersummaryreport { public int year { get; set; } public string suppliername { get; set; } public decimal turnovervalues { get; set; } } eg: {2012,supplier1,90},{2011,supplier2,95} however, need convert data dictionary of dictionaries. have extension method me , friend have built, stumped @ final section. extension method: public static dictionary<tfirstkey, dictionary<tsecondkey, tvalue>> pivot<tsource, tfirstkey, tsecondkey, tvalue>(this ienumerable<tsource> source, func<tsource, tfirstkey> firstkeyselector, func<tsource, tsecondkey> secondkeyselector, func<tsource, tvalue> value) { var retval = new dictionary<tfirstkey, dictionary<tsecondkey, tvalue>>(); var l = source.tolookup(firstkeyselector); foreach (var item in l) { var dict = new di

Android RecyclerView update Adapter -

i've got recyclerview adapter. tried set adapter programmatically, doesnt work. here's code: public class recordadapter extends recyclerview.adapter<recordviewholder>{ private list<recorddata> records; public recordadapter(){ records = new arraylist<>(); } @override public recordviewholder oncreateviewholder(viewgroup parent, int viewtype) { flog.d("records: creating new recordviewholder"); view view = layoutinflater.from(parent.getcontext()).inflate(r.layout.record_item, parent, false); return new recordviewholder(view); } @override public void onbindviewholder(recordviewholder holder, int position) { recorddata data = records.get(position); flog.d("records: binding new recordviewholder"); holder.mrecordtext.settext("record " + position); } @override public int getitemcount() { flog.d("records: count -

r - Select only specific cases from dataframe -

how can select rows followed same value in specific column? i.e. (using reference values of v1) `v1 = c(1,1,2,3,1,2,4,1,1,2,3,4) v2 = seq(1:12) v3 = c(rep("blue", 4), rep("red", 4), rep("green", 4)) df<- data.frame(v1, v2, v3) df` > df v1 v2 v3 1 1 1 blue 2 1 2 blue 3 2 3 blue 4 3 4 blue 5 1 5 red 6 2 6 red 7 4 7 red 8 1 8 red 9 1 9 green 10 2 10 green 11 3 11 green 12 4 12 green to this; cases 1 , 8, followed cases value v1 1 saved v1 v2 v3 1 1 1 blue 8 1 8 red you extract indices of interest which, , extract rows of interest dataframe. indices <- which(df$v1[1:(nrow(df)-1)]==df$v1[2:nrow(df)]) df.new <- df[indices,]

containers - Scaling with docker-composer and appending a number to the hostname? -

i've got docker-compose.yml : master: build: . slave: image: master hostname: slave command: run_slave how can make docker-compose scale slave=5 generate machines unique hostnames? ...e.g. this: slave1 slave2 slave3 slave4 slave5 there no way set hostname value. if need unique identifier, use unique container id, can running $(hostname) .

blank pdf page is created when im using itext in android -

Image
screen shot m adding images in pdf file generate pdf document problem automatically adding 1st page blank page , remaining pages contain images fine. how should overcome problem. pdfpath = dir + "/" + txtfilename.gettext().tostring() + ".pdf"; string pdffilename = txtfilename.gettext().tostring() + ".pdf"; pdfwriter writer; file file = new file(dir, pdffilename); document document = new document(); try { writer = pdfwriter.getinstance(document, new fileoutputstream(file)); headerfooterpageevent event = new headerfooterpageevent(); writer.setpageevent(event); } catch (filenotfoundexception e) { e.printstacktrace(); } catch (documentexception e) { e.printstacktrace(); } document.open(); image image = null; (int = 0; < listofimage.size(); i++) { string imgfilename = listofimage.get(i).tostring(); try { image = image.getinstance(imgfilename); } catch (badelementexception e) { e.prints

Delphi Rest Request gets Bad request returned -

i have delphi program calling python rest service. the python rest service looks : @app.route('/flagger/api/v1.0/stem', methods=['get']) def stem_request(): print request.json if not request.json or u'text' not in request.json: bad_request('no "text" field given') text = request.json['text'] return jsonify(stemmed=stem(text)), 200 when curl request service answer: c:\program files\curl>curl -i -h "content-type: application/json" -x -d "{\"text\":\"hij geeft mij appels\"}" h ttp://192.168.99.100:5000/flagger/api/v1.0/stem http/1.0 200 ok content-type: application/json content-length: 30 server: werkzeug/0.11.3 python/2.7.10 date: thu, 28 jan 2016 13:17:36 gmt { "stemmed": "geeft appel" } in delphi xe7/pro program have restclient, restrequest , restresponse component. all components have contentyp

c# - ASP.NET Web API Async Tasks, sending Mails -

my application has massive performance problems. found problem comes sending of emails. how can fix problem method registeruser returns, while sending of email still in process? tried starting thread run sendemailconfirm method, gave me objectdisposedexception in sendemailconfirm public async task<identityresult> registeruser(accountviewmodels.registerviewmodel usermodel) { var result = await _usermanager.createasync(user, usermodel.password); this.sendemailconfirm(usermodel.email); return result; } public async void sendemailconfirm(string mail) { string subject = "please confirm email chronicus"; string body = "hello" string email = user.email; _messageservice.sendmail(mail, subject, body); } public void sendmail(string receiver, string subject, string body) { this._msg = new mailmessage(username, receiver); this._msg.from = new mailaddress(username, name); this._msg.subject = subject;

scala - how to serve a file within the spray framework (type mismatch getFromFile)? -

this simple question, new scala (and java too). trying implement spray file server. works when returning hello-string, when trying serve file getfromfile get: error:(16, 24) type mismatch; found : spray.routing.route (which expands to) spray.routing.requestcontext => unit required: spray.httpx.marshalling.toresponsemarshallable getfromfile("build.sbt") ^ ^ how should resolve error? import akka.actor.actorsystem import spray.routing.simpleroutingapp object main extends simpleroutingapp { def main(args: array[string]): unit = { implicit val actorsystem = actorsystem() startserver(interface="localhost", port = 8080) { path("file") { complete { "hello" //getfromfile("build.sbt") } } } } } the getfromfile automatically completes request, remove complete , try below. , make sure working