Extra div causing the image height not scaling properly (display: flex)

Uncategorized
Question: I took the code from here. The code is working well but when I added an extra div to wrap the div with class fullwidth, the images height does not scale equally depending on the height of the screen. This is how it looks originally: body, html { height: 100%; } .fullwidth { display: flex; flex-direction: column; height: 100%; } .repeat-x { flex: 1; background-size: cover; background-repeat: no-repeat; background-position: center center; } .bg-1 { background-image: url(http://oi65.tinypic.com/28v4p6u.jpg); } .bg-2 { background-image: url(http://oi65.tinypic.com/28v4p6u.jpg); } .bg-3 { background-image: url(http://oi65.tinypic.com/28v4p6u.jpg); }       After wrapping fullwidth with another div :- body, html { height: 100%; } .fullwidth { display: flex; flex-direction: column; height: 100%; } .repeat-x { flex: 1; background-size: cover; background-repeat: no-repeat; background-position: center center; } .bg-1 { background-image: url(http://oi65.tinypic.com/28v4p6u.jpg); }…
Read More

postgres query to return some of column value

Uncategorized
Question: I've the following query which return the run time for 1200 videos , i want to get the total of run time in hh:mm:ss:ms select runtime from video where ready_date between '2017-07-01' AND '2017-07-30'; my output will look like "00:00:33:07" "00:00:37:09" "00:01:52:02" "00:00:41:05" i've tried sum(runtime) but looks i'm doing the wrong thing here , any tips ? Answer: one way - cast it to timestamp then to time then to interval, then it will sum up ok, eg_vao=# with video(runtime) as (values('00:00:33:07'),('00:00:37:09'),('00:01:52:02')) select sum(to_timestamp(runtime,'HH24:MI:ss:ms')::time::interval) from video; sum ------------- 00:03:02.18 (1 row) update: In your case would be smth like:select sum(to_timestamp(runtime::text,'HH24:MI:ss:ms')::time::interval) from video where ready_date between '2017-07-01' AND '2017-07-30'; Read more
Read More

Chrome Extension affects another web page

Uncategorized
Question: I am having some problems creating chrome extensions. The code affects all pages that are open in chrome, how can I solve it ? Answer: You need to limit the list of domains your content scripts run on by changing the matches property in content_scripts. Having a "http://*/*","https://*/*" means the content script runs on all http and https websites. Rather you could specify a list of websites that you want the extension to run on. { "manifest_version": 2, "name": "Merch Tools 41studio", "description": "report app", "version": "1.0", "background": { "scripts": ["assets/js/jquery.min.js", "assets/js/background.js"] }, "browser_action": { "default_icon": "assets/image/icon.png", "default_popup": "popup.html" }, "permissions": ["tabs"], "content_scripts": [{ "matches": ["http:/yoursite.com/*"], // Change this to the sites you want your extension to run on "js": ["assets/js/jquery.min.js", "assets/js/highcharts.js"] }] } Read more
Read More

Unable to get the html paths working as desired

Uncategorized
Question: I am developing my first PHP webapp on localhost. I am unable to refer to files in my sub-directories. For example, from any page of my project, if I have to call the following page, the image doesn't appear. Page is Under Construction The error message on Console is UnderConstruction.php:25 GET http://localhost/myProjectRootFolder/images/under-construction.png 404 (Not Found) Answer: could be you need a relative path or and be sure of your real image and pathnames .. Read more
Read More

Collect Lines using Multimap Collector

functional-programming
Question: Is there a way to covert the below to using collectors yet? List lines = getLines(); Multimap multimap = ArrayListMultimap.create(); lines.forEach(line -> multimap.put(line[0],line[1]); ); Answer: You can use Multimaps.toMultimap collector:ListMultimap multimap = lines.stream() .collect(Multimaps.toMultimap( l -> l[0], l -> l[1], ArrayListMultimap::create )); Or if you don't need mutability, use ImmutableListMultimap.toImmutableListMultimap collector:ListMultimap multimap = lines.stream() .collect(toImmutableListMultimap(l -> l[0], l -> l[1])); Read more
Read More

Andriod Exception in share dialog

Uncategorized
Question: 08-15 10:40:19.118 26516-26516/com.example.hp.maps E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.hp.maps, PID: 26516 java.lang.ExceptionInInitializerError at com.example.hp.maps.infoWindow.onCreate(infoWindow.java:79) at android.app.Activity.performCreate(Activity.java:5231) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2151) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2236) at android.app.ActivityThread.access$800(ActivityThread.java:138) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5095) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602) at dalvik.system.NativeStart.main(Native Method) Caused by: The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first. at com.facebook.internal.Validate.sdkInitialized(Validate.java:145) at com.facebook.FacebookSdk.getCallbackRequestCodeOffset(FacebookSdk.java:764) at com.facebook.internal.CallbackManagerImpl$RequestCodeOffset.toRequestCode(CallbackManagerImpl.java:110) at com.facebook.share.widget.ShareDialog.(ShareDialog.java:87) at com.example.hp.maps.infoWindow.onCreate(infoWindow.java:79) at android.app.Activity.performCreate(Activity.java:5231) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2151) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2236) at android.app.ActivityThread.access$800(ActivityThread.java:138) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5095) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602) at dalvik.system.NativeStart.main(Native Method) Answer: Please write a question next time, some code excerpts also make it easier for your question to be answered, please help us help you help us all. As of now…
Read More

How to have dockerized nginx pick up file change from other container

Uncategorized
Question: How can I configure nginx and my client app (ember) to pick up file changes? Edit: I'm thinking that to share a volume, I need to specify volumes that have the same path within the docker-compose file. I have mounted shared volumes (maybe?) between nginx and my frontend application but changes made in the frontend application are not picked up in nginx unless I rebuild the docker containers. I've read a lot of questions and the solutions boil down to a. share volumes (I've done) b. set serve file off in nginx (it is): docker-compose.yml version: "3" services:client:build: "./client" command: npm start env_file:- .env-dev ports:- "4200:4200" - "35730:35730" volumes:- /var/www/app/client - /var/www/app/client/node_modules - .:/client nginx:build: ./nginx env_file: .env-dev volumes:- /var/www/app/nginx depends_on:- client networks:- clientnet ports:- "80:80" networks:clientnet:driver: bridge nginx.conf…
Read More

RecyclerView error ConcurrentModificationException only API 23 & API 26

Uncategorized
Question: I get ConcurrentModificationException in my RecyclerView, only in APIs 23 & 26, how can I bypass this? This is my RecyclerView Setup:private void setUpRecyclerView() { int maxIndex = 0; if (game.size() < 3) { maxIndex = game.size(); } else if (game.size() >= 3) { maxIndex = 3; } recyclerView = findViewById(R.id.home_recycler_view); adapter = new GameCardListMiniAdapter(this, game.subList(0, maxIndex)); recyclerView.setAdapter(adapter); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(ActivityHome.this); linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(linearLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); } after I manipulate the data from game, I call recyclerView.swapAdapter(adapter, true); and get the error, but only in the afore mentioned APIs, in the rest of the APIs up to API 15 everything works just fine. This is the stacktrace for API 23:E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa0d2a5a0 D/AndroidRuntime: Shutting down VM E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.racu.cardgame, PID: 26900 java.util.ConcurrentModificationException…
Read More

AsP.Net MVC 5 how to call a function in view

Uncategorized
Question: I have ASP.Net MVC 5 application I want to call a method from view how can I do it? my code: My UsersList function:public ActionResult UsersList() { var User_VM = new UserVM { MyUsers = context.Users.OrderBy(u => u.Email).Include(u => u.Roles).ToList() }; return View(User_VM); } UsersList View:@foreach(var user in Model.MyUsers) { @user.Email @foreach(var r in user.Roles) { @Html.Action(GetRoleNameById(r.RoleId)) } } and my function in controller: public ActionResult GetRoleNameById(string RoleId) { var RoleName = context.Roles.Where(r => r.Id == RoleId).FirstOrDefault(); return Content(RoleName.ToString()); } Answer: You can call your server method by using the overload of Html.Action() that accepts the action name as the first parameter and the route values as the 2nd parameter @foreach(var r in user.Roles) { @Html.Action("GetRoleNameById", new { roleId = r.RoleId }) } Read more
Read More