Posts

Showing posts from September, 2010

javascript - How can I make payments flow directly through my website, which acts as a proxy, to the actual seller? -

i have started creating website allows users search through various digital products , buy them. going according plan, i've hit problem far payment concerned. the idea is, if user buys on website, appears them have bought us, appears seller has been bought website. ultimately, means site acts proxy transaction, transaction between buyer , seller, , no money should ever in own possession. however, i'm unsure of how this. the simplest way this, using paypal, since user click 'buy paypal, , redirected usual paypal screen sellers website redirect to. the issue not sellers use paypay - accept card payment. i'm guessing 2 options in case be somehow copy card payment form inputs sellers website mine, details being (indirectly) typed sellers website. create own secure payment form details given , (securely) passed on seller of resource. may reiterate seller should not able tell sale has come through website, , buyer should given illusion nthat buying resource w...

algorithm - Find Rank of element in unsorted array in complexity:O(lg n).Any other better approach than this? -

given numbers in unsorted way x:{4,2,5,1,8,2,7} how find rank of number?? eg: rank of 4:4 : rank of 5:5 complexity has o(lg n). it can done in complexity of o(lg n) of red black trees , augmented data structure approach(one of fascinating stuff nowadays). lets make use of order statistic tree order statistic tree algorithm: rank(t,x) //t: order-statistic tree, x: node(to find rank of node) r = x.left.size + 1 y=x while y != t.root if y==y.p.right r= + y.p.left.size + 1 y=y.p return r; any appreciated. are there better approach this?? given numbers in unsorted way, x:{4,2,5,1,8,2,7} how find rank of number? rank position of element when sorted. complexity has o(lg n). that's impossible. have @ each element @ least once. thus, can't better o(n) , , it's trivial in o(n): set found false set smaller 0 for each number in array if number smaller needle increment smaller counter if number equal need...

openerp - RML Test of Page Number -

moin moin, i'm working on openerp 7 , there pdf's created rml. problem is: need page numbers, starting of second page. tried rml if clause statements, page 1 gets printed time , things printet pretty wierd. <header> <pagetemplate id="second"> <frame id="second" x1="2.2cm" y1="2.5cm" width="16.9cm" height="22.3cm"/> <pagegraphics> <image file="images/isatech_water_header_medium.jpg" x="0.0cm" y="24.4cm" width="19.0cm" height="6.0cm"/> <image file="images/isatech_water_footer.jpg" x="0.0cm" y="-0.5cm" width="16.9cm" height="2.6cm"/> </pagegraphics> </pagetemplate> <pagetemplate id="first"> <frame id="first" x1="2.2cm" y1="2.5cm" width="16.9cm...

coldfusion - How do I show multiple tabs using the "read" function for CFSPREADSHEET? -

i show multiple tabs, i.e. multiple sheets, xls file in browser using coldfusion. have logic pretty worked out, i'm not sure if there way it. logic follows: <cfspreadsheet action="read" format="html" src="test.xls" name="spreadsheet" <cfloop index="i" from="1" to="5"> <!--- or many tabs there ---> sheet="#i#" </cfloop> > <table> <cfoutput> #spreadsheet# </cfoutput> </table> now know code doesn't work, looking similar solution. thank in advance. try putting cfloop around cfspreadsheet <cfloop from="1" to="5" index="i"> <cfspreadsheet action="read" format="html" src="test.xlsx" sheet="#i#" name="spreadsheet"> <cfdump var="#spreadsheet#"><br> </cfloop>

c# - Why does this Regular Expression match nothing? -

i want replace instances of consecutive non-lowercase-alphabet-letters single space each instance. works, why inject spaces in between alphabet letters? const string pattern = @"[^a-z]*"; const string replacement = @" "; var reg = new regex(pattern); string = "the --fat- cat"; string b = reg.replace(a, replacement); // b = " t h e f t c t " should "the fat cat" because of * (which repeats previous token zero or more times). must finds match in boundaries since empty string exists in boundaries. const string pattern = @"[^a-z]+";

c# - Using xUnit test with UWP app on VS2015 -

this follow-up this question . followed steps described here , sample tests work expected. first time got working sample, wait real working setup having trouble. as next step testing app, added uwp app project using "add reference..." xunit test project. now, after referencing project, when run test (run in test explorer pane vs2015) following error: error payload contains 2 or more files same destination path 'assets\splashscreen.scale-200.png'. source files: ...\projects\sample\sampleunittest\assets\splashscreen.scale-200.png ...\projects\sample\sample\assets\splashscreen.scale-200.png sampleunittest there 2 more errors, above, referring square150x150logo.scale-200.png , square44x44logo.targetsize-24_altform-unplated.png image files. i can understand these errors mean; app being tested , test project both generate visual resources (splash-screen image, logo, taskbar icon, etc.) destined same output these required register app(s) , run (on local m...

android - Crash after isCurrentInputMethodAsSamsungKeyboard on a Samsung tablet -

i'm seeing few crashes samsung galaxy tab s tablet. have stacktrace, doesn't much: fatal exception: java.lang.securityexception: package info: neither user 1110217 nor current process has android.permission.interact_across_users. @ android.os.parcel.readexception(parcel.java:1540) @ android.os.parcel.readexception(parcel.java:1493) @ com.android.internal.view.iinputmethodmanager$stub$proxy.iscurrentinputmethodassamsungkeyboard(iinputmethodmanager.java:1289) @ android.view.inputmethod.inputmethodmanager.iscurrentinputmethodassamsungkeyboard(inputmethodmanager.java:2526) @ android.widget.editor$suggestionspopupwindow.updatesuggestions(editor.java:3004) @ android.widget.editor$suggestionspopupwindow.show(editor.java:2873) @ android.widget.editor.showsuggestions(editor.java:1995) @ android.widget.editor$1.run(editor.java:1830) @ android.os.handler.handlecallback(handler.java:739) ...

c++ - Please explain why there is an S at the beginning of a filepath? -

why there 's' @ beginning of filepath in example on msdn ? know can use '@' 's' do? bitmap(s"d:\\documents , settings\\joe\\pics\\mypic.bmp"); it's sample c++/cli , not c# . , s"" in c++/cli means managed string literal. check http://msdn.microsoft.com/en-us/library/ms235263.aspx

android - Getting Updates from Parse.com -

i trying top use parse.com app need information in phone update when changes in server. there way continuous checks or server let phone know when change has been done in server? checked documentation couldn't find anything thanks ifaik, can implement using scheduledexecutorservice . by using scheduledexecutorservice, can update server every x second(s). here example, scheduledexecutorservice scheduletaskexecutor = executors.newscheduledthreadpool(5); scheduletaskexecutor.scheduleatfixedrate(new runnable() { public void run() { //codes check update server } }, 0, 1, timeunit.minutes); this check update server every 1 minute. to stop checking update, scheduletaskexecutor.shutdown(); hope helps :)

powershell - variable expansion inside namespace-qualified variable name -

problem i want perform parametric variable evaluation. to-be-evaluated variable name constructed string concatenation - namespace part , name part being defined in variable. example: env:$var , value of $var is, instance "os" . however, while using expression ${env:os} gives expected value windows_nt , construct $var="os" ${env:$var} is null-valued expression. motivation i'm not intereseted in value of environment variables (but simplest example, find). want, refer content of file via ${c:<filename>} construct. want perform several, conditional in-file string substitutions and, i'd use construct similar this: <identify files in foreach> ${c:<filename>} -replace 'this', 'that' > ${c:<new filename>} to achieve this, need <filename> value of iterator variable. question if value of $var os , shall @ ... , if expect value of following expression windows_nt ? ${env:...var...} ...

ios - How to pinch to zoom a view without making the view bigger? -

this have: func handlepinching(recognizer : uipinchgesturerecognizer) { self.layer.transform = catransform3dmakeaffinetransform(cgaffinetransformscale(self.transform, recognizer.scale, recognizer.scale)); recognizer.scale = 1.0; } using self.view.transform makes bigger. want make zoom "internally" (i don't know how explain it). so i'm not 100% sure understand question guess it. for example want zoom on image without zooming other element of ui (navbar, buttons, ...) right? so guess in you're example you're in viewcontroller, means, when change scale of self.view you'll zoom everything. have apply scale on specific view want zoom in. in example below, zoom on image, image inside of uiimageview, , imageview subview of self.view . , apply transform on imageview. moreover think little bit confused on how zoom, considering view want zoom imageview need imageview.transform = cgaffinetransformmakescale(recognizer.scale,recogn...

c# - Force Automapper to use ConstructUsing even if nested entity is already created -

please suppose domain public class customer : entity { public int id { get; set; } public string name { get; set; } public image photo { get; set;} public int photoid { get; set; } } public class image : entity { public int id { get; set; } public byte[] content { get; set; } } now suppose models public class customermodel : entitymodel { public int id { get; set; } public string name { get; set; } public imagemodel photo { get; set;} public int photoid { get; set; } } public class imagemodel : entitymodel { public int id { get; set; } public byte[] content { get; set; } } suppose have customer on database, attached dbcontext: customer = { id : 1, name : "alexandre", photoid: 13, photo : { id: 13, content: abc } } and model (posted user browser): customermodel = { id : 1, name : "alexandre", photoid: 0, photo : { id: 0, content: x...

c# - RestSharp version of a cURL PUT request (text/plain) -

a rest api has method upload contents of .csv file (as plain text) using following curl request: https://api_baseurl/v3/data/contactslist/$listid/csvdata/text:plain \ -h "content-type: text/plain" \ --data-binary "@./test.csv" where $listid replaced number @ time of request , test.csv , assume, replaced content of file. api_baseurl base url of api privacy reasons have removed here. i trying convert request restsharp use in program. put request. using following code make request. var request = new restrequest(string.format("https://api_baseurl/v3/data/contactslist/{0}/csvdata/text:plain", contactlistid), method.put); request.addparameter("content-type", "text/plain", parametertype.httpheader); request.addbody(filecontent); irestresponse response = _client.execute(request); when run query, suspect api still thinks running request of xml content type , therefore receive following response: data content type "t...

Uncrustify ignore formatting new line at long objective c method decleration -

i want uncrustify ignore new lines formatted developer config file not this. what code looks , want unchanged + (void)dosometingawesomewithindex:(nsinteger)index howmanydayslater:(bool)howmanydayslater mybroes:(nsmutablearray *)broes completion:(awesomeblock)completionblock what uncrustify when formats + (void)dosometingawesomewithindex:(nsinteger)index howmanydayslater:(bool)howmanydayslater mybroes:(nsmutablearray *)broes completion:(awesomeblock)completionblock i using uncrustify 0.61 , config file http://www.megafileupload.com/edbm/uncrustify.cfg i suggest https://github.com/square/spacecommander . possible duplicate of can uncrustify align colons in objective-c method calls?

html - Sublime Text 3 [ctrl+comma] on Mac -

on windows machine, pressing [crtl+comma] when in html or css tag selects entire tag , it's contents. not sure key binding command called , not find in default windows sublime-keymap file. how can on mac? know there expand selection tag key binding [ctrl+shift+a] (windows)/ [cmd+shift+a] (mac), it's not same behavior , doesn't work on css. the ctrl+, functionality describe on windows called match tag pair outward , , provided a plugin called emmet . on mac, default keyboard shortcut same command ⌃d .

java - SLF4J - how does it know which log type to use -

Image
slf4j wrapper/facade class can use many different log types, such logback, log4j , etc. let's want use both logback , log4j , third java.util.logging. when write log this: public class helloworld { public static void main(string[] args) { logger logger = loggerfactory.getlogger(helloworld.class); logger.info("hello world"); } } how know logging framework using ? let's want use logback call, how know not using framework ? as understood, slf4j interface , needs implementation. basically, slf4j call : classloader.getsystemresources("org/slf4j/impl/staticloggerbinder.class"); it means classpath must contain such class qualified name. every logging framework compatible slf4j defines such class. if dig code of logback , find class named org.slf4j.impl.staticloggerbinder redirects logback's implementation if dig code of log4j, there not such class there binding framework between log4j , slf4j called slf4j-log4j d...

Android layout renders wrong on Marshmallow -

Image
i have noticed android app layout broken when displayed on marshmallow. fine on nexus 5 android 5.1.1 renders wrong on nexus 5 , nexus 5x latest version of android. the layout consist of little triangle (see red part) aligned bottom , above there view (white) should span available height of parent (grey part). and how renders on android 5.1.1 (nexus 5): while on android 6.0 (nexus 5 , nexus 5x) is: the problem looks red view doesn't respect parent alignment (bottom, right) , makes white view (which placed above) disappear. the simplified layout of grey view , children (i have added background colours see view bounds): <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:background...

java - data transaction synchronization in multiple server -

currently have java application running in multiple servers. have data transaction encountering deadlock. tried using thread , synchronization, in vain, there multiple application instances in multiple servers. each application instance have data transaction synchronized, different synchronized application transactions on same database happens land database in deadlock situation, application instances database same , one. kindly suggest right approach in kind of situation. high level solution suffice.

JAVA how to store mysql login details -

environment i have java application going need access mysql database load , save data , load/save cannot occur writing disk, has through database. i reading jndi i'm not sure because every example i've seen has been java servlet , goal use in java standalone application. questions what best way store mysql username , password clients can access database still protecting login information program not decompiled , uses mysql login drop tables? what guys recommend? i'd secure possible , i'm open suggestions. only handful of statements executed on database , hard coded strings used in prepared statements think secure or no? but main issue protecting database login information. you have several options: use credentials minimum possible permissions. means user able insert not drop or delete separate program , code writes database creating webservice (or other remoting techniques) use procedures , functions contact database , grant them us...

php - get user info via google api client -

i'm recieving token-id android client. in first step i'm validating token via following code: $tokenid = $request->get('token-id'); $google_client = new google_client(); $google_client->setapplicationname("ashojash"); $google_client->setclientid(env("google_key")); $google_client->setclientsecret(env("google_secret")); $google_client->setincludegrantedscopes(true); $google_client->addscope(['https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/plus.login']); $credentials = $google_client->verifyidtoken($tokenid); if ($credentials) { $data = $credentials->getattributes(); // validate aud against server client_id return $data['payload...

networking - C# - How to identify packet loss between server and client -

we develop desktop tool checking packet loss between server , client. tool running on client machine. client has port 4172 tcp , udp open , can communicate on port. possible identify data transfer in both direction? there .net api this? i have checked tools pcap.net , winpcap .net has ping classes make pretty easy. guy has sample code should started: http://forum.codecall.net/topic/37643-c-packet-lossping-program/

python - Plotting GroupBy Object in Pandas -

i have dataframe various parameters (continuous time-series data) , other columns filter out various conditions; these made of 1 when condition true , nan when condition false. if plot parameter , plot again in gate, can do: df.parameter.plot() df.groupby('filter_column').parameter.plot(style='bo') this example works fine, if want plot using line ( style='b-' example) joins groups of filtered data line a work-around create intermediate series, or multiply 2 columns within matplotlib call: series = df.parameter * df.filter_column series.plot(style='b-') plt.plot(df.parameter * df.filter_column,'b-') i'm not fan of type of plot statement or creating intermediate columns. useful have direct groupby line plot deal nas in same way series. does have more elegant workarounds this?

python - Django: how to use two different databases with Wagtail CMS -

inside django project, have 1 app, otherapp, hits postgres database on remote server contains scraped data. have second app, content, hits different postgres database on same remote server, , contains pages i'd have served through wagtail cms. i installed wagtail locally using these instructions (i did not use wagtail installer). got working locally. then, did pg_dump of local database , did psql db2 < db2dumpfile.sql on remote database server. each of apps works fine locally in isolation, can't them work together. thought use database router specify database want used retrieve different types of data. but, when put database router settings file, starts fail. how can fix this? need declare wagtailcore somewhere else in project? settings.py: databases = { 'default': { 'engine': 'django.db.backends.postgresql_psycopg2', 'name': 'db1', 'user': db_username, 'password': d...

javascript - Android mobile menu behavior -

we seem running issue in regard android devices when comes opening action of our menu navigation ashoka theme in wordpress. the issue described; the menu on android seems work after fails 1 time deliver desired behaviour. after works intended. ofcourse love of god, have no idea why have fail work. it working without issues on both desktop (ie / ff / chrome / opera / safari) / ios devices. it comes in 2 situations; 1 - if click site logo, arrow below seems closing action (which should not because not opened yet) 2 - second issue (also on android) if click arrow below logo (before clicked logo , failed) seems redirect random page. what using wordpress (4.4.1) wordpress theme ashoka for quick reference i have attached both custom.js if can test , give feedback further solve offcourse more awesome. if need additional information please feel free let know! in advance, thoughts , replies, appreciated. kind regards, patrick custom js: http://inhoudgemert.pa...

Java multi-dimension array -

i have 2 dimension array of username , surname , able print both name , surname.but want below , looking help. 1) match name string , output name , surname both tried if loop did not fails print surname. if string name give abc should match array , print both values of name , surname. string[][] names = {{"abc","def"},{"ghi","jkl"}}; string name = "abc"; (int = 0; < names.length; i++) { system.out.print(names[i][0] + ": "); (int j = 1; j < names[i].length; j++) { system.out.print(names[i][j] + " "); } system.out.println(); } try this: for (string[] fullname : names) { if (fullname[0].equals(name)) { (string s : fullname) { system.out.print(s + " "); } system.out.println(); } } if not know these for-loops: iterate on each element in order, i.e. with...

java - Android SimpleDateFormat returning incorrect time between midnight and 1am -

solved have found between midnight , 1am device returns time 1 hour later (the other 23 hours day returns correctly). more weirdly returns correctly if use kk instead of hh (though resulting string no use me) code running: (in instance strformat matches hardcoded string in df3 ) simpledateformat df = new simpledateformat(strformat, locale.us); simpledateformat df2 = new simpledateformat("yyyy-mm-dd kk:mm", locale.us); simpledateformat df3 = new simpledateformat("yyyy-mm-dd hh:mm:ss.sss", locale.us); date d = c.gettime(); string s = d.tostring(); string ret = df.format(c.gettime()); string ret2 = df.format(new date(system.currenttimemillis())); string ret3 = df2.format(c.gettime()); string ret4 = df3.format(c.gettime()); string r1 = ""+c.get(calendar.hour); these return: s = "thu jan 07 00:39:32 gmt-11:00 2016" ret = "2016-01-07 01:39:32" ret2 = "2016-01-07 01:39:32" ret3 = "2016-01-07 24:39" ret4 = ...

jquery - stop data-bind event in click method -

i have checkbox causes validation on textbox , data-bind viewmodel. here fiddle . <input id="checkbox1" type="checkbox" data-bind="checked: viewitems">checkbox</input> i want the checkbox not data-bind when click event returns false value. is there way this? thanks in advance. can not set value of observable in click method? $('#checkbox1').click(function () { if (!$('#textbox1').valid()) { viewitems(false) alert("please enter value"); return; } else { viewitems(true) } });

Microsoft Edge and Sorting with jQuery -

i have following code works fine firefox , chrome, microsoft edge (default settings) list items not sorted — left unordered. i'm using ms edge 20.10240.16384.0. has seen problem , found solution? (id here container of ul) $( id + ' li' ).sort(function ( a, b ) { return parsefloat( $( ).attr( "id" ).replace( 'page', '' ) ) > parsefloat( $( b ).attr( "id" ).replace( 'page', '' ) ); }).appendto( id + ' ul' ); js fiddle example: https://jsfiddle.net/c1d8caa5/2/ this code leverages native array.prototype.sort method, described in section 22.1.3.24 of ecmascript standard. method accepts single comparefn argument: if comparefn not undefined, should function accepts 2 arguments x , y , returns negative value if x < y, zero if x = y, or positive value if x > y. (emphasis added) as such, make sure compare function returns either -1 , 0 , or 1 . additionally, can subtra...

sql - Distinct records by column value -

let's have query output given table: number data info 123 data1 info1 456 data2 info2 789 data3 info3 123 data4 info4 i want same table columns, without records number column gotten(not best phrasing there, sorry) . distinct. it not matter me record number keep in result. so output looking is: number data info 123 data1 info1 456 data2 info2 789 data3 info3 i using oracle sql. thanks in advance! you can change aggregate function max others different values data , info select number, max(data) data, max(info) info table group number first() might make sense you. here oracle docs on aggregate functions: https://docs.oracle.com/database/121/sqlrf/functions003.htm#sqlrf20035

javascript - Floating divs glitch on resize in Chrome and Edge -

Image
does know how fix problem. browser works correctly firefox; in chrome , edge doesn't work. when resize screen box changes position. there solution? screenshot html <div class="box" style="background:#f00; height:200px;"></div> <div class="box" style="background:#f0f; width:25%"></div> <div class="box" style="background:#ff0; width:25%"></div> <div class="box" style="background:#00f; width:25%"></div> <div class="box" style="background:#55f; width:25%"></div> css .box { width: 50%; height: 100px; float: left } javascript $(window).resize(resize) function resize() { $(".box").each(function() { $(this).height( $(this).width() * 0.5) }); } here's codepen link: http://codepen.io/tufik/pen/rxyqmv update--------- i modified codepen show more complex structure. problem when resi...

python - scipy PchipInterpolator implementation problems -

i trying implement pchipinterpolator based on link: http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.interpolate.pchipinterpolator.html the code using is: x = np.arange(0, 10) y = np.exp(-x/3.0) set_interp = scipy.interpolate.pchipinterpolator( x, y, extrapolate=true ) i error as: typeerror: __init__() got unexpected keyword argument 'extrapolate' so, implementing wrong way. have tried numerous other ways implement extrapolate fails. pchipinterpolator refactored in version 0.14, , that's when has grown extrapolate keyword. compare docs version 0.13: http://docs.scipy.org/doc/scipy-0.13.0/reference/generated/scipy.interpolate.pchipinterpolator.html and version 0.14: http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.interpolate.pchipinterpolator.html (disclaimer: involved in refactor) scipy 0.13 quite old now, best consider upgrading. more recent scipy versions better in terms of consistency in interpolate...

extjs - How to optimize adding components to a view? -

first of all, have 1000-1500 records , need show them in grid in custom style. but, first row has contain checkbox , form(combo,textfield), below checkbox. similar to: row1: checkbox combo, textfield, textfield row2: checkbox combo, textfield, textfield ... so, not use grid approach(because have use 'colum render function' each row , causes re-render whole grid again if change 1 row). that's why tried add each component panel dynamically. main problem whenever add components panel, takes long . example, takes 4.5 s 100 records. can't imagine how long take 1500 records. please check fiddle. understand exact problem. please not forget check console.time: https://fiddle.sencha.com/#fiddle/13g0 and sample codes: console.time('fakegrid'); ext.suspendlayouts(); var fakegrid = ext.create('ext.panel.panel', { title: 'fake grid panel', renderto: ext.getbody(), }); var...

Django, Informix, ibm_db and DB2 data server driver -

i'm trying connect ids(v11.50) django(v1.3.1) using ibm db2 data server driver (odbc)(v10.1) , ibm_db ( https://code.google.com/p/ibm-db/ ). simple query 'select distinct adm_audit.action adm_audit' django driver transfers select distinct "adm_audit"."action" "adm_audit" , generate error: [ibm][cli driver][ids/unix64] syntax error has occurred. i tried execute same sql statement in db2cli, , returns same error: >select distinct "adm_audit"."action" "adm_audit" select distinct "adm_audit"."action" "adm_audit" sqlerror: rc = 0 (sql_success) sqlgetdiagrec: sqlstate : 42000 fnativeerror : -201 szerrormsg : [ibm][cli driver][ids/unix64] syntax error has occurred. cberrormsg : 58 if quotes removed, statement completes successfully: > select distinct adm_audit.action adm_audit select distinct adm_au...

Sencha ExtJS integrating with existing asp.net web application -

our existing product in asp.net web form, planning migrate each page sencha extjs 6 asp.net web api, migration stage stage rather in 1 shot. technically need design solution in way support new pages in extjs , still old pages should use asp.net web forms. since stage of learning extjs, dont have expertise in area. we had come few solutions. please advice , guide in right direction. let know if got other better way of design this. solution 1: add extjs app existing web application. cons: implementation messy web forms , extjs together. solution 2: create separate extjs app new pages , existing asp.net webforms call extjs pages few modules, , vice versa extjs call asp.net web forms exisiting page access. pro: no tweaking required in existing asp.net web project, once pages has been migrated can dispose asp.net web project out of way. cons: * maintaining session state between extjs app , asp.net web application. many in advance

c# - How to encrypt decrypt string using MACTripleDES? -

Image
how encrypt , decrypt string using mactripledes in c#? there difference between mactripledes , tripledes? mactripledes uses cbc-mac . cbc-mac uses cbc mode after padding message zeros. specified in withdrawn fips 113 specification (daa). last block kept: this means each , every block of plaintext data before cannot retrieved. is, unless know plaintext of last blocks, in case can xor last block, retrieve previous ciphertext, , calculate plaintext decryption. tripledes in cbc mode on other hand outputs blocks of ciphertext, before using vector next block of plaintext. using system; using system.security.cryptography; namespace stackoverflow { public class mactripledestest { public static void main(string[] args) { // example key byte[] key = new byte[24]; (int = 0; < key.length; i++) { key[i] = (byte) i; } // uses cbc mac 0 initialization vector , 0 p...

mysql - PHP PDO: SQL query not returning expected result -

Image
i have function (see bottom) in php, queries mysql database. when use following values: $map => 1, $limit => 10, $from => 0, $to => current_timestamp with sql statement: select user, scoreval score, unix_timestamp(timestamp) timestamp score timestamp >= :from , timestamp <= :to , map = :map order scoreval desc, timestamp asc limit :limit in phpmyadmin, following result: however php pdo gets returned empty array. my attempts debug far: i have replaced prepared sql query static values instead of placeholders - returns correctly trying each placeholder separately, replacing rest tested hard-coded values - returns nothing instead of passing variables placeholders pass fixed constants in execute(array()) part. - returns nothing. i have furthermore discovered after turning on mysql query logs, php client connects, quits without sending queries. from this, believe problem place holders within function, have been...

json - jquery range slider values compared to outside value -

i using range slider display range of prices, 1000 3000. outside of slider have objects in json file of have different prices. want display objects price falls between values user has chosen. slider: $(function() { $("#slider-range").slider({ range: true, min: 1000, max: 3000, values: [1250, 2000], slide: function(event, ui) { $("#amount").val("$" + ui.values[0] + " - $" + ui.values[1]); } }); $("#amount").val("$" + $("#slider-range").slider("values", 0) + " - $" + $("#slider-range").slider("values", 1)); }); i guess think should this? if ((values = < data.objects[i].price) || (values => data.objects[i].price)) { //.... }

How to handle duplicate node names when converting xml to csv using java and xsl -

i given xml file outside source (so have no control on attribute names) , unfortunately use same name paired set of data. can't seem figure out how access second value. example of data in xml file is: <?xml version="1.0"?> <addressresponse> <results> <ownername>name1</ownername> <houseaddress>house1</houseaddress> <houseaddress>citystate1</houseaddress> <yearbuilt>year1</yearbuilt> </results> <results> <ownername>name2</ownername> <houseaddress>house2</houseaddress> <houseaddress>citystate2</houseaddress> <yearbuilt>year2</yearbuilt> </results> </addressresponse> i have java code , can parse xml need handling duplicate attribute name. want csv file following: owner,address,citystate,yearbuilt name1,house1,citystate1,year1 name2,house2,citystate2,year2 in xsl file, did f...

java - How to add text file in netbeans project -

please how can embed text file in netbeans project , set on jeditorpane using event trigger here link tutorial on how use jeditorpane oracle: https://docs.oracle.com/javase/tutorial/uiswing/components/editorpane.html

scala - unable to view data of hive tables after update in spark -

case: have table hivetest orc table , transaction set true , loaded in spark shell , viewed data var rdd= objhivecontext.sql("select * hivetest") rdd.show() --- able view data now went hive shell or ambari updated table , example hive> update hivetest set name='test' ---done , success hive> select * hivetest -- able view updated data now when can come spark , run cannot view data except column names scala>var rdd1= objhivecontext.sql("select * hivetest") scala> rdd1.show() --this time columns printed , data not coming issue 2: unable update spark sql when run scal>objhivecontext.sql("update hivetest set name='test'") getting below error org.apache.spark.sql.analysisexception: unsupported language features in query: insert hivetest values(1,'sudhir','software',1,'it') tok_query 0, 0,17, 0 tok_from 0, -1,17, 0 tok_virtual_table 0, -1,17, 0 tok_virtual_tabref 0, -1,-1, ...

sql server - T-SQL: How to select rows as XML element -

i have table cost renderedvalue sectionname ------------------------------------ 100.00 1000.00 section1 200.00 2000.00 section2 300.00 3000.00 section3 400.00 4000.00 section4 and want produce xml: <root> <section1cost>100.00</section1cost> <section1renderedvalue>1000.00</section1renderedvalue> <section2cost>200.00</section2cost> <section2rendredvalue>2000.00</section2rendredvalue> </root> i able produce using tsql ( test table name) select (select cost 'cost'from test sectionname = 'section1') 'section1cost', (select renderedvalue 'cost'from test sectionname = 'section1') 'section1renderedvalue', (select cost 'cost'from test sectionname = 'section2') 'section2cost', (select renderedvalue 'cost'from test sectionname = 'secti...

java - Can I distribute Maven archetype in eclipse plugin without manual artefact installation -

i have custom maven archetype installed in local maven repository. additionally have eclipse plugins contributing "new project" wizard generating project archetype (using m2eclipse). the problem how distribute archetype other people. can ask them install manually mvn install:install-file example, that's manual step , don't want this. ideally want put inside eclipse plugins provide , call there. possible? thank you!

PHP Simple HTML DOM parser - print class name -

i have little problem parsing data 1 webpage. i'm trying class name of div . example: < div class="stars b3"></div> i want save in array b3 . possible this? thanks! see this: <?php // http://stackoverflow.com/questions/4835300/php-dom-to-get-tag-class-with-multiple-css-class-name $html = <<< html <td class="pos" > <a class="firstlink" href="search/?list=200003000112097&sr=1" > firs link value </a> <br /> <a class="secondlink secondclass" href="/search/?keyopt=all" > second link value </a> </td html; $dom = new domdocument(); @$dom->loadhtml($html); $dom->preservewhitespace = false; $xpath = new domxpath($dom); $hrefs = $xpath->evaluate( "/html/body//a[@class='secondlink secondclass']" ); echo $hrefs->item(0)->getattribute('class'); ref. http://co...

JointJS manhattan router has lines that are not vertical or horizontal -

Image
i'm using links defined manhattan router. according documentation, lines should vertical , horizontal, of them start or end oblique. can't find how fix them. on following picture, red , green lines correct, while orange lines not expected. the code same draw lines. here code orange lines: var link = new joint.dia.link({ source: { x: rects[item.statusid].mout.x, y: rects[item.statusid].mout.y }, target: { x: rects[item.modifystatusid].min.x, y: rects[item.modifystatusid].min.y }, router: { name: 'manhattan', args: { startdirections: ['top'], enddirections: ['right'] } }, attrs: { '.connection': { stroke: mcolor, 'stroke-width': 3 }, '.marker-target': { fill: mcolor, stroke: mcolor, d: 'm 10 0 l 0 5 l 10 10 z' } } }); links.push(link);

javascript - Cycle between elements and change the class to the next one -

is possible? i have 20 elements various dynamic classes, of them equal. there way move current class next 1 , on this? initial el1 - classa el2 - classhh el3 - classkl el4 - classui el3 - classkl el4 - classyy to el1 - classyy el2 - classa el3 - classhh el4 - classkl el3 - classui el4 - classkl i have been struggling while , can't right.. thought removing , adding class's while on loop, equal classes bugging me out.. thank help. are looking such kind of behavior: $(document).ready(function(){ var container = $("ul"); $("#changeclass").click(function(){ shiftclasses(); }) function shiftclasses(){ var arrclass = []; var allchild = container.children(); $(allchild).each(function(index,obj){ var cls = $(obj).attr("class"); arrclass.push(cls); $(obj).removeattr("class"); }); var last = arrclass.pop(); arrclass.splice(0, 0, last); $(allchil...

javascript - How to show decimal numbers in d3 radialProgress? -

im using d3 component radialprogress.js but not possible show decimal numbers, example: 1.37% shows 1%. is there configuration can change it? thanks. [edit] i found function: function labeltween(a) { var = d3.interpolate(_currentvalue, a); _currentvalue = i(0); return function(t) { _currentvalue = i(t); this.textcontent = math.round(i(t)) + "%"; } } wich used by: label.transition().duration(_duration) .tween("text",labeltween); the a parameter in labeltween function value on label text. value rounded when labeltween function called. this not configurable, value rounded in code. need replace .text(function (d) { return math.round((_value-_minvalue)/(_maxvalue-_minvalue)*100) + "%" }) with .text(function (d) { return (_value-_minvalue)/(_maxvalue-_minvalue)*100 + "%" }) to disable rounding. there few other places needs happen well: label.datum(math.roun...

jquery - javascript extend child function from another parent -

b extend a.call(this) , how extend child function (a.method)? function a() { this.method = function() { // method }; } function b() { a.call(this); this.method = function() { // method // method b }; }

javascript - testing equality when there's a mutable inside an immutable.js structure -

testing equality pretty easy when immutable: a = map({foo: 1}); b = map({foo: 1}); is(a,b) //true now, let's put mutable structure inside: a = map({foo:{bar: 1}}); b = map({foo:{bar: 1}}); is(a,b) //false dang! what's cleanest way accomplish this? (yeah, yeah, know mutables inside immutable sick & wrong, can't control folks put inside structures) a couple ideas: use tojs , deepequal native objects. don't since lose lot of control on things item order, etc. recursively use fromjs this, think it's best approach, assuming don't know shape of mutable, can't figure out how in line or 2. code examples welcomed! ???

javascript - Form doesn`t check the validation -

i want check if there error doensn't check anaything. form submits when fields empty. dont know fault is. can fields in form correct think goes wrong in if(error == 0) : <script> $(document).ready(function(){ var errormsg = ['please enter name.', 'please enter minimum 3 character.', 'value not more 100 characters.', 'please enter email.', 'please enter valid email.', 'email , confirm email not match.', 'please enter password', 'please enter role.', 'email exists']; $("input[type='submit']").on('click', function(e){ e.preventdefault(); $(".validationerror").remove(); var span_error_start = '<span class="form_error">'; var span_error_end = "</span>"; var name = $.trim($("input[name='name']").val()); var problem = $.trim($("i...