Posts

javascript - AngularJS modules vs CommonJS/ECMA6 modules -

i've joined ongoing web project frontend written in angular 1 mvc framework , using webpack build system , i'm feeling neo in matrix 2 in stack of nested matrices. the project split separate .js files, each annotated module in either commonjs style (with require , module.exports ) or ecma6 style (with import s , export s). webpack transpiles ecma6 ecma5 babel , creates single bundle them. within commonjs modules reside angularjs modules. living inside commonjs, angular task of dependency injection of own angular's requirejs-esque module system. i'm feeling same job of dependency management done twice. is true, when angular written, angular developers had in mind multi-module angular projects should've been concatenated e.g. grunt concat single bundle , served client, angular $injector responsible dependency management? so, our webpack build over-complication on top of that? example project: file model.module.js : import angular "angular...

python - ScatterPlotItem crashs with 7000 or more points -

i use pyqt5.5.1, python 3.4 (windows 32 & 64 bits), numpy, pyqtgraph (tested develop git branch & lastest official version) here part of code use display scatterplot self.widget1 = pg.graphicslayoutwidget(); self.widget1.hide(); self.p1 = self.widget1.addplot() n = 7300 s1 = pg.scatterplotitem(size=10, pen=pg.mkpen(none), brush=pg.mkbrush(0, 0, 255, 120)) pos = np.random.normal(size=(2,n), scale=1e-5) s1.setdata(pos[0], pos[1]) self.p1.additem(s1) self.widget1.show(); with n = 7, or 73, 730 scatterplot works. but n = 7300 , more, crashs python. i have trace, before crash: qpaintdevice: cannot destroy paint device being painted r6025 - pure virtual function call could me find workaround or fix ? thanks

javascript - How do i make an automated traffic light? -

this question has answer here: how automate javascript/html traffic light sequence using setinterval? 2 answers var red = "#ff0000"; var yellow = "#ffff00"; var green = "#00ff00"; var dark_red = "#380000"; var dark_yellow = "#383800"; var dark_green = "#003800"; var x_all = 150; var y_red = 100; var y_yellow = y_red + 150; var y_green = y_yellow + 150; var trafficlightsstatemachine; function trafficlightsstatemachine() { this.state = 0; this.statemachine = new array(); this.statemachine[0] = function () { drawcircles(dark_red, yellow, dark_green); }; this.statemachine[1] = function () { drawcircles(red, dark_yellow, dark_green); }; this.statemachine[2] = function () { drawcircles(red, yellow, dark_green); }; this.statemachine[3] = function () { drawcircles(dark_red, dark_yell...

android - ExpandableListView not working properly -

i implementing app expandablelistview , fragment , viewpager , collapsingtoolbarlayout . but have problem. expandablelistview has wrong behavior. remaining items below cut. , when click on item below top item displayed behind tablayout. what error in code? thank you main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:fitssystemwindows="true" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.dark.actionbar" android:fitssystemwindows="true"> ...

ios - how to set up something like a collectionview in a tableview? -

Image
here visual example of achieve. my initial idea use uicollectionview custom cells, didn't work out , trying out collectionview within collectionview worse. so tried collectionview in tableview , kind of worked tableviewcell's dynamic height proved gigantic issue super difficult me solve have begun learn swift , ios developing. please :( edit: note "shopping mall 1" section meant sticky header of sort. similar (the turquoise header): credits: https://github.com/jamztang/csstickyheaderflowlayout but using https://github.com/petec-blog/collectionviewstickyheaders example clearer , closer needed. you play around code below idea (xcode 7.2 (7c68)) delete storyboard, launchscreen, clean properties main story board , launchscreen in info.plist , replace appdelegate.swift following content import uikit @uiapplicationmain class appdelegate: uiresponder, uiapplicationdelegate { var window: uiwindow? func application(application: uiapplica...

Creating file using PHP imagepng function in Openshift -

i use imagepng() save image using php. work fine in hosting, can't make work in openshift redhat. imagepng($rimg, 'myimg.png'); i tried save directory , give permissions ( chmod 777 ) directory didn't help. tried add prefix of dirname(__file__) path didn't work , can't create image file. know file has not been created because searched in server , didn't find anything. there way create image file using imagepng() in openshift?

Android Button default state -

why button's default behaviour state_activated="false"? using selector never reaches last row, stays on second line: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@color/colorprimary" android:state_enabled="false"/> <item android:drawable="@color/colorprimarydark" android:state_activated="false"/> <item android:drawable="@color/coloraccent"/> let's selector shared amongst buttons , layouts pose button, in layout's case, setactivated(false) needed change background. the default state of activated false views. easiest way understand why consider case of tabs on viewpager. the activated tab 1 represents visible page - doesn't make sense multiple tabs activated @ same time. i mentioned in blog post activated described "selected" didn't know terms android used.