Posts

Showing posts from July, 2012

excel - Adding a string for a parameter in a GETPIVOTDATA function -

i'm hoping has solution this. have getpivotdata function works well, want add string formatted added getpivotdata . here example of getpivotdata function: =getpivotdata("sum of "&$o$62,$b$65,"class",b69,"scenario",$c$67,"capital/operating",$t$64) here string want add end of getpivotdata function. "project","(c0000000046) professional development","task","(300) certifications" project , task fields , "(c0000000046) professional development" , "(300) certifications" items want add getpivotdata function before evaluated. does know how make happen? updated here example file. if want add new parameter exiting formula: =getpivotdata("sum of " & $o$62, $b$65,"class", b69, "scenario", $c$67, "capital/operating", $t$64, _ "project","(c0000000046) professional development","task",&

I want to calculate time in Asia/Dubai timezone from the time of Asia/Kolkata using java 8 Date Time API -

zoneid dubai = zoneid.of("asia/dubai"); localdate localdate = localdate.now(); localtime localtime = localtime.now(); zoneddatetime zoneddatetime = zoneddatetime.of(localdate, localtime, dubai); system.out.println("dubai tiime:"+zoneddatetime); above code still printing time of current zone (i.e asia/kolkata) also tried following code achieve same printing time in current zone(asia/kolkata): zoneoffset offset = zoneoffset.of("+04:00"); localdatetime localdatetime = localdatetime.now(); offsetdatetime plusfour = offsetdatetime.of(localdatetime, offset); system.out.println("dubai time :"+plusfour); i unable figure out why not providing desired result. the answer kokorin correct. here's bit more discussion. problems when called now method , passed no arguments, failed specify time zone. in omission, java.time silently applied jvm’s current default time zone in determining current local time , current local date.

ASP.net C# GridView to html table not working -

so have on mark up: <asp:gridview id="gridview1" runat="server" itemtype="ir_infantrecord.models.immunization" datakeynames="immunizationnumber" selectmethod="patientimmungrid_getdata" autogeneratecolumns="false" ... <columns> <asp:templatefield headertext="empname"> <itemtemplate> <asp:label text="<%# item.emp.empname%>" runat="server" /> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="check"> <itemtemplate> <asp:label text="<%# item.emp.check%>" runat="server" /> </itemtemplate> </asp:templatefield>

PHP MySQL Cannot use "INSERT INTO" -

this question has answer here: php mysql insert not working 6 answers i have created webpage named register.php should insert data database. problem registration page works when try log in information not added database there did wrong cannot find? <?php echo "<h1>register</h1>"; $submit = $_post['submit']; //form data $fullname = strip_tags($_post['fullname']); $username = strip_tags($_post['username']); $password = strip_tags($_post['password']); $repeatpassword = strip_tags($_post['repeatpassword']); if ($submit) { //open database $connect = mysql_connect("localhost","root",""); mysql_select_db("cs266db_db1"); $namecheck = mysql_query("select username user_id username='$username&

java - how handle requests consumed concurrently by different instances of my rest api -

i have rest api developed java. api running in 4 servers , consumes requests stored in database. the executor class has run() method creates connections db , retrieves 1 request queue process. the requests being retrieved inside synchronized block , works fine. problem synchronized block avoid concurrency problem inside instance of api. doesn't controls other instances. that's problem, different instances process same request: synchronized (lock) { executionparameters = getexecutionparametersfromqueue(dbconnection); if (executionparameters == null) return; executionparameters.setstatus(executionstatus.processing); executionparameters.updateexecutionparameters(procedurehandler, dbconnection); } could me problem? welcome. i'm thinking in way these 4 instances communicates each other, way instances know if request retrieved has been processed other instance. how that? better solution? thanks i

bash - CentOS, Convert ipV6 short to long form -

i have started bash scripting , there small problem have solve go on: i'm getting ipv6 address in format: 1080::8:800:200c:417a now want convert short long ipv6 form like: 1080:0:0:0:8:800:200c:417a is there regex expression or similar convert that? i working on docker container runs on centos 8.3. it isn't regex, 'something similar' , job: (tested python3.5.1) >>> import ipaddress >>> x = '1080::8:800:200c:417a' >>> y = ipaddress.ip_address(x) >>> y.exploded '1080:0000:0000:0000:0008:0800:200c:417a' >>> reference: https://docs.python.org/3/library/ipaddress.html

c++ - Simple Encryption not working -

i'm using simple encryption found online. basically, i'm streaming in file, checking see if file open (if not, display error message) , putting each line in each element of array while encrypting information. afterwards stream encrypted information onto output file. however, i'm getting nothing in output.txt file. encryption works fine if test itself. here code: #include <string> #include <fstream> #include <sstream> // ostringstream #include <iostream> #include <stdio.h> #include <algorithm> /* credits kylewbanks.com */ string encrypt (string content) { char key[3] = {'k'}; //any chars work string output = content; (int = 0; < content.size(); i++) output[i] = content[i] ^ key[i % (sizeof(key) / sizeof(char))]; return output; } int main() { string input, line; string content[10000]; string encryptedcontent[10000]; int counter = 0, innerchoice = 0, i, finalcounter;

Plotting clusters of nominal data in R -

Image
imagine have 7 categories (e.g. religion), , plot them not in linear way, in clusters automatically chosen nicely aligned. here individuals within groups have same response, should not plotted on 1 line (which happens when plotting ordinal data). so sum up: automatically using available graph space grouping without order, spread around canvas individuals remain visible; no overlapping would nice have individuals within groups bound (invisible) circle are there packages designed purpose? keywords need for? example data: religion <- sample(1:7, 100, t) # no overlap here, see group part come out more. plot(religion) after assigning coordinates center of each group, can use wordcloud::textplot avoid overlapping labels. # data n <- 100 k <- 7 religion <- sample(1:k, n, true) names(religion) <- outer(letters, letters, paste0)[1:n] # position of groups x <- runif(k) y <- runif(k) # plot library(wordcloud) textplot( x[religion], y[reli

list - len() function not working properly in Python -

i have following code: class stat(list): def __init__(self, lst = []): self.s = list(lst) def __repr__(self): return "stat({})".format(self.s) def add(self, item): self.s.append(item) def len(self): return len(self.s) ...(more methods, not necessary) all of methods work len() . no matter length of stat object, returned length 0; don't understand why. it return 0 when using this: x = stat([1,3,4,5]) print len(x) if want override len function use code: def __len__(self): return len(self.s)

node.js - NodeJS to poll data from N sources every X seconds -

is nodejs choice poll data n third party sources on rest interface. i need (almost) parallelize can support real time updates. question - nodejs choice this? another caveats are: if response large each polling , rapid (perhaps in 100s of megas) must try use multiple node processes. server response each polling should less interval time of polling cycle else may hit condition process may become unresponsive , fail. you may choose use reactive programming scenario. try rx.js . in handling process in controlled manner.

Money is not being sent or received when using PayPal REST SDK and PayPal-Python-SDK -

i've integrated paypal payment process in following way using paypal-python-sdk . order made on our website. @ point know how charge visitor. i configure paypalrestsdk module passing mode argument live (not sandbox ), client id , client secret live settings. i create payment using paypalrestsdk.payment pass tons of parameters including return_url , cancel_url , price , currency , quantity , others. if payment created without errors, redirect_url created payment. user clicks link redirects him redirect_url , paypal page fills in either paypal details or credit card details. user pays amount of money , being redirected our site. as last step check if there record in db payment id came in or post parameters , if there 1 in db, i'm marking paid . now, problem whole process works fine , expected, money not going out paypal account used payment. money not going out credit card either. , of course money not received account used receiving. here's code gene

c# - C - Serial port read byte different from sent byte -

i sending , receiving data between virtual serial ports created using com0com. on 1 side c program running in ubuntu vm guest , other side c#.net program running on windows 10 host. i can send , receive data between ttys ports on ubuntu , virtual com ports on windows, in simple test seems byte received in c program different send c# program. byte sent c#.net: 0x4b byte received in c: 0xb notice missing '4', it's not typo mistake. the question why byte different? c code #include <stdio.h> #include <fcntl.h> #include <termios.h> #include <sys/select.h> #include <time.h> typedef unsigned char byte_t; // *** function: open_port int open_port(char* tty_path){ int fd; struct termios portsett; printf("attempting open port: %s\n", tty_path); fd = open(tty_path, o_rdwr | o_noctty | o_ndelay); printf("file descriptor: %d\n", fd); if(fd == -1){ printf("unable open port.\n&

javascript - How to make a hidden form with a file field -

i have dynamically generated table editable. on clicking cell in table can change text. in 1 column there image displayed. when user clicks on change html column <input type='file'> , trigger click hence making user choose file upload icon. in last column of table have commit button. if user makes changes , presses commit have pick whole row ( text fields , 1 file field ) , add contents form including file user chose , send python script upload s3 server. my question is: how send form? i'm using script not working sending text request.files turns out empty @ python(django) script side. function update(a) { try { var button = $(a); var row = $(button.parent()); var rowcount = button.parent().parent().parent().children().index(button.parent().parent()); var filerow = ''; var formrow = new array(); var rowkey = new array('topic', 'topicdescription'); var cnt = 0; v

active directory - Azure AD authentication for Azure App Service - is the federated model for Azure AD supported? -

we have office 365 tenant uses federated identity model . is such model compatible azure active directory (aad) identity provider authentication cordova app uses azure app service backend? i try it, don't expect access corporate azure account, , have certainty before progressing far development on platform. i'm happy report works. yay.

url rewriting - Remove parent categories from subcategory in URLs in Magento 1.9.2.3 -

magento version 1.9.2.3. i have tried following solution doesn't work me. step 1: go app/code/core/mage/catalog/model/url.php copy file app/code/local/mage/catalog/model/url.php because core magento file have copy file app/code/local. step 2: search getcategoryrequestpath($category, $parentpath) around line 698 in magento ver. 1.9.1.0 step 3: search if (null === $parentpath) around line 717 , comment line below: /* if (null === $parentpath) { $parentpath = $this->getresource()->getcategoryparentpath($category); } elseif ($parentpath == '/'){*/ $parentpath = ''; //do not comment line //} step 4: go magento admin , clear cache system->cache management , reindex system->index management data. step 5: refresh browser cache , navigate again see sub category in url not parent category http://www.abcxyz.com/test-category-level-1-3.html - see more at: http://www.expertwebadvisor.com/remove-parent-category-path-from-sub-category-url-in-magento

java - Using SWIG for setting types in overloaded C++ method -

i writing c++ library used applications on different platforms, including android. , android build swig used (i cannot change choice, , have never worked swig). automatic type conversion java-to-c++ worked fine until assigned task of init method overloading. for old init c++ interface is: /** * initialize classifier file * @param modelpath std::string full path file model * @return classifier possible values: * pointer classifier instance in case of success * nullptr otherwise */ static classifier* init(const std::string& modelpath); the following code generating: public static classifier init(string modelpath) { long cptr = cljni.classifier_init__swig_0(modelpath); return (cptr == 0) ? null : new classifier(cptr, true); } for new init c++ is: /** * initialize classifier memory block * @param mo

java - Unable to edit .xhtml files on RAD 8.5/9.0 -

it showing following error: java.lang.nullpointerexception @ com.ibm.etools.references.internal.management.internalreferencemanager.expandlinktext(internalreferencemanager.java:473) @ com.ibm.etools.references.management.referencemanager.expandlinktext(referencemanager.java:103) @ com.ibm.etools.webedit.core.pdlinkfixupdelegates.linkutilbasedelegate.getabsurl(linkutilbasedelegate.java:85) @ com.ibm.etools.webedit.viewer.utils.linkutilbase.getabsurl(linkutilbase.java:187) @ com.ibm.etools.webedit.viewer.utils.linkutilbase.getabsurl(linkutilbase.java:206) @ com.ibm.etools.webedit.viewer.utils.linkutilbase.getabsurl(linkutilbase.java:194) @ com.ibm.etools.webedit.editparts.adapter.submodeladapterfactory.getrawresfilename(submodeladapterfactory.java:101) @ com.ibm.etools.webedit.editparts.adapter.submodeladapter.getresfilename(submodeladapter.java:97) @ com.ibm.etools.webedit.editparts.adapter.submodeladapter.getmodel(submodeladapter.java:52) @

Sample code in angularjs, to read and write text file -

i new this.the solutions getting internet reading file , displaying is, want read file line line. var lines = this.result.split('\n'); for(var line = 0; line < lines.length; line++){ console.log(lines[line]); } with \n can split file @ linebreaks. question vague solution when want output file line line. context: first need input file, can achieve via html: <input type="file" name="file" id="filename"> now create js function grab file: document.getelementbyid('filename').onchange = function(){ // declare file variable var filevar = this.files[0]; //the reader: var datareader = new filereader(); reader.onload = function(progressevent){ }; i included filereader, can see can combine full function: document.getelementbyid('filename').onchange = function(){ var filevar = this.files[0]; var datareader = new filereader(); reader.onload = function(progressevent){ var lines = this

ios - Generate PEM file for live application -

my application live how generted pem file using appstore production cerificate enable apns in ios refer link , describes entire process of creating apns certificate downloading , converting pem file. hope helps :]

html - Search bar with glyphicon inside (no borders) -

i using bootstrap 3, can't icon / button on right side without annoying borders. make me demo, similar? picture here html: <div class="input-group"> <input type="search" name="søk på siden" placeholder="søk etter midtveisvurdering, iko modellen eller hva du måtte ønske!" id="input" class="form-control" value="" required="required" title="søk på siden"> <span class="input-group-addon"> <button type="button" class="btn btn-search"> <span class="glyphicon glyphicon-search" aria-hidden="true"></span> </button> </span> </div> css: .form-control { display: block; width: 100%; height: 50px; padding: 6px 12px; font-size: 16px; line-height: 1.42857; color: #555555; background-color: $lightgray; background-image: none; border-bottom: 3px solid $whi

fiware - Why wont my widget work inside of wirecloud? -

i have made following widget using nothing html, css , js. works fine when search keywords ixist in our db (such peach or strawberry): <!doctype html> <html> <head> <meta charset="utf-8"> <title>search seller widget</title> <meta name="viewport" content="width=device-width"> <style> #mapcanvas { width: 550px; height: 600px; float: left; border-style: solid; color: #59c0df; } #infopanel { float: left; margin-left: 10px; } #infopanel div { margin-bottom: 5px; } #tbl{ border-collapse: collapse; } #tbl, td, th{ border: 2px solid #70b8ff; padding: 5px; } th{ font-style: bold; color: black; background-color: #59c0df; } .btn { background: #3498db; background-image: -webkit-linear-gradient(top, #3498db, #2980b9); background-image: -moz-linear-gradient(top, #3498db, #2980b9); background-image: -ms-linear-gradient(top, #3

python - How to make some buttons call methods from previous classes in tkinter? -

i used tkinter set 4 buttons, , want print different strings @ each button press. when run code, got 4 different strings printed(one of each) @ once without pressing of them , when press, nothing happens. here's code: from tkinter import * class motor: def __init__(elemesmo, eixo , valorzero): elemesmo.eixo = eixo elemesmo.zero = valorzero def aumenta(self): print(self.eixo + str(self.zero+5)) def diminui(self): print(self.eixo + str(self.zero-5)) def para(self): print(self.eixo + str(self.zero)) def paratudo(): motor.para(eixox) motor.para(eixoy) eixox = motor('x',90) eixoy = motor('y',90) class interface: def __init__(elemesmo, widget): quadro = frame(widget) quadro.pack() elemesmo.aumentarx = button(quadro,text="aumentar x",height=10,width=20,command=eixox.aumenta()) elemesmo.aumentarx.pack(side=right) elemesmo.diminuirx = button(quadro,text=

jquery - Using php code in css file to create dynamic css dosen't works each time.. sometimes dynamic css not loaded only static rules in that css are loaded -

i trying create dynamic css. appending variable in each rule of css. have tried variable using cookie,session , method works 1 out of 10 times. css file (component.min.css) : <?php header('content-type: text/css; charset: utf-8'); header('cache-control: must-revalidate'); $appvar = ""; if(!empty($_cookie["_adl_appvar"])) { $appvar = $_cookie['_adl_appvar']; } elseif(!empty($_session['_adl_appvar'])) { $appvar = $_session['_adl_appvar']; } ?> /* general styles modal */ /* styles html/body special modal want 3d effects note need container wrapping content on page perspective effects (not including modals , overlay). */ .<?php echo $appvar ?>abs<?php echo $appvar ?>-perspective, .<?php echo $appvar ?>abs<?php echo $appvar ?>-perspective body { height: 100%; overflow: hidden; } .<?php echo $appvar ?>abs<?php echo $appvar ?>-perspective body { backgrou

android - Xamarin Zxing Fragment OnPause Only the original thread that created a view hierarchy can touch its views -

i'm developing codebar app android xamarin , zxing library. objective have in same view half of screen codebar view, , other half buttons add or delete scanned object list. in mainactivity oncreate function have: scanfragment = new zxingscannerfragment(); fragmenttransaction fragmenttx = this.fragmentmanager.begintransaction(); fragmenttx.replace(resource.id.fragment, scanfragment); fragmenttx.settransition(fragmenttransit.fragmentfade); fragmenttx.commit(); in zxingscannerfragment oncreate have frame = (framelayout)layoutinflater.inflate(resource.layout.zxingscannerfragmentlayout, viewgroup, false); return frame; what want that, when user scans view of camera shut off, , when user has decided if wants keep or discard scanned object camera shows again. so have scann function called when code detected on mainactivity, calls onpause method in zxing fragment , enables buttons code: var opts = new mob

Crystal Reports ODBC connection: the database table <tablename> cannot be found -

when running (or verifying database) report in crystal reports 10, getting message: "the database table "sometable" cannot found. proceed remove table report?" for multiple tables. the report used work fine. report getting data multiple sources, , missing tables coming odbc connection sql server db. think issue may when report created, odbc pointing @ different instance of database (same structures, different location.) i've checked , report user has required permissions on new database. in crystal, if ignore messages report seems run fine. when deploying report run within crystal report viewer in website, throwing file i/o error . this handy blog post provides solution: https://wisdomofsolomon.wordpress.com/2011/06/18/crystal-reports-tables-not-found-during-verify-database/ by running show sql query can see generated query running sql like select * databasename.dbo.sometable it's databasename part of that seems causing

c++ - List-initialization of const references to temporary objects -

i find getting different behaviors 2 samples below g++-4.8.1, when temporaries bound instance of class: template <class t> struct { a(t const& a) : b(a) { } t const& b; }; and template <class t> struct b { b(t const& a) : b{a} { } t const& b; } i find, first sample, bound temporary object persists life-time of instance of a, not case instance of b. such behavior correct according c++11 standard? please point relevant parts of standard. note: a , b , temporaries bind instantiated in expression. @ end of expression, destroyed, along temporary bind to, why life-time should same life-time of temporary. edit: part of standard explain discrepancy between 2 initializations: — otherwise, if t reference type, prvalue temporary of type referenced t list-initialized, , reference bound temporary. [ note: usual, binding fail , program ill-formed if reference type lvalue reference non-const type. — end note ] such behavior not

Does Android Content Provider authority definition break the DRY rule? -

android's content provider must have : at least 1 authority must specified. so example in google's samples android-basicsyncadapter androidmanifest.xml there is <provider android:name=".provider.feedprovider" android:authorities="com.example.android.basicsyncadapter" android:exported="false" /> then implement cp 1 need define same string inside cp in android-basicsyncadapter feedprovider.java content_authority public static final string content_authority = "com.example.android.basicsyncadapter"; as have define string twice, isn't breaking dry rule - if change in 1 place, have remember change somewhere else well. actually don't have specify authority multiple times. in our opentasks provider load authority @ runtime manifest. the basic idea this: context context = getcontext(); packagemanager packagemanager = context.getpackagemanager(); providerinfo providerinfo = packagemanag

java - JBAS014360: EJB 3.1 FR 4.3.14.1 concurrent access timeout on org.jboss.invocation.InterceptorContext -

i'm doing migration jboss 7.1 , seam 2.3, having issues jbas014360: ejb 3.1 fr 4.3.14.1 concurrent access timeout on org.jboss.invocation.interceptorcontext here action class: @name("myaction") @scope(scopetype.conversation) public class myaction implements java.io.serializable { @in(create = true) private myservice myservice; @in(required = false) @out(required = true) private user user; @in(required = false) @out(required = false) private acquisition acquisition; @begin(join = true) @create public void init() { // more code acquisition = myservice.getnext(user); } public void savehistory() { myservice.savehistory(acquisition, user); } } and service class. @stateless @name("myservice") public class myserviceimpl implements myservice { @in(create = true) private entitymanager em; @transactionattribute(transactionattributetype.requires_new) public acqui

ios - Contacts framework doesn't request for access when needed -

this have far: private let contactstore = cncontactstore() private func requestaccessforcontacts() { switch cncontactstore.authorizationstatusforentitytype(.contacts) { case .denied, .notdetermined: contactstore.requestaccessforentitytype(.contacts, completionhandler: { access, error in if access { print("super") } else { print("problem") } }) case .authorized: print("ok") case .restricted: print("restricted") } } the problem printed on console, nothing displayed on screen, no request access. why? your code works; able replicate problem first rejecting access contact , re-running app. once have disallowed access, subsequent running of app log "problem" without displaying request window. if 1 wanted see request window again after denying, 1 could, however, go " settings " -> &qu

php - How do I insert a chunk of code every time my while loops fetches some data from my database -

i have table in database. use while loop traverse them. , make html div fetched data. used limit 10 because entries in posts keep changing users keep inserting posts table $get_ids=mysql_query("select * posts order id limit 10"); while($row = mysql_fetch_array($get_ids)){ $sm=$row['message']; echo "<div>".$sm"</div>"; } what want know how use jquery make script insert these 10 divs dom every 1 second or so. please urgent!!!! try google jquery & php webservice examples. should this: //javascript function fetches single data j.d.smith suggested function gethtml() { $.get({ 'url': 'address of php webservice', 'success': function(data) { $("#content").html($("#content").html() + data); //append html page } }); } //call function every 10 sec, place in $(document).ready() or else use window.settimeout(function () {

javascript - JQuery, get input id -

<script> $(document).ready(function() { $('#hotelo_div :input').onblur = validate(1, this.id, "abcd"); }); </script> <div id="hotelo_div"> <table id="hotcalcmain"> <tr> <td>pmi1</td> <td class="hotcc"><input type="text" id="pmi_1" maxlength="2" size="2"> %</td> <td class="hotcc"><input type="text" id="pmi_2" maxlength="2" size="2"> %</td> <td class="hotcc"><input type="text" id="pmi_3" maxlength="2" size="2"> %</td> <td class="hotcc"><input type="text" id="pmi_4" maxlength="2" size="2"> %</td> </tr> ... how send input id(e.g.

r - umlauts in comments in preambel with knitr cause problems with texi2dvi -

i found errors umlauts in comments knitr in latex. first mini-example: \documentclass[12pt, % ß a4paper % page format ]{scrartcl} \begin{document} <<code>>= rnorm(30) @ \end{document} and errors shown: error in texi2dvi(file = file, pdf = true, clean = clean, quiet = quiet,: running 'texi2dvi' on 'minimalexample.tex' failed. latex errors: ! latex error: environment knitrout undefined. see latex manual or latex companion explanation. type h <return> immediate help. ... ! undefined control sequence. l.6 \definecolor {shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{... control sequence @ end of top line of error message never \def'ed. if have ! undefined control sequence. l.6 ...shadecolor}{rgb}{0.969, 0.969, 0.969}\color {fgcolor}\begin{kframe} control sequence @ end of top line of error message never \def'ed. if have ! latex error: environment kframe undefined. see latex