Posts

Showing posts from August, 2015

New to Java: Install Gson from Github?? Eclipse -

i'm starting learn java , need gson new project i'm working on. i feel i'm missing installation instructions find online--all of them refer 3 jar files should able extract zip file. when @ gson on github can't find .jar files! https://github.com/google/gson once find jar files, i'm supposed include them in buildpath project i'm working on right? i'm working on project using eclipse. can me simple step-by-step explanation of how start including these libraries complete noob programming me? also, once include .jar files in buildpath project, can call functions? thanks! simple put jar files in project lib folder right click on project->properties-> java build path->libraries , can download gson here if looking specific version please add in question http://www.java2s.com/code/jar/g/downloadgson222jar.htm

html - How to set block display of inline elements in shadow root -

i have few <p> tag in shadow root,they inline codes. when tried style them display:block each. , failed. how set them 1 item below other? thanks. code have used: polyfill-next-selector{content: '.card-header #phone';} .card-header ::content #phone { display:block; font-size: 0.7rem; } polyfill-next-selector{content: '.card-header #building';} .card-header ::content #building { display:block; font-size: 0.7rem; } polyfill-next-selector{content: '.card-header #office';} .card-header ::content #office { display:block; font-size: 0.7rem; } polyfill-next-selector{content: '.card-header #skype';} .card-header ::content #skype { display:block; font-size: 0.7rem; } polyfill-next-selector{content: '.card-header #computername';} .card-header ::content #computername { display:block; font-size: 0.7rem; } polyfill-next-selector{content: '.card-header #businessmobile';} .card-header ::content #businessmobile { ...

java - Adding new line in string in JSP -

i'm trying pass string request attribute jsp. reuqest.setattriute("string", xml); the string comes xml file parsed using following code: document doc = dbuilder.parse(fxmlfile); domimplementationls domimplementation = (domimplementationls) doc.getimplementation(); lsserializer lsserializer = domimplementation.createlsserializer(); string string= lsserializer.writetostring(doc); when put string on console, can see nice formatted output (exactly in xml file, new lines kept). when i'm trying display string in jsp, observe not formatted code, string not tarnsform new line signs. this code jsp: i trying use fn:replac e function, did not work (i trying transform 'a' latter instead of '\n' tests ommit problems special characters). can see <br /> tags in displayed string not transformed new lines. <c:set var="string2" value='${fn:replace(string, "a", "<br />")}' /> when di...

java - Enabling and Disabling JCheckBox's depending on JComboBox.SelectedItem -

ok have panel containing 12 jcheckbox's, upon interface loading of jcheckbox's disabled. when user selects option jcombobox want jcheckbox's enabled depending on item selected in jcombobox. at moment in jcomboboxactionperformed enabling of jcheckboxes relevant selection prior doing attempting disable buttons enabled (in case selected item in jcombobox changed). the code have disable enabled buttons follows: public void disableboxes() { (jcheckbox j : arrayofjcheckbox) { if (j.isenabled()) { j.setenabled(false); } } } this not anything, if remove call method jcomboboxactionperformed method jcheckbox's enable expect. leading me assume problem lies code. furthermore creating arrayofjcheckbox manually, wondering if there way maybe adding getting of jcheckbox's inside panel , adding them list? if possible possible iterate through list attempting do? thanks help! dean you state: ok have panel containin...

javascript - s.tl() call not setting eVar -

i trying s.tl() pass evar call firing without passing evar , can't work out why, have used same code via load rule on same page works. working code settimeout(function(){ s.linktrackvars='evar17'; s.evar17 = _satellite.data.customvars.hl_ab; s.tl(true,'o','hook logic'); },5000); non working code settimeout(function(){ s.linktrackvars='evar38'; s.evar38 = _satellite.data.customvars.goog_as; s.tl(true,'o','adsense tracking'); }, 5000); i have tried send data on context data, changed js var instead of dtm var nothing, if s.linktrackvar line being treated blank, if var empty still set null. however getting var return in console, added timeout make sure available when call runs. any ideas? in test pixel isn't showing evar38, _satellite.data.customvars.goog_as not either undefined or empty? i'd suggest add following settimeout function before s.tl: _satellite.notify("goog_as custome var...

java - Protected access modifier use on Class's Constructor -

i clear using private, default , public access modifiers on public class's constructor. if constructor private, class object can created in class only. if constructor default, class object can created in package's classes only. if constructor public, class object can created in class. i not clear protected constructor. example: default constructor package com.test; public class practiceparent { practiceparent(){ //constructor default access modifier system.out.println("practiceparent default constructor"); } } package com.moretest; import com.test.practiceparent; public class test extends practiceparent { //error. implicit super constructor practiceparent() not visible default constructor. must define explicit constructor public static void main(string[] args) { practiceparent pp=new practiceparent(); //error. constructor practiceparent() not visible } } i understand these errors. since parentpractice class...

c# - Splitting on multiple characters at once -

i know possible split string on character like: string[] s = somestring.split(','); if know format of strings going comma delimited, or new line delimited, can handle both of these once? can both done @ once? i.e: a, b, c, d, e, f, g or: a b c d e or: a, b, c, d, e f how can split on multiple characters @ once? the string split () method takes has override accepts array of characters split on. string[] s = somestring.split(new [] { ',', '\n' }); also, optional parameter stringsplitoptions value. allows specify if you'd remove blank/empty entries.

android - How do i access a included layout in my code? -

so have included layout in xml file want included layout in code , add it. you view s using findviewbyid() but don't think can used in case. part of xml referring <include android:layout_width="350dp" android:layout_height="wrap_content" layout="@layout/progress_bar" android:layout_margintop="20dp" android:layout_below="@+id/instructions_label" android:layout_centerhorizontal="true" /> you views using 'findviewbyid' but don't think can used in case sure can. give included layout id <include layout=@layout/somelayout android:id="@+id/myid" .../> then retrieve id view mylayout = (view) findviewbyid(r.id.myid); then can use reference sub views somelayout.xml button btn = (button) mylayout.findviewbyid(r.id.btn1) assuming somelayout.xml has button id of btn1

c# - Controller action not grabbing file from view when attempting to upload -

i trying upload .csv file sql database, controller action not seem grabbing file @ all. check out code, must missing piece: view: @using (html.beginform("uploadvalidationtable", "home", formmethod.post)) { <table style="margin-top: 150px;"> <tr> <td> <label for="csvfile">filename:</label> </td> <td> <input type="file" name="csvfile" id="csvfile"/> </td> <td><input type="submit" value="upload"/></td> </tr> </table> } controller: [httppost] public jsonresult uploadvalidationtable(httppostedfilebase csvfile) { var inputfiledescription = new csvfiledescription { separatorchar = ',', firstlinehascolumnnames = true }; var cc = new csvcontext(); var filepath ...

javascript - How to set $http.error() in angular throughout all $http calls? -

how go setting function .error calls $http service wherever used. throughout app have used many $http calls wrapped in service , avoid duplication of implementing .error methods. e.g. posttest: function (data) { var url = '/test'; return $http({ method: 'post', url: url, data: data }). success(function (data) { return data; }). error(function (status) { //avoid duplication of throughout $http calls. if (status === 404) {} return status; }); } you create , interceptor catch errors so var applicationwideinterceptors = function ($q, toastrsrvc) { return { responseerror:function(rejection) { //do rejection if (rejection.status === 404) { toastrsrvc.error(rejection.data); } return $q.reject(rejection); ...

date - Elasticsearch - Incoming birthdays -

i'm new elasticsearch , i'm stuck query. i want next (now+3d) birthdays among users. looks simple it's not because have birthdate of users. how can compare months , day directly in query when have birthdate (eg: 1984-04-15 or 2015-04-15 sometimes) ? my field mapping: "birthdate": { "format": "dateoptionaltime", "type": "date" } my actual query doesn't work @ all: { "query": { "range": { "birthdate": { "format": "dd-mm", "gte": "now", "lte": "now+3d" } } } } i saw post elasticsearch filtering part of date i'm not big fan of solution, , prefer instead of wilcard "now+3d" maybe can do script ? "format" field added in 1.5.0 version of elasticsearch. if version below 1.5.0 format not work. had same proble...

ios - Cache static function result in Swift? -

i have static function generates uicolor object can reused several times throughout application. don't want code run every time, first time , place cache, let subsequent retrieval grab cache. caveat value can change don't want permanently persist value, persist memory if app restarted, grab latest value , use throughout lifecycle. here function looks like: class appconfig: nsobject { static func getglobaltintcolor(alpha: float = 1) -> uicolor! { let colors = split(somevarfrominfoplist) { $0 == "," } let red = cgfloat(colors[0].toint() ?? 0) / cgfloat(255) let green = cgfloat(colors[1].toint() ?? 0) / cgfloat(255) let blue = cgfloat(colors[2].toint() ?? 0) / cgfloat(255) return uicolor(red: red, green: green, blue: blue, alpha: cgfloat(alpha)) } } i don't want getglobaltintcolor run logic every time. how cache first time , let served rest of app's lifecycle? you describing static variab...

python - How can I debug Openstack Dashboard? -

Image
i'm running openstack cloud system. installed , deployed kilo version on server successful, default version of openstack. that, want have modifies on openstack source , add more features it. i started change openstack dashboard. however, there problems happened. therefore, have debugged django web application. have configured same official tutorials on openstack website ( http://docs.openstack.org ). so, have search on server , find out 2 places have sources: the first 1 /usr/share/openstack-dashboard/ the second 1 /usr/lib/python2.7/dist-packages/horizon/ and config file /etc/openstack-dashboard/local_settings.py i set option debug = true in local_settings.py file. on server typed these commands: cd /usr/share/openstack-dashboard/ python manage.py runserver here output: removedindjango18warning: xviewmiddleware has been moved django.contrib.admindocs.middleware. warning:py.warnings:removedindjango18warning: xviewmiddleware has been moved django.contrib.adm...

triggers - Android app to check for login only one time a day -

i need develop android app have login activity force user must login 1 time day , after login app not going show login activity.it want skip login if user done login successful.on next day app must want show login page.can use shared preferences method or database here? how can implement this! you can use calendar instance on splash or main activity , can save in shared preference save date below-- //this reference code sharedpreference shared=getsharedpreferences(preference.key_pref,mode_private); editor edit=shared.edit(); if(!shared.getboolean(preference.key_first_time, false)){ edit.putboolean(preference.key_first_time,true ); calendar first=calendar.getinstance(); edit.putlong(preference.key_first_date, first.get(calendar.date);); 1>this can stored last launching date 2>get current date every time app starts , check if current date = last launching date 3>if same no need show login else show login , sa...

java - Silently stopping Liquibase at mid-update -

is there way can cancel liquibase update after started it? i've list around 5000 changesets, , need prevent changesets specific point forward, not executed if specific condition occurs in 1 of scripts. since putting < preconditions > in of existing scripts, , new ones created until end of days, not doable approach, looking alternative , tried following: created < customchange > , throw exception created invalid < sql > statement added < stop /> in < changeset > all cases work, throw thousands of log lines (that can't have), because need silent stop . since creating include changelog file dynamically (for smaller changelogs) simple iterate smaller changelog files until reach file each things can executed or not. execute query check specific condition, , if ran ok, create dynamic changelog file remaining changelogs.

updating access database record with form -

i need creating access database record hours worked / amount charged employee. simplified, each employee charges hours specified work codes. pull report lists codes , amount of dollars available charge to. report uploaded access 2007 work_codes_table . data in report cannot modified. i need create form shows available work codes , allows employee enter amount charge each separate code. data saved employee_hours_table , leaving original data unchanged. want save data future reference. right have work_codes_table setup correct , split form shows of active work codes, stuck on next piece.

jquery - Active menu Changer on Sticky Bar -

i have designed parallax page sticky menu bar. need change active menu on scrolling. have made change active class on click event. need scroll event. here html code <div class="main-menu"> <ul> <li><a class="active" href="#" data-delay="2000" data-appear="false" data-scrollto="#intro-slideshow">home</a></li> <li><a href="#" data-delay="2000" data-appear="false" data-scrollto="#overview">features</a></li> <li><a href="#" data-delay="2000" data-appear="false" data-scrollto="#categories">categories</a></li> <li><a href="#" data-delay="2000" data-appear="false" data-scrollto="#contact">contact us</a></li> </ul> </div> here jquery c...

angularjs - Angular - Displaying an object using a dynamic variable? -

i have following code: {{ currentproductdetails.metadata.spec_category_0_spec_image }} but need 0 reference variable. this: {{ currentproductdetails.metadata.spec_category_{{ configview }}_spec_image }} but doesn't work. there way can accomplish this? thanks. you need use bracket notation here: {{ currentproductdetails.metadata['spec_category_' + configview + '_spec_image'] }} think of currentproductdetails.metadata object, , 'spec_category_' + configview + '_spec_image' construct dynamic property key of it.

django - Filtering Objects in Database by Keyword -

i using django 1.8.3 , python 3.4.3 i try explain makes sense, please bear me. i've imported csv file database 50 rows , 10 columns of data, consists of data pulled google analytics , our email marketing campaign data. 1 of columns 'day_of_week'. need count of database rows have keyword of day need...the way can figure out how code below, man, sure seems more dynamic , cleaner. is there way filter in way can use tag in template, or cleaner this? thank help. class emaillistview(listview): model = email template_name = 'dashboard/pages/email.html' def get_context_data(self, **kwargs): context = super(emaillistview, self).get_context_data(**kwargs) days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'] months = ['january', 'february', 'march', 'april', 'may', 'june', 'july', ...

Windows 10 - WAMP Orange -

i've installed wamp 64bit server on windows 10 enterprise machine. i'm getting orange icon. i've checked following: apache -> service, start/resume service greyed out , stop service red. in addition test port 80 gives me: your port 80 used : server: apache/2.4.9 (win64) php/5.5.12 mysql -> service, start/resume service green. when click on nothing happens. i've tried turning off windows firewall, nothing happens. i've checked skype not installed on machine. tried netstat-b in command prompt , can't see port 80 searched mysql-bin.index delete nothing came up. any on can try next grateful. thanks update following riggsfolly advice below erros getting mysql via windows event logger: 2015-08-08 08:31:08 7024 [note] plugin 'federated' disabled. 2015-08-08 08:31:08 18ec innodb: warning: using innodb_additional_mem_pool_size deprecated. option may removed in future releases, option innodb_use_sys_malloc , innodb's internal m...

How to export a table to excel with JavaScript? -

i've feeling more simpler imagine be... i'm trying create button on webpage exports table ms excel or other spreadsheet software. well, it's not strictly table ul of list items (in place of rows) contain divs (in place of table data cells). tried several things. solutions i've used far don't error per se, , seem retrieve data want them retrieve. don't work d: $('.export-to-excel').click(_.bind(function(e){ var = $('<a/>').appendto('.contents'); var table = $('mytable'); var table_rows = $('mytable').find('li.rows'); var data_type = 'data:application/csv;charset=utf-8'; a.href = data_type + ', ' + table_rows; a.download = 'exported_table_' + '.xls'; a.click(); e.preventdefault(); }, this)); and several other things. shortest far. you can't create file javascript. well, can read , manipulate it, it's not crossbrowser ( http:/...

android - Appengine connection time out error -

Image
i have been trying create app engine module using java.it has been working .but start show error error:execution failed task ':backend:appengineendpointsgetclientlibs'.there error running endpoints command get-client-lib: connect timed out my stack trace is failure: build failed exception. * went wrong: execution failed task ':backend:appengineendpointsgetclientlibs'. > there error running endpoints command get-client-lib: connect timed out * try: run --info or --debug option more log output. * exception is: org.gradle.api.tasks.taskexecutionexception: execution failed task ':backend:appengineendpointsgetclientlibs'. @ org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.executeactions(executeactionstaskexecuter.java:69) @ org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.execute(executeactionstaskexecuter.java:46) caused by: org.gradle.api.gradleexception: there error running endpoints command get-...

html - ngRepeat by grouping the same property w/o another library -

i have series of objects properties, of them have same value in property called "region". group these objects region property (i.e. if in same region, group them together), , display many regions there these objects in different tables. cannot figure out how in ng-repeat. here example of list of objects: [{"name": 000, "region": cus, "weight": 1}, {"name": 001, "region": cus, "weight": 2}, {"name": 003, "region": wus, "weight": 2}] the goal ng-repeat on table tag tables produced regions "cus" , "wus," 2 tables 000 , 001 in cus table , 002 in wus table. for reasons not explain here, prefer not use library angularjs achieve desired result. many of suggested groupby property can added there way native angular code? thanks help. angular.module('app',['angular.filter']) function main($scope) { var = [{"name": 000, ...

Python 3: List index out of range -

every time run command, can't through of cards without having error; indexerror : list index out of range. import random cards = ['2', '2', '2', '2', '3', '3', '3', '3', '4', '4', '4', '4', '5', '5', '5', '5', '6', '6', '6', '6', '7', '7', '7', '7', '8', '8', '8', '8', '9', '9', '9', '9', '10', ',10', '10', '10', 'j', 'j', 'j', 'j', 'q', 'q', 'q', 'q', 'k', 'k', 'k', 'k', 'a', 'a', 'a', 'a'] randomness = 51 while true: cardindex = random.randint(0, randomness) del cards[cardindex] randomness = randomness -1 print(cards[cardindex]) print ca...

uicollectionviewlayout - Remove Oscillation from UIAttachmentBehavior in UICollectionView -

i attempting recreate spring behavior see in ios messages app in uicollectionview . messages have various cell sizes based on text size. have created custom uicollectionviewflowlayout add behavior uicollectionview message bubbles continue oscillate after user has stopped scrolling. have tried number of combinations in length , damping , spring values oscillation never goes away. after reading of other stack questions did find comment in order prevent oscillation it's necessary dynamically increase damping factor on quadratic scale attached views closer , closer attachment points. < but not sure started implementing on have. or guidance appreciated. below code on uicollectionviewflowlayout creating current effect. - (void) preparelayout { [super preparelayout]; cgrect originalrect = (cgrect){.origin = self.collectionview.bounds.origin, .size = self.collectionview.frame.size}; cgrect visiblerect = cgrectinset(originalrect, -50, -50); nsarray *itemsinvisibl...

asp.net - How to handle or check User Control postback in Parent page? -

Image
i have checkbox in user control. how disable parent control's event when user control's checkbox's checkedchanged event triggered? you cannot disable events asp.net life cycle. however, can check inside each event whether postback triggered parent or user control. if want check control fire event inside parent page - public partial class default : page { protected void page_load(object sender, eventargs e) { if (ispostback) { string id = request.form["__eventtarget"]; if (!string.isnullorwhitespace(id) && id.contains("webusercontrol11")) { } } } } if want check whether event fired 1 of control inside usercontrol - public partial class webusercontrol1 : system.web.ui.usercontrol { protected void page_load(object sender, eventargs e) { if (ispostback) // *** ispostback not same parent's ispostback *** { ...

Entity Framework 6.0 With MySQL and Automatic Migration enabled Error:- RenameIndexOperation exception -

our application uses entity framework 6.0 automatic migration enabled , our back-end in mysql. when rename foreign key different name, migration failed error renameindexoperation . any solution fix error , other expected errors can happened on mysql when automatic migration enabled? you have upgrade mysql server 5.7 have implemented rename index in it

Disable Spring AOP MethodSecurityInterceptor when using AspectJ CTW -

i have project uses spring security , making of aspectj compile time weaving (ctw) weave in spring-security-aspects . allows me use annotations such @preauthorize in non-spring managed classes (which works fine) i'm having problems spring managed classes now. i have controller (annotated @controller ) method: @requestmapping("/test") @preauthorize("hasrole('user')") public string test() { return "test"; } this seem work fine except spring still seems proxying controller bean , hitting methodsecurityinterceptor . means hasrole() method gets hit twice, once proxy , second time aspectj woven code. i using @enableautoconfiguration , have global method security enabled @enableglobalmethodsecurity(prepostenabled = true, mode = advicemode.aspectj) . suspect in configuration messing things up, bit more knowledge of spring security or spring aop know might going on here? the controller has been woven aspectj code it's visible in...

php - Serializing and Deserializing in Symfony -

i serializing entities symfony bundle "symfony/serializer". i able encode entity json no problems, having problems deserializing , bringing original form. error receiving is; could not denormalize object of type appbundle:entity, no supporting normalizer found. defaultcontroller.php //create entity serialize $entity = new entity(); $entity->setid(1); $entity->setname('john'); //create serializer serialize entity $encoders = array(new xmlencoder(), new jsonencoder()); $normalizers = array(new objectnormalizer()); $serializer = new serializer($normalizers, $encoders); $jsoncontent = $serializer->serialize($entity, 'json'); var_dump($jsoncontent); // returns string '{"id":1,"name":"john"}' (length=22) << good! //deserialize entity $person = $serializer->deserialize($jsoncontent, 'appbundle:entity', 'json'); //<error here...

javascript - Dropdown-List - Multi-Selection should add text to Textbox in several Lines -

hello everybody! :) i've made easy random drop-down-list on our "price-request-site" items in list sell our customers. http://i.imgur.com/qg5jj0p.jpg , because need request prices items, can select 1 or more items dropdown-list , output goes "simple textbox" you have select 1 or more items dropdown-list , javascript should "paste" selected list-items textbox. textbox part of "formular" send textbox-input e-mail. my javascript following @ moment: if click item list, item-name appears in text-box in first line. if click second or/and item, javascript overwrite existing "item/textline" first line in textbox. http://i.imgur.com/9doy7cs.jpg " i need following solution javascript , should easy possible: when click item list, should added second line, when click item, should added in next (3rd) line... background-information: script should make easier customer write price-request-email us. (without searching through ...

elasticsearch - elastic search shutting down throws TransportNodesShutdownAction$1$2 not found -

i'm using elastic search 1.1.0. while trying shutdown elastic search i'm getting noclassdeffounderror. code used shutdown , stack trace given below. maven: <dependency> <groupid>org.elasticsearch</groupid> <artifactid>elasticsearch</artifactid> <version>1.1.0</version> </dependency> code: node.client().admin().cluster().preparenodesshutdown().execute().get(); 2015-08-05 21:45:11,113 [thread-15] info org.elasticsearch.action.admin.cluster.node.shutdown internalinfo - [captain ultra] [cluster_shutdown]: done shutting down nodes except master, proceeding master info: illegal access: web application instance has been stopped already. not load org.elasticsearch.action.admin.cluster.node.shutdown.transportnodesshutdownaction$1$2. eventual following stack trace caused error thrown debugging purposes attempt terminate thread caused illegal access, , has no functional impact. ...

javascript - copy JSON files from one dir to another -

in web project have following directory structure |- target |- foo |- bar |- baz i'm trying write grunt task copy json files target directory directory name matches parameter provided build grunt.registertask('flavor', function(srcdir) { var = './' + srcdir + '/*.json'; var dest = './target/'; grunt.file.expand(from).foreach(function(src) { grunt.file.copy(src, dest); }); }); but when call grunt flavor:foo i error warning: unable write "./target/" file (error code: eisdir). use --force continue. as @danielapt mentioned, should use grunt-contrib-copy . build on answer regarding on comment build-parameters, can them task via grunt-option . way one: running different target grunt.initconfig({ copy: { foo: { files: [ { 'expand': 'true', 'cwd': 'foo/', 'src...

Design Pattern for monitoring multiple objects -

i have multi threaded application, 1 thread owns multiple objects - updates them periodically. thread has access these objects , uses operation. pattern suit need? you looking observer pattern in nutshell, - main thread listen 'events' generated sensor threads. so, steps be: a) sensor thread expose method, let main thread register event. use interface approach this. b) data changes within sensor, call method on main thread (note has reference in step a). way, main thread come know time action.

cdf - Gnuplot CCDF plotting and log-log scale -

my data file set of sorted single-column: 1 1 2 2 2 3 ... 999 1000 1000 i able plot cdf using command (assuming 10000 lines in file): plot "file" using 1:(1/10000.) smooth cumulative title "cdf" i able plot logcale of x axis by: set logscale x my problem how can have ccdf plotting gnuplot? in additional, cdf log-log scale (set logscale xy) can not give me output. if have log-log ccdf plotting ? many thanks! i found workaround problem, because not think can plot ccdf using gnuplot. briefly, parsed data using bash create dataset cumulative data explicit; gnuplot may plot new dataset. example, assuming file contains (numerical) values want cumulate, in bash environment: cat data | sort -n | uniq --count | awk 'begin{sum=0}{print $2,$1,sum; sum=sum+$1}' > parsed.dat' this command reads dataset ( cat data ), sorts numerical data using value ( sort -n ), counts occurrences of each sample ( uniq --count ) , creates new data...

python - Slicing a pandas dataframe to the first instance of all columns containing a value -

i have simple pandas time series dataframe similar this: in [69]: df out[69]: b date 2015-01-01 nan nan 2015-02-01 1.1 nan 2015-03-01 nan nan 2015-04-01 1.2 nan 2015-05-01 1.5 1.2 2015-06-01 1.6 1.9 2015-07-01 1.3 nan 2015-08-01 1.2 3.0 2015-09-01 1.1 1.1 what best way obtain data frame first point there value in columns onwards, i.e. output programmatically? in [71]: df.ix[4:] out[71]: b date 2015-05-01 1.5 1.2 2015-06-01 1.6 1.9 2015-07-01 1.3 nan 2015-08-01 1.2 3.0 2015-09-01 1.1 1.1 you can use .first_valid_index() first non-nan index column. # data # ============================ df b date 2015-01-01 nan nan 2015-02-01 1.1 nan 2015-03-01 nan nan 2015-04-01 1.2 nan 2015-05-01 1.5 1.2 2015-06-01 1.6 1.9 2015-07-01 1.3 nan 2015-08-01 1.2 3.0 2015-09-01 1.1 1.1 # processing # ================================ # first valid index each column # , calcula...

wpf - Unable to uninstall with custom WiX installer -

i've created custom wix burn installer using managedbootstrapperapplicationhost wpf frontend (using wix 3.9). the installation of msi works correctly. use mbootstrapperapplication.engine.detect(); determine if msi package present or not. if is, follow flow similar of installation, in order uninstall: mbootstrapperapplication.engine.plan(launchaction.uninstall); once it's in plancomplete event , status == 0 , call mbootstrapperapplication.engine.apply(system.intptr.zero); , applycomplete event status == 0 . unfortunately though, nothing seems have happened @ point. i'm hooked executemsimessage , has no messages coming through. when executebegin is fired, packagecount 0, believe should 1. i can post code if necessary. wxs file looks this: <?xml version="1.0" encoding="utf-8"?> <wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/utilextension" xmlns:b...

java - Hide cursor when keyboard hides -

looked though questions , can't find if there way hide cursor when keyboard hides. there no method(callback) keyboard hides? way documentation says not manner. use edittext.clearfocus() method remove cursor.

c++ - C String while using Bison/Flex -

i'm working on bison/flex project using string i'm not able use methods strlen() (same strcmp etc.) to better explain wrote new short .l , .y files: %{ #include <string> #include "test.tab.h" void yyerror(char*); extern void printvars(); int yyparse(void); char linebuf[500]; %} %option yylineno blanks [ \t\n]+ text [^<>]+ %% \n.* { strncpy(linebuf, yytext+1, sizeof(linebuf)); /* save next line */ yyless(1); /* give \n rescan */ } {blanks} { /* ignore */ }; "<test>" return(start); "</test>" return(stop); "<string>" return(begin_string); "</string>" return(end_string); "<num>" return(begin_num); "</num>" return(end_num); {text} { yylval.str_val=strdup(yytext); return(identifier); } . return yytext[0]; %% ...

c# - CEFSharp Project executable file published by Visual Studio fails -

i trying publish cefsharp project through visual studio 2013 cummunity . .net version used 4.5( tried 4.0 , failed). program can run smoothly under model release 64x model. however, when tried publish an executable format , run it, executable file crashed , got following message error message. problem signature: problem event name: appcrash application name: cefrendertest.exe application version: 1.0.0.0 application timestamp: 55b166ca fault module name: kernelbase.dll fault module version: 6.1.7601.18869 fault module timestamp: 556366fd exception code: e0434352 exception offset: 000000000000b3dd os version: 6.1.7601.2.1.0.256.4 locale id: 1033 additional information 1: 367e additional information 2: 367e805d0e7c1ec3f63b05bb5ce5c416 additional information 3: baed additional information 4: baed2f50fa8c90ffc9d41aca75222fe2 read our privacy statement online: http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409 if onli...

ios - Best approach to cycle through background colors for collection cells in Swift? -

in swift, best approach loop through background colors cells in collection view? know if(indexpath.row % 2 == 0), putting logic in if clause seems clunky if there going more 2 color options. my initial thought put list of colors in array , loop through them. possible loop through array in swift within cellforitematindexpath? there better approach looping through array of background colors?

sql server - Adding extracted columns to a table - SQL -

in database table actors, have 2 feilds: name , salary. 'name' consists of last , first names separated comma , space. trying add 2 more columns: fname , lname, in addition existing columns, , able output these 2 new columns, struggling add these columns actors table. name / salary -> name / salary / fname / lname can please me , let me know how this? thank in advance. here sql commands wrote: select case when name '%,%' substring(name, charindex(',', name)+2, len(name)) else substring(name, 1, len(name)) end fname, case when name '%,%' substring(name, 1, charindex(',', name)-1) end lname actors; don't add new columns table, if these going derived existing column. instead, add computed columns: alter table actors add fname (case when name '%,%' substring(name, charindex(',', name)+2, len(name)) else name ...

.net - Visual C# - Missing partial modifier -

i error saying "missing partial modifier on declaration of type 'projectname.main'; partial declaration of type exists. can read error, because have classes same name. work if modify main class public partial class main : form want know why gives me error. need initializecomponent within main(), tried creating method start() , calling main.start() in load event, form loads blank. namespace projectname { public class main : form { public main() // method: starts main form { initializecomponent(); } public void main_load(object sender, eventargs e) // on load of main class, handle events , arguments { main main = new main(); main.getcurrentdomain(); } public void getcurrentdomain() // method: current domain { domain domain = domain.getcurrentdomain(); } } // ends main class } assuming windows forms app, problem visual s...

osx - Cocoa: determine network availability on wake -

i'm writing cocoa os x application needs perform different actions depending on whether or not there internet connectivity when system wakes sleep. use notification center of nsworkspace.sharedworkspace() receive wake notifications so: nsworkspace.sharedworkspace().notificationcenter.addobserver(self, selector: "onsystemwake:", name: nsworkspacedidwakenotification, object: nil) my problem implementation of onsystemwake: . use reachability sample code query if there internet connectivity when system wakes: @objc func onsystemwake(notif: nsnotification) { let status = internetreachability.currentreachabilitystatus() if status.value == notreachable.value { // internet not reachable, stuff. } else { // internet reachable, other stuff. } } this seems work fine when i'm @ home , put laptop sleep , wake again. however, if laptop switches known wifi during sleep (e.g. when arrive @ university), code above detects there no interne...

braintree - Generate http link for fast payment -

i found tutorial how create page payment s braintree https://developers.braintreepayments.com/javascript+java/start/hello-server i'm interested how can generate link express payment simmilar paypal express checkout using java. i developer @ braintree. should checkout our paypal guide learn how use our api process paypal payments. if have questions, should reach out our support team further assistance.

python 2.7 - User defined SVM kernel with scikit-learn -

i encounter problem when defining kernel myself in scikit-learn. define myself gaussian kernel , able fit svm not use make prediction. more precisely have following code from sklearn.datasets import load_digits sklearn.svm import svc sklearn.utils import shuffle import scipy.sparse sparse import numpy np digits = load_digits(2) x, y = shuffle(digits.data, digits.target) gamma = 1.0 x_train, x_test = x[:100, :], x[100:, :] y_train, y_test = y[:100], y[100:] m1 = svc(kernel='rbf',gamma=1) m1.fit(x_train, y_train) m1.predict(x_test) def my_kernel(x,y): d = x - y c = np.dot(d,d.t) return np.exp(-gamma*c) m2 = svc(kernel=my_kernel) m2.fit(x_train, y_train) m2.predict(x_test) m1 , m2 should same, m2.predict(x_test) return error : operands not broadcast shapes (260,64) (100,64) i don't understand problem. furthermore if x 1 data point, m1.predict(x) gives +1/-1 result, expexcted, m2.predict(x) gives array of +1/-1... no idea why. th...