Why is Rails-6.1 loading blank page instead of completing link_to? - ruby-on-rails-6.1

Upgrading rails base to v6.1.7 with ruby v3.1.
This code currently works on existing code:
<%= link_to page.navlabel, :action => page.action_name, :controller => page.controller_name %> and creates a correctly formed tab and link (tab: home, link: localhost:3000/file/home).
Using upgraded rails app., tab and link are still correct. However, when the tab is clicked, a blank page is displayed (although the window selector for safari shows the link and hitting the refresh button does load the page.)
Here is the log file:
=> Booting Puma
=> Rails 6.1.7 application starting in development
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 5.6.5 (ruby 3.1.0-p0) ("Birdie's Version")
* Min threads: 5
* Max threads: 5
* Environment: development
* PID: 64564
* Listening on http://127.0.0.1:3000
* Listening on http://[::1]:3000
Use Ctrl-C to stop
Started GET "/" for ::1 at 2022-11-30 19:19:55 -0800
(0.5ms) SELECT sqlite_version(*)
(0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
Started GET "/file/home" for ::1 at 2022-11-30 19:19:55 -0800
Processing by FileController#home as HTML
Page Load (0.2ms) select * from pages where parent_id is NULL and accs_level = 0;
↳ app/models/page.rb:7:in `find_public'
Rendering layout layouts/application.html.erb
Rendering file/home.html.erb within layouts/application
Rendered file/home.html.erb within layouts/application (Duration: 6.9ms | Allocations: 10863)
[Webpacker] Everything's up-to-date. Nothing to do
Rendered layout layouts/application.html.erb (Duration: 13.6ms | Allocations: 22105)
Completed 200 OK in 28ms (Views: 14.9ms | ActiveRecord: 0.6ms | Allocations: 39198)
Started GET "/file/design" for ::1 at 2022-11-30 19:20:00 -0800
Processing by FileController#design as HTML
Page Load (0.3ms) select * from pages where parent_id is NULL and accs_level = 0;
↳ app/models/page.rb:7:in `find_public'
Rendering layout layouts/application.html.erb
Rendering file/design.html.erb within layouts/application
Rendered file/design.html.erb within layouts/application (Duration: 2.7ms | Allocations: 1473)
[Webpacker] Everything's up-to-date. Nothing to do
Rendered layout layouts/application.html.erb (Duration: 19.5ms | Allocations: 10289)
Completed 200 OK in 24ms (Views: 20.2ms | ActiveRecord: 0.3ms | Allocations: 11904)
Started GET "/file/design" for ::1 at 2022-11-30 19:20:05 -0800
Processing by FileController#design as HTML
Page Load (0.7ms) select * from pages where parent_id is NULL and accs_level = 0;
↳ app/models/page.rb:7:in `find_public'
Rendering layout layouts/application.html.erb
Rendering file/design.html.erb within layouts/application
Rendered file/design.html.erb within layouts/application (Duration: 3.2ms | Allocations: 1183)
[Webpacker] Everything's up-to-date. Nothing to do
Rendered layout layouts/application.html.erb (Duration: 19.8ms | Allocations: 9918)
Completed 200 OK in 25ms (Views: 20.4ms | ActiveRecord: 0.7ms | Allocations: 11162)
Note that other than about 6ms in the Completed 200 OK line, both loads (first via tab click) second by clicking refresh seem to be the same.
I really do not understand what to do/check next. Any guidance would be greatly appreciated.

Problem appears to be a javascript call used by google analytics to track the application. The script was located (before I removed the code) in the '/views/layouts/application.html.erb' file. I think the javascript needs to be updated for the new filename?? Anyway, when that script is removed, tabbed pages open as expected.
I will have to research google analytics later.

Related

Save data in redis, docker

I am using docker-compose for my application. Few services to name are web, celery, redis etc.
I need to store the settings selected by user for eg
- app theme (can be light or dark)
- component: switch/ radio button
- app user defaults (eg country etc)
- component: dropdowns
I am saving these setting in redis database. so that when user visits again all custom preferences are loaded for the given user. These are individual component (no form is used), so as user click on any component respective set_function() is called. for eg
def my_baz(value):
"""Used to store app theme."""
k = "key"
v = value
r = redis.StrictRedis.from_url(some_url)
r.set(k,v)
r.bgsave()
def my_bar(value):
"""Used to store app country."""
k = "key"
v = value
r = redis.StrictRedis.from_url(some_url)
r.set(k,v)
r.bgsave()
During docker-compose up, I observed below error and then in the end all services gets up.
The error is occuring due to r.bgsave()
web | some messages till now no error
redis | 1:M 31 Jan 2023 20:46:43.231 * Background saving started by pid 13
web | status = initialize_base_settings() // this function sets some key-value pair using r.set(k,v) and saves it in redis using r.bgsave()
web | ^^^^^^^^^^^^^^^^^
redis | 13:C 31 Jan 2023 20:46:43.284 * DB saved on disk
redis | 13:C 31 Jan 2023 20:46:43.284 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB
redis | 1:M 31 Jan 2023 20:46:43.329 * Background saving terminated with success
web | raise response
web | redis.exceptions.ResponseError: Background save already in progress
celery | some messages
redis | 1:M 31 Jan 2023 20:46:44.301 * Background saving started by pid 14
redis | 14:C 31 Jan 2023 20:46:44.307 * DB saved on disk
redis | 14:C 31 Jan 2023 20:46:44.308 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB
celery | raise response
celery | redis.exceptions.ResponseError: Background save already in progress
.
.
few message lines // services restarted again
redis | Finally UP
web | Finally UP
celery | Finally UP
If I remove the r.bgsave() no error occurs during docker-compose up, but this way I will not be able to save the user setting in redis.
So, where should I call r.bgsave() in the app or is there any other setting I can use to save settings in redis?

Why is the generation of my TYPO3 documentation failing without a proper error?

I have a new laptop and I try to render the Changelogs of TYPO3 locally based on the steps on https://docs.typo3.org/m/typo3/docs-how-to-document/master/en-us/RenderingDocs/Quickstart.html#render-documenation-with-docker. It continues until the end but show some non-zero exit codes at the end.
project : 0.0.0 : Makedir
makedir /ALL/Makedir
2021-02-16 10:32:50 654198, took: 173.34 seconds, toolchain: RenderDocumentation
REBUILD_NEEDED because of change, age 448186.6 of 168.0 hours, 18674.4 of 7.0 days
OK:
------------------------------------------------
FINAL STATUS is: FAILURE (exitcode 255)
because HTML builder failed
------------------------------------------------
exitcode: 0 39 ms
When I run the command in another documentation project, it renders just fine.
I found the issue with this. It seemed the docker container did not have enough memory allocated. I changed the available memory from 2 Gb to 4 Gb in Docker Desktop and this issue is solved with that.
You already solved the problem. But in case of similar errors: To get more information on a failure, you can also use this trick:
Create a directory tmp-GENERATED-temp before rendering. Usually, this is automatically created and then removedd after rendering. If you create it before rendering, you will find logfiles with more details in this directory.
See the Troubleshooting page.
I had some errors where I found the output in the console insufficient and this helped me to narrow down the problem.
In case of other problems, I would file an issue in the GitHub repo: https://github.com/t3docs/docker-render-documentation
Note: This is specific to TYPO3 docs rendering and may change in the future.

Solaris svcs command shows wrong status

I have freshly installed an application on solaris 5.10 . When checked through ps -ef | grep hyperic | grep agent, process are up and running . When checked the status through svcs hyperic-agent command, the output shows that the agent is in maintenance mode . Application is working fine and I dont have any issues with the application . Please help
There are several reasons that lead to that behavior:
Starter (start/exec property of service) returned status that is different from SMF_EXIT_OK (zero). Than you may check logs:
# svcs -x ssh
...
See: /var/svc/log/network-ssh:default.log
If you check logs, you may see following messages that means, starter script failed or incorrectly written:
[ Aug 11 18:40:30 Method "start" exited with status 96 ]
Another reason for such behavior is that service faults during while its working (i.e. one of processes coredumps or receives kill signal or all processes exits) as described here: https://blogs.oracle.com/lianep/entry/smf_5_fault_retry_models
The actual system that provides SMF facilities for monitoring that is System Contracts. You may determine contract ID of online service with svcs -v (field CTID):
# svcs -vp svc:/network/smtp:sendmail
STATE NSTATE STIME CTID FMRI
online - Apr_14 68 svc:/network/smtp:sendmail
Apr_14 1679 sendmail
Apr_14 1681 sendmail
Than watch events with ctwatch:
# ctwatch 68
CTID EVID CRIT ACK CTTYPE SUMMARY
68 28 crit no process contract empty
Than there are two options to handle that:
There is a real problem with service so it eventually faults. Than debug the application.
It is normal behavior of service, so you should edit and re-import your service manifest, to make SMF less paranoid. I.e. configure ignore_error and duration properties.

Today widget doesn't work outside Xcode

I successfully got a Today widget working in my iOS app. It works great when running the widget on the simulator or running on a device from Xcode. But it doesn't update if I install the app on a device and then run the widget (not from Xcode).
Has anyone else faced this issue? Is there a fix to this or is this a known bug? Any workarounds so I can have a bunch of beta testers check the app using Testflight and get the widget to work?
Using Xcode version 6.1.
Adding log statements tells me that all the correct methods are called. But after that a crash log is generated and the logs are very cryptic. This is what the console says
Dec 1 19:23:06 MyDevice ReportCrash[3592] <Error>: task_set_exception_ports(B07, 400, D03, 0, 0) failed with error (4: (os/kern) invalid argument)
Dec 1 19:23:06 MyDevice ReportCrash[3592] <Notice>: ReportCrash acting against PID 3591
Dec 1 19:23:06 MyDevice ReportCrash[3592] <Notice>: Formulating crash report for process MyTest[3591]
Dec 1 19:23:06 MyDevice SpringBoard[48] <Warning>: plugin com.testsaga.MyTest-Today interrupted
And a device log generated during this time lists this statement (specific to my widget - there are other processes in there as well)
Processes Name | <UUID> | CPU Time| rpages| purgeable| recent_max| lifetime_max| fds | [reason] | (state)
MyTest <84554d9818fe3e1fafa848c3fe6a34d5> 1.459 4132 0 - 8076 50 [per-process-limit] (frontmost)
Any insights? Thanks.
**I tried the answer here but it doesn't work for me.

How to scrape Facebook advertising data?

Facebook provides data about demographics via their advertising platform. How to scrape it (using Python)?
1.) go to http://www.facebook.com/ads/create/
2.) fill in the forms
3.) now, there is data
See sample image: http:// www.webdistortion.com/wp-content/uploads/2010/10/fb4.jpg
(i am a new user, so I can't post a image)
Problem: how to scrape it?
My ideas:
1.) use mechanize - maybe it is possible to fill in the forms, but the estimated number (112,960 in the example) is not visible in the source code and therefore you cannot parse it => we should do some other tricks, but what?
2.) use selenium (or windmill) - my recording was: open facebook.com --> click advertising --> click create ad --> ...
Unfortunately, this already failed. Log:
[info] Executing: |open | / | |
[info] Executing: |clickAndWait | link=Advertising | |
[error] isNewPageLoaded found an old pageLoadError: Error: Permission denied for >> to get property Location.href
[error] Permission denied for to get property Location.href
[info] Executing: |clickAndWait | css=span.uiButtonText | |
[error] Unexpected Exception: fileName -> chrome://selenium-ide/content/selenium-core/scripts/selenium-browserbot.js, lineNumber -> 840
There is evidence that it is possible to scrape this data: http://www.checkfacebook.com/
Solving the problem is more interesting than the data itself (ofc, this data is certainly interesting). I know that there are solutions, but I cannot come up with any. It is killing me, please help.
I'm not quite sure what you mean by scrape data. Do you mean using the public Ads API (https://developers.facebook.com/docs/reference/ads-api/) and calling the reach estimate function (https://developers.facebook.com/docs/reference/ads-api/reachestimate/)?