Posts
Showing posts from September, 2011
ant - Unresolved Dependencies errors When Trying To Build Apache Nutch 2.3.1 -
- Get link
- X
- Other Apps
its first time trying setting , build apache nutch 2.3.1 based on this youtube tutorial on windows 10 got unresolved dependencies errors below: d:\apachenutch>ant runtime buildfile: d:\apachenutch\build.xml trying override old definition of task javac [taskdef] not load definitions resource org/sonar/ant/antlib.xml. not found. ivy-probe-antlib: ivy-download: [taskdef] not load definitions resource org/sonar/ant/antlib.xml. not found. ivy-download-unchecked: ivy-init-antlib: ivy-init: init: [mkdir] created dir: d:\apachenutch\build [mkdir] created dir: d:\apachenutch\build\classes [mkdir] created dir: d:\apachenutch\build\release [mkdir] created dir: d:\apachenutch\build\test [mkdir] created dir: d:\apachenutch\build\test\classes clean-lib: resolve-default: [ivy:resolve] :: apache ivy 2.3.0 - 20130110142753 :: http://ant.apache.org/ivy/ :: [ivy:resolve] :: loading settings :: ...
ghc - Use Haskell through GHCI alone? -
- Get link
- X
- Other Apps
i'm totally new haskell, soft question, seems tutorials haskell define main function, compile it, , execute program whole command line. i'm coming more of r/julia/python background feel comfortable working within repl or sending lines repl editor. i'm wondering if possible haskell programmer using ghci alone? having difficult following of tutorials on haskell within interpreter reason. code written executed within interpreter different code compiled i.e. interpreter require special syntax? tl; dr in order use ghci, definitions ( ... = ... ) must prefixed let - e.g let ... = ... . ghci have subtly different syntax regular haskell. accommodate use of io in repl. for part, syntax of ghci same syntax do block in io monad: definitions can made via let syntax: let f x = 10 and io actions can sequenced: print 1 when submitted ghci, performed - i.e let definitions bound , io actions performed. however, subtle differences come ghci's other ...
css - Why `margin: 1 auto;` doesn't work? -
- Get link
- X
- Other Apps
why margin: 0 auto; works margin: 1 auto; doesn't? there hackish way fix this? .container { width: 220px; /* margin: 0 auto; */ /* <-- works.*/ margin: 1 auto; /*<-- error. how fix??? */ padding: 16px; display: block; border: 2px solid black; } <div class="container"> <p style="text-align: center;">lorem ipsum dolor sit amet, consectetur adipisicing elit. sint non cumque @ minima voluptates totam suscipit, esse vitae recusandae fugit, alias quibusdam odio sunt iure velit, perferendis voluptas ratione quo!</p> </div> sorry stupid question upd: i'm sure answer useful searchers have similar troubles, plz not delete. because 0 universal, 1 depends on unit, , since no unit specified browser doesn't know do.
c# - Targeting .Net Core Framework and Full .Net 4.5/4.6 Framework in one Nuget Package -
- Get link
- X
- Other Apps
is possible @ all? trying figure out best way go this. have project, project named "dofunkystuff". we want have 2 versions of project, 1 build on .net core, , 1 built on full .net 4.5 or 4.6 framework has more features. firstly, how go structuring these projects in solution, have both of these built 1 nuget package, structured targeting different frameworks. possible? possible have same project name, targeting separate framework different functionality, built 1 nuget package? any guidance amazing. in advance. ok found reference describes how target both core , full framework. describes how go using each 1 in code. seems end ugly code. think better off having separate projects. https://docs.microsoft.com/en-us/dotnet/articles/core/tutorials/libraries#how-to-multitarget
swift - How can I get unicode number of a character? -
- Get link
- X
- Other Apps
this question has answer here: how convert int hex string in swift 5 answers how can unicode number of given string ? for example, cyrillic small letter er u+0440 stands "р" how can "u+0440" or "0440"? ====technical information==== unicode number: u+0440 html-code: р var mystring = "р" scalar in mystring.unicodescalars { print("\(scalar.value) ") // print: 1008 } 440 in hex equal 1088 in decimal: var mystring = "р" scalar in mystring.unicodescalars { print(string(scalar.value, radix: 16)) }
Can't open lib '/usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1 when create "Database Monitor" item in zabbix -
- Get link
- X
- Other Apps
before that, unixodbc installed unixodbc.x86_64 2.2.14-14.el6 unixodbc-devel.x86_64 2.2.14-14.el6 and oracle odbc driver installed is: oracle-instantclient11.2-basic-11.2.0.1.0-1.x86_64 oracle-instantclient11.2-odbc-11.2.0.1.0-1.x86_64 oracle-instantclient11.2-devel-11.2.0.1.0-1.x86_64 and odbcinst.ini: [oracle-11g] description=odbc oracle driver=/usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1 usagecount=1 fileusage=1 driver logging = 7 odbc.ini: [test] driver = oracle-11g dsn = oracle-11g servername = gzdb userid = xxx password = xxx and odbc connection working successfully shell> isql -v test +---------------------------------------+ | connected! | | | | sql-statement | | [tablename] | | quit | | | +---------------------------...
PHP only adds first row with input while MySQL works fine? -
- Get link
- X
- Other Apps
when click 'add items cart' values on image above, echoing sql query give me this: insert cart (product_id, quantitycart) values (1, 10) on duplicate key update quantitycart = quantitycart + 10; update products set quantity = quantity - 10 product_id = 1; insert cart (product_id, quantitycart) values (2, 15) on duplicate key update quantitycart = quantitycart + 15; update products set quantity = quantity - 15 product_id = 2; insert cart (product_id, quantitycart) values (3, 20) on duplicate key update quantitycart = quantitycart + 20; update products set quantity = quantity - 20 product_id = 3; by manually inserting query via phpmyadmin. working fine, inserts 3 queries gives me 1 row affected now, problem on website when click 'add items cart', inserts first row quantity. so result give me (it added first row: coca-cola2 value of 10): this add cart code: <?php if (isset($_post['addcart']) && $_post['addcart']==...
java - How can I access request MultipartBody information in new Callback<ResponseBody>? -
- Get link
- X
- Other Apps
hello fellow android programmers. stuck on problem. need retrieve filename or index of loop iteration within callback method. using retrofit 2.0. i thinking can pass information post form field (even if server doesn't need it), , retrieve in call.request.body() inside onresponse() method. if use debugger can see data. see 2 parts of form. thinking can add part in form hold index. however, don't know how access through code. know best way this? want make sure images have been uploaded @ end of last onresponse callback. initially wanted using call.execute.body() because have "please wait dialog" gives me exception saying should call method inside asynctask. please ignore attempts @ turning request json object... any ideas help, thanks! for (file f : theimages) { requestbody reqfile = requestbody.create(mediatype.parse("image/*"), f); multipartbody.part body = multipartbody.part.createformdata("file", "image.jpg", re...
TypeScript signature of Promise#catch onrejected handler -
- Get link
- X
- Other Apps
i notice standard typing promise#catch in es6-shim.d.ts defined as interface promise<t> { catch(onrejected?: (reason: any) => t | promiselike<t>): promise<t>; catch(onrejected?: (reason: any) => void): promise<t>; } i wondering why written way, instead of as catch(onrejected?: (reason: any) => t | promiselike<t> | void): promise<t>; some other file es6-promise.d.ts nate archibald gives single signature of catch<u>(onrejected?: (error: any) => u | thenable<u>): promise<u>; not referring <t> @ all. so second overloaded signature in es6.shim-d-ts , far know in heavy use in compile-to-es5 environment, unnecessary/undesirable? well, t can void means use case supported. if did t | promiselike<t> | void output might have been promise<string> that's resolved void type error. note promises aren't statically typed in strong way in these definitions. signature ha...
python - difference between print and return -
- Get link
- X
- Other Apps
this question has answer here: why use return statement in python? 12 answers if print result of for loop in function : def show_recommendations_for_track(tracks = [], *args): results = sp.recommendations(seed_tracks = tracks, limit=100) tracks = results['tracks'] track in tracks: print track['name'] it prints 1 hundred track names. if swap print return track['name'] , it prints 1 track name. why? return stops execution of whole function , gives value callee (hence name return). because call in loop, executes on first iteration, meaning runs once stops execution. take example: def test(): x in range(1, 5): print(x) return x test() this give following output: 1 this because loop starts @ 1, prints 1, stops execution @ return statement , returns 1, current x. return near ...
python - Finding word overlap in the list -
- Get link
- X
- Other Apps
i need write function given list of words returns true if there repeating words there, or false otherwise. this first programming attempt , having problem following: def over(list1): in list1: j in list1: if == j: return false return true i expecting, if run this: over(["alex", "alex"]) it must return true since overlap. if run: over(["alex", "david"]) then must return false since not overlap. please give me advice on how solve this. if need count occurrences of list elements using counter collection module solution(in python 3.2): from collections import counter def occurdict(items): dict_ans = dict(counter(items).most_common()) return dict_ans list=['car', 'bus', 'truck', 'train', 'truck', 'train', 'bus', 'bus', 'train'] print(occurdict(list)) output: {'truck': 2, ...
c# - Set cursor position to next texbox in a series -
- Get link
- X
- Other Apps
visual studio 2015, c#, in app gets information series of textboxes event-handler on each textbox, how keep cursor going first textbox after each textbox entry? in other words, if customer likes use keyboard tab through data entry fields while entering data on web page on-screen information being updated event handlers on each textbox, how cursor come next textbox or other control after 1 entered? currently, if make entry in 2nd textbox in series, upon autopostback, cursor goes first textbox. user must tab 2 times third textbox. after entering data there, user must tab 3 times fourth textbox. how can cursor move next input box without user having tab or use mouse? (my search "set cursor position" show results graphics applications.) the straightforward way ask set focus subsequent control in textchanged event each textbox. thus void textbox1_ontextchanged(eventargs e) { textbox2.focus(); } void textbox2_ontextchanged(eventargs e) { textb...
PHP - Is it possible to transform XML file to XSL file using xslt transformation -
- Get link
- X
- Other Apps
i trying generate xsl file based on xml config file using xsl transformation. here input. <front> <sample1/> <sample2/> <sample3> <item1/> <item2/> <item3/> <item4/> </sample3> <sample4/> </front> i expecting xsl file like, <xsl:template match="//div[@class='front']"> <xsl:apply-templates select=".//*[@class='sample1']"/> <xsl:apply-templates select=".//*[@class='sample2']"/> <xsl:apply-templates select=".//*[@class='sample3']"/> <xsl:apply-templates select=".//*[@class='sample4']"/> </xsl:template> <xsl:template match="//*[@class='sample3']"> <xsl:apply-templates select=".//*[@class='item1']"/> <xsl:apply-templates select=".//*[@class='item2']"/> ...
java - How to define complex list for application yml in spring boot? -
- Get link
- X
- Other Apps
suppose have application.yml defined: spring: profiles.active: development --- spring: profiles: development logging: level: org.springframework.web: debug org.hibernate: error storage: remotestorage: name: "server 1" user: "test" passwd: "test" host: "163.218.233.106" localstorage: name: "server 2" user: "test2" passwd: "test2" host: "10.10.0.133" --- the storage custom properties want load this: @value("${storage}") private list<storage> availablestorage = new arraylist<>(); apologies beginner spring framework. trying have restcontroller read respective config based on parameters provided requests, i.e. requests ?storage=remotestorage use remotestorage config. @value annotation not load list or map type of properties. have define class @configurationpropertie...
javascript - Can't catch Cmd-S on Chrome on Mac -
- Get link
- X
- Other Apps
i'm trying catch both ctrl-s , cmd-s on browsers cross-os compatibility of web app. saw thread how here: jquery keypress event cmd+s , ctrl+s i have following snippet in code: $(document).keypress(function(event) { if (event.which == 115 && (event.ctrlkey||event.metakey)|| (event.which == 19)) { event.preventdefault(); save(); return false; } return true; }); where save() javascript function send ajax request in future, has alert('saved!'); now. however, although catches ctrl-s, doesn't catch cmd-s on chrome, instead opening save webpage dialog usual. saw else on page had same problem, didn't see solution it. thanks in advance! i think keypress have doesn't register metakeys in quite same way, see: diffrence between keyup keydown keypress , input events here's fiddle seems work using keydown, , capturing each in sequence. hope helps? var metaflag = false; $(document).on({ keydown: function(event)...
asp.net mvc - Office 365 API with my server -
- Get link
- X
- Other Apps
can use office 365 api open file server , edit using office online , save server? possible office 365 api? if yes, way in asp.net mvc? no. office 365 api used access customer's office 365 data( mails, calendars, contacts, users , groups, files etc.). to integrate office online, may consider use wopi .
object - How to call a C++ class Constructor from another Constructor -
- Get link
- X
- Other Apps
this question has answer here: can call constructor constructor (do constructor chaining) in c++? 15 answers i'm trying create object in c++ requires multiple object constructors. foo() , foo(int) foo(int) calls foo() . simplified code written below: #include <iostream> class foo{ private: int ix; public: void printx(string slabel){ cout << slabel << " : " << " foo::ix = " << foo::ix << endl; }; void setx(int ix){ foo::ix = ix; foo::printx("setx(void) method"); }; foo(){ foo::ix = 1; foo::printx("foo(void) constructor"); }; foo(int ix){ foo::setx(ix); foo::printx("foo(int) constructor"); foo::foo(); ...
android - How to decrease black colour for ColorMatrix -
- Get link
- X
- Other Apps
i have used code snippet,how can reduce black color on here. colormatrix colormatrix = new colormatrix(); colormatrix.setsaturation(0); float brightness = (float)(bar.getprogress());//it can 0-128 float m = 205f; float t = -255*brightness; colormatrix threshold = new colormatrix(new float[] { m, 1, 0, 1, t, 0, m, 1, 1, t, 1, 0, m, 1, t, 0, 1, 0, 1, 0 }); after above implementation image become black.
ios - Swift - Expand tableview without Storyboard segue -
- Get link
- X
- Other Apps
i trying create similar tableview 1 below: https://github.com/justinmfischer/swiftyexpandingcells i have complete tableview contents, including filtering system. current problem want implement same functionality expand cells , show detailed information, without using storyboard . the sample code (link) uses storyboard segue, want rid of can same thing through code. removed label background. want title , new controller first clicking tableview cell. detailviewcontroller class detailvc: uiviewcontroller { var brand: brand? override func viewdidload() { super.viewdidload() self.setup() } func setup() { self.view.frame.origin.y = uiapplication.sharedapplication().statusbarframe.size.height if let brand = self.brand { self.title = brand.name } } } this part needs change override func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { self.selectedcellframe = tableview.convertrect(tableview.cellforrowati...
visual studio - Git stuck at deltafying objects -
- Get link
- X
- Other Apps
my source code ( pictures ) size ~500mb. but can't push git repository : git push attempt stucked @ "deltafying objects" in vs. watched network in: ~3kb/s. out: 100kb/s. still not pushing. here screenshot visual studio: i tried in visual studio, push visual studio team services (with git) didn't work. tried sourcetree(v1.9.6.1) checking bitbucket. didn't work. tried git console, didn't work. my visual studio enterprise 2015 has "git-2.9.3.2-64bit" git version installed on machine. update: more information: tried on source-tree again, here console output; git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream leanstartup master:master post git-receive-pack (163209032 bytes) fatal: remote end hung unexpectedly fatal: remote end hung unexpectedly error: rpc failed; curl 56 ssl read: error:00000000:lib(0):func(0):reason(0), errno 10054 pushing https://*****@bitbucket.org/*****/leanstartup.git ...
CSS rules overriding with :not -
- Get link
- X
- Other Apps
i have question css. actually, have html , css this: .entry-content ul:not(.bxslider) > li { list-style-type: disc; } .... .woocommerce ul.products li { list-style: none; } <body class="woocommerce"> <div class="entry-content"> <ul class="product"> <li>something</li> </ul> </div> </body> first, thought first rule override second rule after doing test, browser still applies first one. i know why because don't understand. there typo error in .woocommerce ul.products instead of products use product and here working demo link
angularjs - Export (Print ,pdf ,excel ,copy) the selected columns in Angular Data Table -
- Get link
- X
- Other Apps
this code export columns, exportoptions: { columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,... ] } i ve more 20 columns , user can select 5 columns in front end( via colvis plugin). if user select 5 columns columns should exported.how can this? if using colvis can columns visible exportoptions: { columns: ':visible' } this jquery table , use columns visible in browser. if want use same model colvis uses have bit more fansy/hacky. how did in relation using responsive plugin: exportoptions: { columns: exportcolumns } function exportcolumns(i, values, header){ var colvis = $(header).closest(".datatable").datatable().columns().visible(); if(colvis[i]){ return values; } }
Setting up Azure virtual machines with the same public virtual IP -
- Get link
- X
- Other Apps
what happens if 2 azure vms have same public virtual ip (vip) address (but unique internal ip address)? in, imply? i'm referring provisioning machines classic portal (manage.windowsazure.com). tantamount being in same "network security group" (in arm parlance)? i'm newbie virtualization , networking, , wanted clarify basic concept. in layman's terms, objective have arrangement db vms not exposed public, part of same lan. i.e. max security, least latency. what happens if 2 azure vms have same public virtual ip (vip) address (but unique internal ip address)? in, imply? if want let 2 vms share 1 public ip address, need put them same cloud services. share same public vip , use different ports on public ip. here screenshot of lab: is tantamount being in same "network security group" (in arm parlance)? arm changes network architecture, shared 1 public vip, need create load balancer , assign public vip load balancer. here ar...
php - Wordpress - Sub Menu Item's not showing -
- Get link
- X
- Other Apps
i have added sub menu items main menu navigation , not showing @ all? i have checked css , , not see code hide sub menu. ul.art-hmenu { display: inline-block; vertical-align: middle; padding-left: 13px; padding-right: 13px; } ul.art-hmenu, ul.art-hmenu ul { min-height: 0; } ul.art-hmenu, ul.art-hmenu ul { display: block; margin: 0; padding: 0; border: 0; list-style-type: none; } table, ul.art-hmenu { font-size: 12px; font-family: verdana, geneva, arial, helvetica, sans-serif; font-weight: normal; font-style: normal; } .art-hmenu { float: right; } <ul class="art-hmenu menu-2"> <li class="menu-item-12 active"><a title="home" href="http://agl.run-time.co.za/" class="active">home</a> </li> <li class="menu-item-14"><a title="find us" href="http://agl.run-time.co.za/find-us/...
java - Getting error "Package org.eclipse.... does not exist" in Intellij -
- Get link
- X
- Other Apps
i cloned git repository , opened project in intellij. project has maven build, , intellij has eclipse integration enabled. however, seems intellij not able import of eclipse-specific packages. below screenshot of problem: is happening because intellij not support emf (eclipse modeling framework)? there can done it? thank you! import project idea maven project, once project loaded, configure maven settings in idea (point maven installation,check whether picked correct local repository path , setting xml), if auto import disabled , idea prompt re-import project changes, click re-import changes. wait until dependencies downloaded local repo.
java - How to check errors before form submission via ajax in liferay -
- Get link
- X
- Other Apps
i created form age field name , checking whether number or not.but form submitted showing ajax response , after showing error. don't want form submitted when there error in form field named 'age' .so how prevent that. code follows:- <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> <%@ taglib uri="http://liferay.com/tld/theme" prefix="theme" %> <%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %> <theme:defineobjects/> <portlet:defineobjects /> <portlet:resourceurl var="resourceurl"/> <script type="text/javascript"> function callserveresource(){ aui().use('aui-io-request', function(a){ a.io.request('<%=resourceurl.tostring()%>', { method: 'post', form: { id: 'fm' }, on: { succe...
c# - Xml Type ... is not declared, or is not a simple type -
- Get link
- X
- Other Apps
i'm getting xml schema xero : https://github.com/xeroapi/xeroapi-schemas var assembly = assembly.getexecutingassembly(); var stream = assembly.getmanifestresourcestream("xeroconnector.xmlschemas." + selectedendpoint.schema + ".xsd"); using (var reader = xmlreader.create(stream)) { schema = xmlschema.read(reader, null); } schemaset.add(schema); the schema embedded resource in project. when tried schemaset.add(schema); "type 'entityvalidationstatus' not declared, or not simple type". below schema : <?xml version="1.0" encoding="utf-8"?> <xs:schema id="items" elementformdefault="qualified" xmlns:xs="http://www.w3.org/2001/xmlschema" > <xs:include schemalocation="basetypes.xsd" /> <xs:element name="items" nillable="true" type="arrayofitem" ...
java - Need to set java8 in codenameone project with IDE Myeclipse 2015 -
- Get link
- X
- Other Apps
i need set java 1.8 in codenameone project ide myeclipse2015. i have follow guidlines " https://www.codenameone.com/blog/java-8-support.html " , set project build path java1.8 , compiler java 1.8 , build.xml javac source , target 1.8. also set build hint java.version=8 codenameone version using 3.5 , refreshed cn1libs also. [javac] javac: invalid target release: 1.8 [javac] usage: javac <options> <source files> still getting error while send ios app store build. please suggest. that means eclipse running under older version of java. need update eclipse.ini file use java 8 running eclipse itself. make sure using latest version of codename 1 plugin.
core data - managedObjectContext in Swift 3 -
- Get link
- X
- Other Apps
i want work through this example code in swift , coredata used create table. however, using swift 3 fail work. importantly, cannot replace line // set nsmanagedobjectcontext let appdelegate = nsapplication.sharedapplication().delegate as! appdelegate managedcontext = appdelegate.managedobjectcontext even though found this related question (which ios not os x). how can replace piece of code produces error message value of type 'appdelegate' has no member 'managedcontext' ? swift 3 in macos let appdelegate = nsapplication.shared().delegate as! appdelegate let managedcontext = appdelegate.managedobjectcontext the error provided says 'appdelegate' has no member 'managedcontext' instead of 'appdelegate' has no member 'managedobjectcontext' , lead me assume need fix syntax. swift 3 in ios 10 core data needs @ least 3 things work: a managed object model a persistent store coordinator and managed obje...
java - Transferring intent/ data/ bundle between parent/otherwise activity and fragment -
- Get link
- X
- Other Apps
i have 3 classes here: ijob, tabbed_activity , placeholderfragment. want pass strings created in ijob class placeholderfragment oncreateview show them custom page. yet create second , third fragment. ijob list of jobs. tabbed_activity manager class of fragments. placeholderfragment 1 of fragments. can see, have tried bundle, intent , getactivity.. none of them seems work. have tried getting data ijob tabbed_activity first, placeholderfragment. please help. ijob.java package com.example.administrator.signin; import android.app.listactivity; import android.app.progressdialog; import android.content.intent; import android.os.asynctask; import android.os.bundle; import android.provider.settings; import android.support.v4.app.fragment; import android.util.log; import android.view.view; import android.widget.adapterview; import android.widget.adapterview.onitemclicklistener; import android.widget.listadapter; import android.widget.listview; import android.widget.simpleadapter; impo...
Extended sheet selection in Excel 2013 - VBA -
- Get link
- X
- Other Apps
could please understand why code works in older versions of excel not in excel 2013? line replace:=false ignored. related central settings? should modified? sub test() dim dim n n = inputbox("type n") = 1 n if = 1 thisworkbook.sheets(i).select if > 1 thisworkbook.sheets(i).select replace:=false next end sub i tried code in excel 2013. possible reasons thisworkbook not active workbook or sheets invisible. should use select function on active workbook. see below code updated - used in workbook hidden sheets , worked. @ immediate window in vba editor (ctrl+g) see debug messages. note hidden sheets count variable 'n'. hope helps. sub test() dim dim n dim foundfirstvissheet boolean foundfirstvissheet = false n = inputbox("type n") dim mysh worksheet = 1 n set mysh = activeworkbook.sheets(i) if mysh.visible = xlsheetvisible if not foundfirstvisshe...
sql server - Error 'String or binary data would be truncated' in Microsoft SQL -
- Get link
- X
- Other Apps
i got error when inserting data microsoft sql. error: ('22001', '[22001] [microsoft][odbc driver 13 sql server][sql server]string or binary data truncated. (8152) (sqlparamdata); [01000] [microsoft][odbc driver 13 sql server][sql server]the statement has been terminated. (3621)') fyi, use python 2.7 , pyodbc library. what error about? should solve it? based on link: http://www.sql-server-performance.com/2007/string-or-binary-data-truncated/ this error message appears when try insert string more characters column can maximal accommodate.
c++ - Directly write into char* buffer of std::string -
- Get link
- X
- Other Apps
so have std::string , have function takes char* , writes it. since std::string::c_str() , std::string::data() return const char* , can't use them. allocating temporary buffer, calling function , copying std::string . now plan work big amount of information , copying buffer have noticeable impact , want avoid it. some people suggested use &str.front() or &str[0] invoke undefined behavior? c++98/03 impossible. string can copy on write needs handle reads , writes. c++11/14 in [string.require]: the char-like objects in basic_string object shall stored contiguously. is, basic_string object s , identity &*(s.begin() + n) == &*s.begin() + n shall hold values of n such 0 <= n < s.size() . so &str.front() , &str[0] should work. c++17 str.data() , &str.front() , &str[0] work. here says: chart* data() noexcept; returns: pointer p such p + == &operator[](i) each i in [0, size()] . ...
c# - Asynchronous download algorithm with progress value -
- Get link
- X
- Other Apps
i made simple algorithm winrt app. having stream of class webresponse. need download file asynchronously "progresschanged" event. here method: public async void downloadfileasync(string uri, storagefile path) { var request = webrequest.createhttp(uri); var response = await request.getresponseasync(); if (response != null) { long totalbytes = response.contentlength; long writedbytes = 0; using(var webstream = response.getresponsestream()) using (irandomaccessstream stream = await path.openasync(fileaccessmode.readwrite)) using (datawriter datawriter = new datawriter(stream)) { await task.run(() => { int b; while ((b = webstream.readbyte()) != -1) { datawriter.writebyte((byte)b); writedbytes++; if (writedb...
javascript - Moving circle in html website -
- Get link
- X
- Other Apps
this question has answer here: create animation circles time dependent 1 answer i want create moving circles in photo: is javascript or smth else ? see canvas in html. thanks. there different solutions this. can take @ d3js . it's javascript framework create svgs (including animation). there greate functions manipulte circles ( like this )
jQuery append function giving syntax error in console.log -
- Get link
- X
- Other Apps
$(".trade-button").append('<div> <button tabindex="2" class="btn google-analytics-make-trade-click-trade-page"<span id="tradetotal"></span> </button></div>'); i'am trying append html, it's giving syntax error. the problem wrote appending string in multiple lines. can't this, not valid javascript. can write in 1 line, or escape correctly. $(".trade-button").append('<div><button tabindex="2" class="btn google-analytics-make-trade-click-trade-page">trade total of $0<span id="tradetotal"></span></button></div>'); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="trade-button"></div> or: $(".trade-button").append('<div>' + '<bu...
c++ - Is boost regex slower than this combination of isupper and isdigit? -
- Get link
- X
- Other Apps
i need check whether string consists of special set of characters ( abcdefghijklmnopqrstuvwxyz0123456789< ). i either use boost regex or combination of isupper , isdigit . 1 considered better choice when comes performance? string lenghts testing around 100 characters. bool isvalid(string& rstring) { boost::regex regex("[0123456789abcdefghijklmnopqrstuvwxyz<]+"); boost::cmatch match; return boost::regex_match(rstring.c_str(), match, regex); } bool isvalid(string& rstring) { (string::size_type = 0; < rstring.size(); ++i) if (!isupper(rstring[i])) if (!isdigit(rstring[i])) if (rstring[i] != '<') return false; return true; } is yyy slower yyy ? answer: time it in case (swapping boost::regex std::regex): #include <vector> #include <iostream> #include <iomanip> #include <regex> bool isvalid1(std::string cons...
android EditText password in Arabic locale issue (in samsung devices only) -
- Get link
- X
- Other Apps
i hava password edittext in arabic default locale. when write special characters "!@#$%^&*()na" in password edittext , send server ,it reach "!@#$%^&*)(na" this happed in password edittext in arabic locale in samsung devices only.. tested issue in sony, lg , huawei devices , issue didn't exist anyone can me in issue !?
Validate elements of a String array with Java Bean Validation -
- Get link
- X
- Other Apps
i have simple class has 1 of properties string array. per this document, using @valid on array, collection etc. recursively validate each element of array/collection. @valid @pattern(regexp="^[_ a-za-z0-9]+$") public string[] defaultappadminroles; the above annotation on property generates following exception: exception in thread "main" javax.validation.unexpectedtypeexception: no validator found type java.lang.string[]. see: @pattern @ public java.lang.string[] com.hm.vigil.platform.ops.model.application.defaultappadminroles @ org.apache.bval.jsr303.annotationprocessor.checkonetype(annotationprocessor.java:326) @ org.apache.bval.jsr303.annotationprocessor.getconstraintvalidator(annotationprocessor.java:301) @ org.apache.bval.jsr303.annotationprocessor.applyconstraint(annotationprocessor.java:241) @ org.apache.bval.jsr303.annotationprocessor.processannotation(annotationprocessor.java:149) @ org.apache.bval.jsr303.annotationprocessor.processannotations(ann...