Posts

Showing posts from May, 2011

ember.js - Could not find module `ember-infinity/mixins/route` -

i trying implement infinite-scrolling using ember-infinity. have followed documentation getting error "could not find module ember-infinity/mixins/route " below code import ember 'ember'; import infinityroute 'ember-infinity/mixins/route'; export default ember.route.extend(infinityroute,{ store: ember.inject.service(), model(){ var inflector = ember.inflector.inflector; inflector.irregular('feed', 'feeds.php'); inflector.uncountable('advice'); let user = json.parse(localstorage.getitem('user')); let token = localstorage.getitem('token'); if(user != null){ //return this.get('store').query('feed',{page:1,userid:user.id,token:token}); return this.infinitymodel("feed", { perpage: 12, startingpage: 1,userid:user.id,token:token }); } } , actions:{ getdetails(feed){ console.log("getting details of "+feed.id); } } }); could please

shell - Does curl retrieve data from REST API? -

i'm using curl command data rest api, , incremental pull every day data api. so, using curl command download data csv through script daily, pull data api? command used: curl -o '-token-' https://example/api/views/ > data.csv so keep curl command in script download data everyday api , use csv spreadsheets. and curl data api or today's data? or can use python script download data everyday? yes. curl can this. look doing following: 1) create bash script curl command in it. https://www.linux.com/learn/writing-simple-bash-script 2) set cron tab execute bash script on schedule. http://www.computerhope.com/unix/ucrontab.htm the above assumes you're using linux, can achieve same thing in macos , windows10 (using bash windows). my advise create droplet on digitalocean. there can run simple linux server in cloud stays , runs above you.

java - I am trying to convert a string to efficient xml using nagasena example but i get a runtime error -

private static void encode(string sourcefile) throws filenotfoundexception, ioexception, exioptionsexception, transmogrifierexception { string scurrentline=null; stringbuilder sb = new stringbuilder(); try (bufferedreader br = new bufferedreader(new filereader(sourcefile))){ while ((scurrentline = br.readline()) != null) { sb.append(scurrentline); } } string sb1= sb.tostring(); system.out.println("xml string:"+sb1+"\n"); outputstream out =null; //this code nagasena grammarcache grammarcache; transmogrifier transmogrifier = new transmogrifier(); grammarcache = new grammarcache(grammaroptions.default_options); transmogrifier.setgrammarcache(grammarcache); transmogrifier.setoutputstream(out); //passing string input transmogrifier.encode(new inputsource(sb1)); system.out.println("check2 : string exi conversion"+ out +"\n");

operating system - Understanding higher level call to systemcalls -

i going through book galvin on os . there section @ end of chapter 2 author writes "adding system call " kernel. he describes how using asmlinkage can create file containing function , make qualify system call . in next part how call system call writes following : " unfortunately, these low-level operations cannot performed using c language statements , instead require assembly instructions. fortunately, linux provides macros instantiating wrapper functions contain appropriate assembly instructions. instance, following c program uses _syscallo() macro invoke newly defined system call: basically , want understand how syscall() function works . , understand macros system text substitution . (please correct me if wrong) how macro call assembly language instruction ? syscallo() when compiled translated address(op code) of instruction execute trap ?(but somehow doesn't fit concept or definition of macros have ) wrapper functions contained inside , written in a

android - RecyclerView smooth scroll makes item only partially visible -

when more items recyclerview add them beginning, notifyitemrangeinserted(0, ...) , smoothscrolltoposition(0) . see scroll, if new item multi line, part of view scrolled screen. recyclerview has reverselayout="true" any easy way "scroll bottom" ensure view entirely visible?

c# - sqlite on .net core publish to azure fails -

i'm trying publish code-first webapp uses sqlite azure. now, application working fine locally. when publish, seems database file not being created properly, , following error: sqliteexception: sqlite error 1: 'no such table: blogs'. microsoft.data.sqlite.interop.marshalex.throwexceptionforrc(int rc, sqlite3handle db) i not sure why blogs table isn't created (and assume rest aren't created either). my applicationdbcontext.cs looks this: public class applicationdbcontext : identitydbcontext<applicationuser> { public applicationdbcontext(dbcontextoptions<applicationdbcontext> options) : base(options) { } public applicationdbcontext() { database.ensurecreated(); database.migrate(); } protected override void onmodelcreating(modelbuilder builder) { base.onmodelcreating(builder); } public dbset<publication> publications { get; set; } public dbset<blog>

run zend expressive from subdirectory with apache .htaccess -

i have been following http://zendframework.github.io/zend-expressive/cookbook/using-a-base-path/ i have application under directory structure this /(root) -webapp - (other directory) -public following above guide works if use subdomain pointing toward webapp. not work if follow directory structure. http://webapp.example.com - works if points webapp http://example.com/webapp - show 404 error (route cant find in zend expressive) i can not use subdomain here. must second way need done. edit: i have tried htaccess. in application root (/webapp/.htaccess). seems htaccess not matching , not routing request public directory. rewriteengine on rewriterule webapp/(.*) ./public/$1

popupwindow - android.view.WindowManager$BadTokenException: Unable to add window -

i'm adding popup window in fragment when user clicks on floating action button, in popup window have added autocomplete edit field when clicked floating action button, popup window shows when click edit field gave error. error here complete error. process: com.example.mubtadanaqvi.stunexus, pid: 7252 android.view.windowmanager$badtokenexception: unable add window -- token android.view.viewrootimpl$w@4234e238 not valid; activity running? @ android.view.viewrootimpl.setview(viewrootimpl.java:769) @ android.view.windowmanagerglobal.addview(windowmanagerglobal.java:278) @ android.view.windowmanagerimpl.addview(windowmanagerimpl.java:69) @ android.widget.popupwindow.invokepopup(popupwindow.java:1067) @ android.widget.popupwindow.showasdropdown(popupwindow.java:966) @ android.widget.listpopupwindow.show(listpopupwindow.java:635) @ android.widget.autocompletetextview.showdropdown(autocompletetextview.java:1119) @ android.widget.autocompletetextview.updatedropdownforfilter(autoco

excel vba - Compare a cell value (number) with value of counter inside a for -

i'm trying optimize need of lot of case for loop. have following code: dim ws3 worksheet, ultimafila3 long, k long set ws3 = worksheets("lista_riesgos") ws3 ultimafila3 = .listobjects("consolidadoriesgos").range.columns(1).cells.find("*", searchorder:=xlbyrows, searchdirection:=xlprevious).row - 1 k = 1 ultimafila3 if .listobjects("consolidadoriesgos").databodyrange.cells(k, 1).value = k .listobjects("riesgos").databodyrange.cells(k, 1) = .listobjects("riesgos").databodyrange.cells(k, 1) & " " & .listobjects("consolidadoriesgos").databodyrange.cells(k, 1).value end if next k end it doesn´t work, if change k i.e. 1 , codes work. i' ve tried val(k) , creating counter cell in worksheet , comparing cell , neither works.

angularjs - Create array of objects in an object - Node.js -

in below code, 'info' object has description, quantity, value. how give them array(indo property). how retrieve in angular code. details.customsdetail.itemdetails = { currency : "2000usd", weight : "lbs", info : { description : "descr", quantity : "2", value : "124", } }; do mean , indo property array of objects? details.customsdetail.itemdetails = { currency : "2000usd", weight : "lbs", info : [{ // how give in array. description : "descr", quantity : "2", value : "124",

Datatables - pagination and filtering not working when img tags are used -

say example have table img tags inside: <table class="table table-responsive table-striped table-hover" id="my-table"> <thead> <tr> <th>name</th> <th>icons</th> </tr> </thead> <tbody> <tr> <td>some name</td> <td> <a href="#"><img src="some.png"></a> </td> </tr> </tbody> and in js: $('#my-table').datatable({"ordering": false}); when there lots of table rows, pagination nor filtering input field show up. , table rows appear in same page. table works fine without img tags. i'm using datatables.bootstrap.min.js jquery.datatables.min.js

javascript - How can we call Ajax "error: function()" function manually from success function? -

how can call error: function manually success:function ? possible ? success: function(data) { response($.map(data, function(item) { if (item != "some value") { // call error:function here } return item; })) }, error: function(xhr, status, error) { var err = eval("(" + xhr.responsetext + ")"); alert(err.message); } like this: success: function(data) { response($.map(data, function(item) { if (item != "some value") { onerror(...) } return item; })) }, error: onerror var onerror = function(xhr, status, error) { var err = eval("(" + xhr.responsetext + ")"); alert(err.message); } by way, use eval never idea.

java - How to delete the list of files batch by batch? -

i trying delete older files in directory using below code. for(file listfile : listfiles) { if(listfile.lastmodified() < purgetime) //checks if lastmodified time of file lesser purge time { try{ listfile.delete(); // delete file if lastmodified time lesser purge time //system.out.println("files deleted"); logger.error(new stringbuffer(contextinfo).append("files deleted")); }catch(exception e){ //system.out.println("filedeletionerror"+e.tostring()); } }else{ logger.error(new stringbuffer(contextinfo).append("files not deleted")); //system.out.println("files not deleted"); } } the problem facing here if directory has more 2 million records, application not able proce

testing - Am new to cucumber. I am running two feature files. While running it shows an error. If am running the first tag only it runs fine -

@cucumberoptions(features = { "src\\test\\java\\com\\features\\" }, glue = { "stepdefinitions" }, plugin = { "pretty", "json:target/cucumber.json" }, tags = { "@login","@basecheck"}, monochrome = true) please me solve issue. error : none of features @ [src\test\java\com\features\] matched filters: [@login, @basecheck] for scenario runner checks feature contains 2 tags "login" , "basecheck", in case 1 feature file contains tag "login" , other feature file contains tag "basecheck". hence treats no feature exist 2 tags , shows error 'no feature' exist. one quick fix have add tags in testrunner tags= {"@login,@basecheck"}

android - Can I store multiple images paths like this in sqlite database -

Image
i working on app in want store multiple images paths on same user id in sqlite database may comma seperated. how can this. i want table in sqlite database: i think can create 2 tables. maintable having following columns: id (primary key) profile_image imagedescription table having following columns: id (primary key) main_table_id (foreign key) desc_images

angularjs - Serving excel sheet (.xls) to browser for download using rails & angular -

i using spreadsheet gem generate .xls file. after writing file, trying send client browser download. below code in rails workbook = spreadsheet::workbook.new # constructed data file = "/path/to/file/sheet.xls" workbook.write file send_file file this file when opened contains expected data in ideal format. below code in js: customrestservice.custom_post("report",{report_data: angular.tojson($scope.report_data)},"download_xls",{}).then (data)-> if data hiddenelement = document.createelement('a') angular.element(document.body).append(hiddenelement) hiddenelement.href = 'data:attachment/xls,' + encodeuri(data) hiddenelement.target = '_blank' hiddenelement.download = "report.xls" hiddenelement.click() hiddenelement.remove() but file getting downloaded in browser contains junk data. tried multiple solutions below: using send_data, instead of send_file generated

list - I Want to Connect SeekBar with my CardView. Like Price Filter SeekBar -

[hi, friens want use seekbar list view price filter in project please me. , give me examples.....[1] like seekbar please give me example https://i.stack.imgur.com/288nv.png [1]:

Expand rows by column value in Presto -

i have data has id, number like: id, number 1, 5 2, 3 and data be: id, number 1, 0 1, 1 1, 2 1, 3 1, 4 1, 5 2, 0 2, 1 2, 2 2, 3 select t.id ,s.n mytable t cross join unnest(sequence(0,t.number)) s (n) ;

Custom Google map marker for android add button on info window -

i trying develop app have plot markers on map using json parsing. have no idea custom markers info window, want know how can add button on info window can jump activity on info window of marker. here code, public class mainactivity extends appcompatactivity implements navigationview.onnavigationitemselectedlistener,onmapreadycallback , googleapiclient.connectioncallbacks,googleapiclient.onconnectionfailedlistener, view.onclicklistener { supportmapfragment smapfragment; public googlemap mmap; private httpurlconnection urlconnection = null; private bufferedreader reader = null; private string forecastjsonstr = null; loginactivity loginactivity; private static final string tag = "mapsactivity"; sharedpreferences sharedpreferences; //hereyes double lat, lon; //this url private string url = "url"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar t

Add values in array and compare with threshold within loop in Matlab -

i stuck trying figure out. have array: a = [ 1 1 1 2 1 1 1 3 2 1 1 2 1 1 1] i want add values in array equal 10 . once added value reaches 10, want array start adding value again until reaches 10. there 2 problem face here, 1) how can add array sum = 10 everytime. notice in array, there 3 . if add value before 3 , 8 , need 2 3 . need make sure remainder, 1 added next array sum 10 . 2) how break loop once reaches 10 , ask continue summation next value 10 ? i created loop works first part of array. have no idea how make continue. code follow: a = [ 1 1 1 2 1 1 1 3 2 1 1 2 1 1 1]; c = 0; = 1:length(a) while c < 10 c = c + a(i); break end end please help. thank you this should trying. displays index @ each time sum equals 10. check testcases. rem stores residual sum in each iteration carried forward in next iteration. rest of code similar doing. a = [ 1 1 1 2 1 1 1 3 2 1 1 2 1 1 1]; c = 0; rem = 0; = 1; length(a); while(i <=

qt - Placing single line of text centered in its parent in QML -

Image
this task seems simple , still can not work. i want place single line of text, inside of parent. the following should sufficient far know (and when read documentation): rectangle { width: 250 height: 200 anchors.top: parent.bottom anchors.right: parent.right text { width: parent.width height: parent.height horizontalalignment: text.alignhcenter verticalalignment: text.alignvcenter text { text: "3"; font.family: "verdana"; font.pointsize: 13 } color: "black" } } the texts ends @ top-left corner of parent: what going on here? please don't start suggesting should play anchor , anchormargin don't see reason using here. text going change , not in middle if start going way. i using: import qtquick 2.5 import qtquick.window 2.2

c# - OpenIdDict and ASP.NET Core: 401 after successfully getting the token back (full repro) -

still periodically struggling openauth using openiddict (credentials flow) in asp.net core, updated latest openiddict bits , vs2017 old sample code can find @ https://github.com/myrmex/repro-oidang , full step-by-step guidance create essential startup template. hope can useful community getting started simple security scenarios, contribution simple example code welcome. essentially followed credentials flow sample openiddict author, , can token when requesting (using fiddler): post http://localhost:50728/connect/token content-type: application/x-www-form-urlencoded grant_type=password&scope=offline_access profile email roles&resource=http://localhost:4200&username=zeus&password=p4ssw0rd! problem when try use token, keep getting 401, without other hint: no exception, nothing logged. request like: get http://localhost:50728/api/values content-type: application/json authorization: bearer ... here relevant code: first startup.cs : public void configureservi

debugging - Is there a way to use tabs to evenly space out description strings in Swift? -

overriding description variable of custom class: override var description : string { let mirrored_object = mirror(reflecting: self) let str:nsmutablestring = nsmutablestring() (index, attr) in mirrored_object.children.enumerated() { if let property_name = attr.label string! { //str.append(" attr \(index): \(property_name) = \(attr.value)\n") str.append("\t\(property_name) = \t\t\(attr.value)\n") } } return str string } produces output looks like: userid = optional(0) username = optional("testuser") email = optional("test@gmail.com") is there way set tabs in output attribute values line nicely this? userid = optional(0) username = optional("testuser") email = optional("test@gmail.com") also, there way rid of or shorten "optional" part , show value? i w

angularjs - Adding additional day in array to correct date format in angular -

in angular project, have array this: thali : [ {"date":"2017-04-09t18:30:00.000z","isholiday":"100"}, {"date":"2017-04-10t18:30:00.000z","isholiday":"101"} ] from date picker selected first value 2017-04-10 (10 april) , in isodate format shows 1 day less. need add 1 day in date array. how can add 1 day in dates of array or able change format of isodate ? here solution using pure javascript var arr = [ {"date":"2017-04-09t18:30:00.000z","isholiday":"100"}, {"date":"2017-04-10t18:30:00.000z","isholiday":"101"} ] arr.foreach(function(entry) { var d = new date(entry["date"]); // add 1 day d.setdate(d.getdate() + 1); // replace existing date in array new 1 entry["date"] = d.toisostring() }) console.log(arr);

gorm - grails, loading domain from db when fields contains null causes setters to fail -

this problem fields declared double , null in database. using findallby receive list fails if of fields null. tried changing type double problems when arithmetics on them. if value null double can't decide converter should use. don't know if there way convert nulls in domain before set. example of error: caused by: org.hibernate.propertyaccessexception: null value assigned property of primitive type setter of com.buffer.prodbuffer.makeinquiry you should use double in entities/domains; unless have nullable: false constraint @ work, it's practice, nonetheless. however, need handle null in calculations, making 0 or 1, know better. more suggestions, post code snippet.

Creating a theme on WordPress : allow the admin panel to manage images -

sorry bad english, not first language new wordpress, , want create own theme scratch. know functions wp_nav_menu(array('theme_location' => 'main_menu')) or the_content() dont know function use in order allow wordpress "customize page" choose image display on page. need write instead of <img src="<?php bloginfo('stylesheet_directory');?>/images/myimage.png" /> website admin change image customize tool, without having change or add image manually in wordpress directory ? thank time

installshield - Using Instal Shield how can one install an applcaition(file transfer,prerequiste) through custom dialog checkbox -

i trying install 3 application creating custom dialog .within custom dialog there checkbox , onclicking checkbox , thereafter doing next want application file transfer ,install prerequiste based on checkbox checked .i want happen 3 application.please suggest how , how can give condition so. assuming you're talking custom dialog basic msi, suggest following: ensure each application in question part of separate feature. if go original dialog set, potentially let user select them feature name, or hide them. these features should have meaningful names, along lines of app1 , app2 , app3 . ensure 3 check boxes associated different properties, such install_app_1 , install_app_2 , install_app_3 . show public properties here out of habit, since used in same sequence (on same dialog box, even), it's okay use private properties. , use suffixes more meaningful 1, 2, 3. adding multiple control events next or install button on dialog box described. each feature want cont

amazon web services - Restricting Send/Recieve to a Specific IAM user and SES E-mail Account -

i set aws ses domain , email address verifying domain , adding proper dns records verifying email address want send , receive from. created iam user has unrestricted access aws ses. set s# bucket receiving email. have sent , received test mail new email address aws control panel/console. my problem want create mail login email address rather using single iam user has access mail. want single new iam user bill@awsemail.com. tutorial i've seen has explained how set email sending , receiving using 1 access iam account. i've tried policy generators, i'm never able log new iam user/account i'm trying create mail application such outlook. i need @ least know proper procedure if isn't going go far writing actual 'policy' new iam user me this. i'm not sure if creating iam user what's making not work. maybe different needs happen. from mail application such outlook. that isn't ses designed for. consider few snippets faq: any

accessibility - Focusing on revealed(previously hidden) div - what is the right way -

do need move focus on hidden, revealed clicking/touching on link, div ? i'll explain following example: html: <a href="javascript:void(0)">content</a> <div>blablabla</div> css: div { display:none; width: 500px; height:200px; line-height: 200px; background: #007; color: #fff; text-align: center; } .block { display:block; } a:focus { border: 2px solid red; } jquery: $(function () { $("a").on("click touchstart", function () { $("div").addclass("block"); }); }); as can see, focus remained on link when it's clicked. need remove focus revealed div ? if so, should tabindex it? nice see examples(not necessarily, of course) of well, more clear of how should done. dialog modal https://www.w3.org/tr/wai-aria-practices-1.1/#dialog_modal when dialog opens, focus typically set on first focusable element. when dialog closes, focus returns element had f

primefaces - Jsf dataTable sortby, I want (1,2,3,4,10,15), I get (1,10,15,2,3,4). How to solve -

Image
my jsf code goes this: <p:datatable var="result" value="#{timerconfigurationjoblist.model}" rows="10" paginator="true" paginatorposition="bottom" paginatortemplate="{rowsperpagedropdown} {firstpagelink} {previouspagelink} {currentpagereport} {nextpagelink} {lastpagelink}" rowsperpagetemplate="10,20,50" id="approvaltable" lazy="true"> <p:column sortby="#{result.jobid}"> <f:facet name="header"> <h:outputtext value="#{msg['content.joblist.jobid']}"/> </f:facet> </p:column > </p:datatable> the result : as can seen in picture: '123' higher '2', '4', '7' , '9'. want come right @ end, 'numer

android - how to add screen lock activity as device built in lock screen? -

how can add screen lock activity device built in lock screen? my question may difficult understand, tell in more detail. want launch screen lock activity device in-built lock screen launches ( note: have implemented launching activity after screen lock , unlock want replace device built in lock screen own) as have noted above have implemented see this another problem: the screen lock activity getting launched after device reboot, getting launched after onr minis of rebooting device

wordpress - Woocommerce Columns Won't have a row more than 2? -

for reason, of products stacking 2, doesnt matter if change columns-2/3/4/5 stays @ 2 ? if homepage understand, think simple fix been trying days :( http://www.motorbike-shop.co.uk/ thanks in advance !! i looked @ problem. has clear:both !important; , can easly fix bij using clear:none!important; on elements for example: located in local.css @ line 165 @media screen , (min-width: 1240px) .page-template-template-fullwidth-php .site-main .columns-4 ul.products li.product, .page-template-template-homepage-php .site-main .columns-4 ul.products li.product, .storefront-full-width-content .site-main .columns-4 ul.products li.product { width: 22%; float: left; margin-right: 1.347826%; clear: none !important; <- add rule! }

javascript - dhtml scheduler timeline event is not coming in descedning priority -

i using dhtml scheduler. want show schedule items based on priority in descedning order in day. suppose have 3 events on 3 april events come highest priority element coming @ top, lowest priority @ bottom.i have coded event showing in ascending order. after modifying sorting logic in below method not giving me right result scheduler.createtimelineview( { sort:function(a,b){ return number(b.priority) - number(a.priority) } });

python 3.x - How to link social app's avatar with django user model using django-allauth -

i have created facebook , twitter authentication django-allauth. working fine authentication , know how extract logged in user's avatar code. 'user.socialaccount_set.all.0.get_avatar_url ' however, want extract user's avatar user model above code gives me 1 user's avatar. i guess have link user's avatar django's user model or store somewhere. teach me how that? ref: http://django-allauth.readthedocs.io/en/latest/index.html

shadow dom - How to apply external CSS to an external component within my angular component or using external CSS to the nested external component only -

i beginner, terminologies used here might not applied. my app has 3 components. 1 external component clr-datagrid project clarity <body> <app-root> <app-searchform> <ss-multiselect-dropdown> external library making dropdown multiselect bootstrap css </ss-multiselect-dropdown> </app-searchform> <app-searchresult> <clr-datagrid> external component displaying result list </clr-datagrid> </app-searchresult> </app-root> </body> in searchresult component, @component({ selector: 'app-searchresult', templateurl: './searchresult.component.html', styleurls: ['./searchresult.component.css', '../../../node_modules/clarity-icons/clarity-icons.min.css', '../../../node_modules/clarity-ui/clarity-ui.min.css' ], encapsulation: viewencapsulation.emulated }) the problem is, when use viewencap

pointers - EXC_BAD_ACCESS using QSort on an Array of Chars within Structs in C -

i have searched through many of answers on here , have implemented few changes based on that, getting exc_bad_access error when calling qsort function. ide pointing return in qsort compare function problem. know allocating memory elements can print strings no problem if omit call qsort. point me in right direction? my structs, see how deep navigating: typedef struct { unsigned int siteid; unsigned int tabletypeid; unsigned int surmatid; unsigned int strucmatid; char *streetave; unsigned int neighbourhoodid; char *neighbourhoodname; unsigned int ward; char *latitude; char *longitude; } entries; typedef struct { int size; entries **entry; } picnictable; typedef struct { table *tabletypetable; table *surfacematerialtable; table *structuralmaterialtable; neighbourhoodtable *neighborhoodtable; picnictable *picnictabletable; } database; extern database *db; entries **ent = db->picnictabletable->entry; qs

How to upload Video from computer in CMS Page in magento-1.9? -

Image
i trying upload video in cms page , static block, video not uploaded. i recheck video format i.e. mp4 . please tell me how upload video in cms page? in advance. you have create module edits configuration find @ app/code/core/mage/cms/etc/config.xml on line 123. you have create new module example himani_video contains following xml: <config> <modules> <himani_video> <version>0.0.1</version> </himani_video> </modules> <adminhtml> <cms> <browser> <extensions> <media_allowed> <mp4>1</mp4> </media_allowed> </extensions> </browser> </cms> </adminhtml> </config> this allow upload mp4 videos backend:

php - Run Multiple MySQL Server with One host address? -

i want run 2 separate mysql server 1 php base web server, load balancer way. i have 2 centos machine , on separately mysql server only. kind of service should use both server ruining concurrently, mean web server load both mysql servers. can used ha proxy? please suggest me. use amazon aurora, more or less several mysql instances automagically loadbalanced, described.

python 3.x - take the year from date type in a pandas dataframe column -

this question has answer here: python pandas extract year datetime — df['year'] = df['date'].year not working 3 answers i have year data in pandas dataframe following: 0 06/09/1937 1 22/11/1972 and extract year data: 0 1937 1 1972 my code: features["year"] = df["birth_date"].str.split('/',2) features["year"] = features["year"][:2] i got error as: valueerror: can tuple-index multiindex then tried features["year"] = [x[2] x in features["year"]] typeerror: 'float' object not subscriptable i use python 3. tell me reasons these 2 errors , how correct them? in advance. you need: features["year"] = df["birth_date"].str.split('/',2) features["year"] = features["year"].str[:2]

how to write header content type json data to csv file in php? -

we have been working 3d cart rest response have here code.file name example.php located in wamp server <?php $host = 'https://apirest.3dcart.com'; $version = 1; $service = 'orders'; $secureurl = 'https://xxxxyyyyy.3dcart.net'; // secure url set in settings->general->storesettings $privatekey = 'xxxxxxxxxxxxxxxx'; // private key obtained when registering app @ http://devportal.3dcart.com $token = 'xxxxxxxxxxxxx'; // token generated when customer authorizes app // initialize curl session $ch = curl_init($host . '/3dcartwebapi/v' . $version . '/' . $service); // set headers $httpheader = array( 'content-type: application/json;charset=utf-8', 'accept: application/json', 'secureurl: ' . $secureurl, 'privatekey: ' . $privatekey, 'token: ' . $token, ); curl_setopt($ch, curlopt_httpheader, $httpheader); // [ ... addtional curl options ne

internet explorer - How do I set "user agent string" using code in IE -

my applet gets loaded in ie 11 default behavior. when use meta tag , change render in ie 10, not load properly. reason being meta tag has changed document mode of ie 10 still “user agent string” pointing ie 11. when manually changed “user agent string” ie 10 works fine again. so there way specify user agent string document mode in html? in advance! no. there no public api changing ie user-agent (ua) string @ run-time. if use emulation tab of f12 tools , can temporarily change user-agent string, that's temporary solution, ua string resets when page refreshes. the ua string change when switch enterprise mode ie , however, result isn't entirely under control. because result showcases ie8-era ua string, may not give need. at 1 time, change ua string through registry , it's unclear whether still works. (that article first written ie7 , later superseded this article .) bottom line: best way ensure results you're looking update solution no longer re

javascript - jquery countdown timer starting timer from 2hrs countdown -

i have jquery script countdown showing days, hours, minutes, , seconds. now want remove days script , should start countdown 2 hours. haven't been able accomplish this. here's code: <p id="demo"></p> <script> // set date we're counting down var countdowndate = new date("jan 5, 2018 15:37:25").gettime(); // update count down every 1 second var x = setinterval(function () { // todays date , time var = new date().gettime(); // find distance between count down date var distance = countdowndate - now; // time calculations days, hours, minutes , seconds var days = math.floor(distance / (1000 * 60 * 60 * 24)); var hours = math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = math.floor((distance % (1000 * 60)) / 1000); // display result i

c# - AvalonEdit : Tab Key Handling -

i using avalonedit custom control. wan move focus previous or next element. textarea.movefocus(new traversalrequest(focusnavigationdirection.next)) works. textarea.movefocus(new traversalrequest(focusnavigationdirection.previous)) does not works.

c# - Attempted to read or write protected memory on DAQ -

i trying program icp das daq dio-24 following code. class dio class dio { #region dio public const short dio_noerror = 0; public const short dio_driveropenerror = 1; public const short dio_drivernoopen = 2; public const short dio_getdriverversionerror = 3; public const short dio_installirqerror = 4; public const short dio_clearintcounterror = 5; public const short dio_getintcounterror = 6; public const short dio_reseterror = 7; public const short dio_removeirqerror = 8; public const short dio_gettotalboarderror = 9; public const short dio_cardnotfound = 10; public const short dio_getconfigerror = 11; public const short dio_exceedboardnumber = 12; // test function [dllimport("dio.dll")] public static extern int dio_shortsub2(int a, int b); [dllimport("dio.dll")] public static extern single