问:
saveBackStack FragmentTransactions must use setReorderingAllowed(true). Found BackStackEntry{} that did not use setReorderingAllowed(true)
A HomeActivity class has a bottom menu navigation which opens up a fragment class. Everything is good to navigate inside the fragment class. However, when I click any other bottom menu navigation item from this fragment class, it immediately crashes and results with the below error,

```<code>2022-12-07 10:39:41.828  8956-8956  AndroidRuntime pid-8956
E FATAL EXCEPTION: main Process: com.my.app.debug, PID: 8956

java.lang.IllegalArgumentException: saveBackStack("f1a147ba-4bb3-449c-87b8-cf73f7bf463c") included
FragmentTransactions must use setReorderingAllowed(true) to ensure that the back stack can be
restored as an atomic operation.
Found BackStackEntry{82b1a #1} that did not use setReorderingAllowed(true).

at androidx.fragment.app.FragmentManager.saveBackStackState(FragmentManager.java:2141)
at androidx.fragment.app.FragmentManager$SaveBackStackState.generateOps(FragmentManager.java:3494)
at androidx.fragment.app.FragmentManager.generateOpsForPendingActions(FragmentManager.java:2067)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1757)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:547)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
</code>```

In my fragment class, I tried to return the same view in onCreateView()

```<code>if (fragmentView != null) {
            return fragmentView;
}
</code>```

Also added 'context' in onResume() for my fragment class

```<code>var mContext: FragmentActivity? = FragmentActivity()

mContext = this!!.getActivity() as HomeActivity

mContext.bottomItems()
</code>```

and nothing worked so far. With this log information couldn't find much on where and what exactly went wrong.

I found this Stack overflow link app-crashes-when-tapping-multiple-times-on-bottom-navigation-views that somewhat relates to my issue however the error between mine and this link is different here

```<code>Found BackStackEntry{82b1a #1} that did not use setReorderingAllowed(true).
</code>```

Adding Code
For Understanding, From Home screen user clicks the bottom navigation which shows the FirstFragment screen. The Firstfragment contains few tabviews where you see the SecondFragment information called in observeResponse() method in the class FirstFragment.kt being called will get loaded.

HomeActivity.kt

```<code>class HomeActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedListener {
    private lateinit var navController: NavController
    private lateinit var appBarConfiguration: AppBarConfiguration
    private lateinit var sfHelper: SharedPrefHelper
    private var mCacheManager: CacheManager? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mCacheManager = CacheManager(this)
        sfHelper = SharedPrefHelper(this)

        val mainActivityIntent: Intent = Intent(this, MainActivity::class.java)
        mainActivityIntent.putExtra("navigateScreen", intent.getStringExtra("navigateScreen"))
        startActivity(mainActivityIntent)
        finishAffinity()
        setContentView(R.layout.activity_dashboard)
        try {
          navController = findNavController(R.id.fragment_container)
          appBarConfiguration = AppBarConfiguration.Builder(R.id.homeFragment)
                                .setDrawerLayout(main_drawer_layout)
                                .build()
          if (mCacheManager!!.isShortCut()) {
                    when (mCacheManager!!.getShortCutName()) {
                      "firstFrag" -> {
                                navController.navigate(R.id.homeFragment_to_firstFragment)
                                ClearCache.cacheManagerClear(this)
                      }
                    }
          }
          } catch (e: Exception) {
            }
    }

    private fun setupNavControl() {
        bottom_navigation?.setupWithNavController(navController)
        main_navigation_view?.setupWithNavController(navController)

    }

    private fun showBothNavigation() {
        bottom_navigation?.visibility = View.VISIBLE
        main_navigation_view?.visibility = View.VISIBLE
        main_drawer_layout?.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
        setupNavControl()
    }

    override fun onSupportNavigateUp(): Boolean {
        return NavigationUI.navigateUp(navController, appBarConfiguration)
    }

    override fun onBackPressed() {
        when {
            main_drawer_layout.isDrawerOpen(GravityCompat.START) -> {
                main_drawer_layout.closeDrawer(GravityCompat.START)
            }
            else -> {
                super.onBackPressed()
            }
        }
    }

}

</code>```

HomeFragment.kt

```<code>class HomeFragment : Fragment(), View.OnClickListener {
    private lateinit var appContext: Context
    private var fragmentView: View? = null
    lateinit var sharedPref: SharedPrefHelper

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?

    ): View? {
        if (fragmentView != null) {
            return fragmentView;
        }
        sharedPref = SharedPrefHelper(context as Activity)
        val view: View = layoutInflater.inflate(R.layout.fragment_home, container, false)
        fragmentView = view
        return view
        }
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        loadViewCreated()
    }

    private fun loadViewCreated() {
        try {
            sharedPref = SharedPrefHelper(context as Activity)
            appContext = (context as Activity).applicationContext
            if (user == true) {
                cButton.setOnClickListener(this)
                Glide.with(context as Activity).load(R.drawable.preloader_gif).into(loadingViewHome)
            } else {
                maLogger.info("HomeFragment", "onViewCreated", "MainApplication.model is null")
            }
        } catch (e: Exception) {
            maLogger.error("HomeFragment", "onViewCreated", e.message.toString())
            ExceptionHandler.errorHandle(context as Activity, e.message.toString())
        }
    }

    @SuppressLint("ResourceAsColor")
    override fun onClick(v: View?) {
        when (v!!.id) {
            R.id.cButton -> {
                Navigation.findNavController(v)
                    .navigate(HomeFragmentDirections.homeFragment_to_firstFragment())
            }
        }
    }

    fun observeModel(viewModel: HomeViewModel) {
        viewModel.response.observe(viewLifecycleOwner, Observer {
            it?.let {
                if (activeUser == true) {

                }

            }
       }
    }
}

</code>```

FirstFragment.kt

```<code>class FirstFragment : Fragment(), View.OnClickListener {
    lateinit var cView: View
    private lateinit var cViewModel: CViewModel
    private var isRotating: Boolean = false
    private lateinit var rViewModel: rViewModel
    private lateinit var sfHelper: SharedPrefHelper
    var user = false

    override fun onCreateView(
        inflater: LayoutInflater, @Nullable container: ViewGroup?, @Nullable
        savedInstanceState: Bundle?
    ): View? {
        retainInstance = true
        if (savedInstanceState == null) {
            sfHelper = SharedPrefHelper(context as Activity)
            cView = inflater.inflate(R.layout.fragment_first, container, false)
        }
        return cView
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        retainInstance = true

        if (sfHelper!!.getValueBoolean("SORTING", defaultValue = false) == true) {
            if (savedInstanceState == null) {
                loadData()
            } else {
                if (MainApplication.isRotating == 1) {
                    loadData()
                }
            }
        } else {
            sortingPopUp()
        }
    }

    private fun sortingPopUp() {
        val mDialog = Dialog(context as Activity, android.R.style.Theme_Black_NoTitleBar)
        mDialog.window?.setBackgroundDrawable(ColorDrawable(Color.argb(100, 0, 0, 0)))
        mDialog.setContentView(R.layout.sorting)
        mDialog.setCancelable(false)
        mDialog.show()

        mDialog.findViewById<Button>(R.id.btn_got_it).setOnClickListener {
            sfHelper.save("SORTING", true)
            mDialog.dismiss()
            if (NetworkConnectivity.checkNetwork(context as Activity)) {
                loadData()
            } else {
                ExceptionHandler.noInternetAlert(context as Activity)
            }
        }
    }

    private fun loadData() {
        if (MainApplication.backClick == 1 || MainApplication.isRotating == 1) {
            var mContext: FragmentActivity? = FragmentActivity()

            mContext = this!!.getActivity() as HomeActivity

            mContext.bottomItems()
        }
        rViewModel = ViewModelProviders.of(this).get(rViewModel::class.java)

        try {
            var cList = MainApplication.switchList
            if (MainApplication.isActive) {
                if (MainApplication.active_model != null) {

                }
            } else {

            }
            if (cList.size != null) {
                for (i in 0 until cList.size) {
                    try {

                        }
                    } catch (e: Exception) {
                        e.printStackTrace()
                    }
                }
            }
        catch (e: Exception) {
        }
    }

    override fun onClick(v: View?) {
        when (v!!.id) {

        }
    }

    private fun observeResponse() {
      try {
            cViewModel.response.observe(viewLifecycleOwner, Observer {
                it?.let {

                        fragmentManager?.beginTransaction()
                            ?.replace(R.id.root_container, SecondFragment())
                            ?.addToBackStack(null)?.commit()
                    }

                })
        }
         catch (e: Exception) {
        }
    }

    override fun onSaveInstanceState(outState: Bundle) {
        if (isRotating) {
            MainApplication.isRotating = 1
            outState.putBoolean("isRotating", true)
        }
        super.onSaveInstanceState(outState)
    }

    override fun onStop() {
        super.onStop()
    }

    override fun onStart() {
        super.onStart()
        if (MainApplication.backClick == 1) {
            isRotating = true
            loadData()
        } else if (MainApplication.isRotating == 1) {
            isRotating = true
            loadData()
        }
    }

    override fun onResume() {
        super.onResume()
        var mContext: FragmentActivity? = FragmentActivity()

        mContext = this!!.getActivity() as HomeActivity

        mContext.bottomItems()
        if (MainApplication.backClick == 1) {
            root_container.removeAllViews()
            MainApplication.backClick = 0

        }
        if (MainApplication.isRotating == 1) {
            root_container.removeAllViews()
            MainApplication.isRotating = 0
        }
    }
}

</code>```

Body:
A HomeActivity class has a bottom menu navigation which opens up a fragment class. Everything is good to navigate inside the fragment class. However, when I click any other bottom menu navigation item from this fragment class, it immediately crashes and results with the below error,

2022-12-07 10:39:41.828  8956-8956  AndroidRuntime pid-8956
E FATAL EXCEPTION: main Process: com.my.app.debug, PID: 8956

java.lang.IllegalArgumentException: saveBackStack("f1a147ba-4bb3-449c-87b8-cf73f7bf463c") included
FragmentTransactions must use setReorderingAllowed(true) to ensure that the back stack can be
restored as an atomic operation.
Found BackStackEntry{82b1a #1} that did not use setReorderingAllowed(true).

at androidx.fragment.app.FragmentManager.saveBackStackState(FragmentManager.java:2141)
at androidx.fragment.app.FragmentManager$SaveBackStackState.generateOps(FragmentManager.java:3494)
at androidx.fragment.app.FragmentManager.generateOpsForPendingActions(FragmentManager.java:2067)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1757)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:547)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

In my fragment class, I tried to return the same view in onCreateView()

if (fragmentView != null) {
            return fragmentView;
}

Also added 'context' in onResume() for my fragment class

var mContext: FragmentActivity? = FragmentActivity()

mContext = this!!.getActivity() as HomeActivity

mContext.bottomItems()

and nothing worked so far. With this log information couldn't find much on where and what exactly went wrong.

I found this Stack overflow link app-crashes-when-tapping-multiple-times-on-bottom-navigation-views that somewhat relates to my issue however the error between mine and this link is different here

Found BackStackEntry{82b1a #1} that did not use setReorderingAllowed(true).

Adding Code
For Understanding, From Home screen user clicks the bottom navigation which shows the FirstFragment screen. The Firstfragment contains few tabviews where you see the SecondFragment information called in observeResponse() method in the class FirstFragment.kt being called will get loaded.

HomeActivity.kt

class HomeActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedListener {
    private lateinit var navController: NavController
    private lateinit var appBarConfiguration: AppBarConfiguration
    private lateinit var sfHelper: SharedPrefHelper
    private var mCacheManager: CacheManager? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mCacheManager = CacheManager(this)
        sfHelper = SharedPrefHelper(this)

        val mainActivityIntent: Intent = Intent(this, MainActivity::class.java)
        mainActivityIntent.putExtra("navigateScreen", intent.getStringExtra("navigateScreen"))
        startActivity(mainActivityIntent)
        finishAffinity()
        setContentView(R.layout.activity_dashboard)
        try {
          navController = findNavController(R.id.fragment_container)
          appBarConfiguration = AppBarConfiguration.Builder(R.id.homeFragment)
                                .setDrawerLayout(main_drawer_layout)
                                .build()
          if (mCacheManager!!.isShortCut()) {
                    when (mCacheManager!!.getShortCutName()) {
                      "firstFrag" -> {
                                navController.navigate(R.id.homeFragment_to_firstFragment)
                                ClearCache.cacheManagerClear(this)
                      }
                    }
          }
          } catch (e: Exception) {
            }
    }

    private fun setupNavControl() {
        bottom_navigation?.setupWithNavController(navController)
        main_navigation_view?.setupWithNavController(navController)

    }

    private fun showBothNavigation() {
        bottom_navigation?.visibility = View.VISIBLE
        main_navigation_view?.visibility = View.VISIBLE
        main_drawer_layout?.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
        setupNavControl()
    }

    override fun onSupportNavigateUp(): Boolean {
        return NavigationUI.navigateUp(navController, appBarConfiguration)
    }

    override fun onBackPressed() {
        when {
            main_drawer_layout.isDrawerOpen(GravityCompat.START) -> {
                main_drawer_layout.closeDrawer(GravityCompat.START)
            }
            else -> {
                super.onBackPressed()
            }
        }
    }

}

HomeFragment.kt

class HomeFragment : Fragment(), View.OnClickListener {
    private lateinit var appContext: Context
    private var fragmentView: View? = null
    lateinit var sharedPref: SharedPrefHelper

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?

    ): View? {
        if (fragmentView != null) {
            return fragmentView;
        }
        sharedPref = SharedPrefHelper(context as Activity)
        val view: View = layoutInflater.inflate(R.layout.fragment_home, container, false)
        fragmentView = view
        return view
        }
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        loadViewCreated()
    }

    private fun loadViewCreated() {
        try {
            sharedPref = SharedPrefHelper(context as Activity)
            appContext = (context as Activity).applicationContext
            if (user == true) {
                cButton.setOnClickListener(this)
                Glide.with(context as Activity).load(R.drawable.preloader_gif).into(loadingViewHome)
            } else {
                maLogger.info("HomeFragment", "onViewCreated", "MainApplication.model is null")
            }
        } catch (e: Exception) {
            maLogger.error("HomeFragment", "onViewCreated", e.message.toString())
            ExceptionHandler.errorHandle(context as Activity, e.message.toString())
        }
    }

    @SuppressLint("ResourceAsColor")
    override fun onClick(v: View?) {
        when (v!!.id) {
            R.id.cButton -> {
                Navigation.findNavController(v)
                    .navigate(HomeFragmentDirections.homeFragment_to_firstFragment())
            }
        }
    }

    fun observeModel(viewModel: HomeViewModel) {
        viewModel.response.observe(viewLifecycleOwner, Observer {
            it?.let {
                if (activeUser == true) {

                }

            }
       }
    }
}

FirstFragment.kt

class FirstFragment : Fragment(), View.OnClickListener {
    lateinit var cView: View
    private lateinit var cViewModel: CViewModel
    private var isRotating: Boolean = false
    private lateinit var rViewModel: rViewModel
    private lateinit var sfHelper: SharedPrefHelper
    var user = false

    override fun onCreateView(
        inflater: LayoutInflater, @Nullable container: ViewGroup?, @Nullable
        savedInstanceState: Bundle?
    ): View? {
        retainInstance = true
        if (savedInstanceState == null) {
            sfHelper = SharedPrefHelper(context as Activity)
            cView = inflater.inflate(R.layout.fragment_first, container, false)
        }
        return cView
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        retainInstance = true

        if (sfHelper!!.getValueBoolean("SORTING", defaultValue = false) == true) {
            if (savedInstanceState == null) {
                loadData()
            } else {
                if (MainApplication.isRotating == 1) {
                    loadData()
                }
            }
        } else {
            sortingPopUp()
        }
    }

    private fun sortingPopUp() {
        val mDialog = Dialog(context as Activity, android.R.style.Theme_Black_NoTitleBar)
        mDialog.window?.setBackgroundDrawable(ColorDrawable(Color.argb(100, 0, 0, 0)))
        mDialog.setContentView(R.layout.sorting)
        mDialog.setCancelable(false)
        mDialog.show()

        mDialog.findViewById<Button>(R.id.btn_got_it).setOnClickListener {
            sfHelper.save("SORTING", true)
            mDialog.dismiss()
            if (NetworkConnectivity.checkNetwork(context as Activity)) {
                loadData()
            } else {
                ExceptionHandler.noInternetAlert(context as Activity)
            }
        }
    }

    private fun loadData() {
        if (MainApplication.backClick == 1 || MainApplication.isRotating == 1) {
            var mContext: FragmentActivity? = FragmentActivity()

            mContext = this!!.getActivity() as HomeActivity

            mContext.bottomItems()
        }
        rViewModel = ViewModelProviders.of(this).get(rViewModel::class.java)

        try {
            var cList = MainApplication.switchList
            if (MainApplication.isActive) {
                if (MainApplication.active_model != null) {

                }
            } else {

            }
            if (cList.size != null) {
                for (i in 0 until cList.size) {
                    try {

                        }
                    } catch (e: Exception) {
                        e.printStackTrace()
                    }
                }
            }
        catch (e: Exception) {
        }
    }

    override fun onClick(v: View?) {
        when (v!!.id) {

        }
    }

    private fun observeResponse() {
      try {
            cViewModel.response.observe(viewLifecycleOwner, Observer {
                it?.let {

                        fragmentManager?.beginTransaction()
                            ?.replace(R.id.root_container, SecondFragment())
                            ?.addToBackStack(null)?.commit()
                    }

                })
        }
         catch (e: Exception) {
        }
    }

    override fun onSaveInstanceState(outState: Bundle) {
        if (isRotating) {
            MainApplication.isRotating = 1
            outState.putBoolean("isRotating", true)
        }
        super.onSaveInstanceState(outState)
    }

    override fun onStop() {
        super.onStop()
    }

    override fun onStart() {
        super.onStart()
        if (MainApplication.backClick == 1) {
            isRotating = true
            loadData()
        } else if (MainApplication.isRotating == 1) {
            isRotating = true
            loadData()
        }
    }

    override fun onResume() {
        super.onResume()
        var mContext: FragmentActivity? = FragmentActivity()

        mContext = this!!.getActivity() as HomeActivity

        mContext.bottomItems()
        if (MainApplication.backClick == 1) {
            root_container.removeAllViews()
            MainApplication.backClick = 0

        }
        if (MainApplication.isRotating == 1) {
            root_container.removeAllViews()
            MainApplication.isRotating = 0
        }
    }
}


来源: stackexchange

问:
Reading docx sent via Word Add-in
I'm uploading a whole document via Word Add-in to my FastAPI backend. For the add-in, I'm using this sample code: https://github.com/OfficeDev/office-js-docs-pr/blob/main/docs/includes/file-get-the-whole-document-from-an-add-in-for-powerpoint-or-word.md

When I try to read the data sent by the Add-in using python-docx, there is an error File is not a zip file.

In the backend, I'm using this Python code (using python-docx lib):

from io import BytesIO
from docx import Document

@app.post('/doc')
def create_doc(body: str = Body(...), slice_index: int = Header(...)):
    doc_bytes = base64.b64decode(body)
    docx = Document(BytesIO(doc_bytes))
    ...
```
<p>The app crashes with:</p>
<pre class="lang-bash prettyprint-override"><code>   1331     raise BadZipFile("File is not a zip file")
   1332 if not endrec:
-> 1333     raise BadZipFile("File is not a zip file")
   1334 if self.debug > 1:
   1335     print(endrec)

BadZipFile: File is not a zip file
</code>```

So I'm clearly missing something in how I should read the data send by the Add-in.

Any help?

ContentLicense: CC BY-SA 4.0

Title: Reading docx sent via Word Add-in

Body:
I'm uploading a whole document via Word Add-in to my FastAPI backend. For the add-in, I'm using this sample code: https://github.com/OfficeDev/office-js-docs-pr/blob/main/docs/includes/file-get-the-whole-document-from-an-add-in-for-powerpoint-or-word.md

When I try to read the data sent by the Add-in using python-docx, there is an error File is not a zip file.

In the backend, I'm using this Python code (using python-docx lib):

from io import BytesIO
from docx import Document

@app.post('/doc')
def create_doc(body: str = Body(...), slice_index: int = Header(...)):
    doc_bytes = base64.b64decode(body)
    docx = Document(BytesIO(doc_bytes))
    ...

The app crashes with:

   1331     raise BadZipFile("File is not a zip file")
   1332 if not endrec:
-> 1333     raise BadZipFile("File is not a zip file")
   1334 if self.debug > 1:
   1335     print(endrec)

BadZipFile: File is not a zip file

So I'm clearly missing something in how I should read the data send by the Add-in.

Any help?


问:
How to connect quarkus application with azure share file
I want to connect my Quaruks application to my azure file. i found this tutorial but its for blob-storage: https://quarkiverse.github.io/quarkiverse-docs/quarkus-azure-services/dev/quarkus-azure-storage-blob.html, is there similar way to connect to azure share file in order to upload files there?

i found for example this way: https://github.com/dherenj84/filemanager but its for springboot, i need for Quarkus application, many thanks


问:
How to Calculate monthly total without considering dates with using dax measures
How to calculate total amount for filtered vales related month . I want get values for selected dates belong monthly  total values.Need a dax measure for this.even I select jan 01 to Jan 10 I want show values for total month of jan complete sales as below.I want this approach using dax.


问:
19612 Failed to execute script 'main' due to unhandled exception
have a problem,
I can start my application but when I click on a button to import a file, the application crashes and shows me this:
problem
i use kivy lib, plyer is the probleme.
thank's

I would like to be able to import images without worries so that the user can personalize the application
thank's :)


问:
It returns an error when I try to access to my camera on different browsers at once
I am trying to gain an access to my camera on Chrome and Edge at the same time.

It seems like there is no problem with my code when I open only one browswer at a time.

But when I open up two browsers at the same time, one of the browser returns an error

Uncaught (in promise) DOMException: Could not start video source

Here are my codes:

UserRoom.html

```<code>{% load static %}
<!DOCTYPE html>
  <head>
    <link rel="stylesheet" href={% static 'video/css/UserRoom.css' %}>
  </head>
  <body>
    <div id="MainContainer">
      <video id="MyVideo"></video>
      <div id="JoinedUserList">
        <video class="ClientVideo"></video>
      </div>
    </div>
  </body>
  <script src={% static 'video/js/websocket.js' %} type="text/javascript"></script>
  <script src={% static 'video/js/media.js' %} type="text/javascript"></script>
</html>
</code>```

media.js

```<code>const MyVideo = document.getElementById('MyVideo')
const constraints = {
  audio: false,
  video: true
}

navigator.mediaDevices.getUserMedia(constraints)
.then((stream) => {
  MyVideo.srcObject = stream;
  MyVideo.onloadedmetadata = () => {MyVideo.play()}
})
</code>```

It seemed like a simple issue that could be solved at first but it turned out that I could not find an appropriate solution in Google or Stack Overflow. How could I turn on the same camera on more than two browsers at the same time?

Body:
I am trying to gain an access to my camera on Chrome and Edge at the same time.

It seems like there is no problem with my code when I open only one browswer at a time.

But when I open up two browsers at the same time, one of the browser returns an error

Uncaught (in promise) DOMException: Could not start video source

Here are my codes:

UserRoom.html

{% load static %}
<!DOCTYPE html>

    <link rel="stylesheet" href={% static 'video/css/UserRoom.css' %}>

      <video id="MyVideo"></video>

        <video class="ClientVideo"></video>

media.js

const MyVideo = document.getElementById('MyVideo')
const constraints = {
  audio: false,
  video: true
}

navigator.mediaDevices.getUserMedia(constraints)
.then((stream) => {
  MyVideo.srcObject = stream;
  MyVideo.onloadedmetadata = () => {MyVideo.play()}
})

It seemed like a simple issue that could be solved at first but it turned out that I could not find an appropriate solution in Google or Stack Overflow. How could I turn on the same camera on more than two browsers at the same time?


问:
Unable to connect hive beeline through python
I am not able to connect hive through python/spark in jupyter notebook. I am using version 2.7 of python. Can someone please help?

First approach:

```<code>import commands
cmd='beeline -u "jdbc:hive2://...../principal =hive/url;ssl=true" -e '"select * from table name"
Status,output = commands.getstatusoutput(cmd)
If status ==0:
   Print output your text
Else:
   Print "error"
</code>```

I am getting an error for the output. It should return the table structure of hive.

Second approach:

```<code>From pyhive import hive
</code>```

Not able to import pyhive. I am using python version as 2.7.13

Body:
I am not able to connect hive through python/spark in jupyter notebook. I am using version 2.7 of python. Can someone please help?

First approach:

import commands
cmd='beeline -u "jdbc:hive2://...../principal =hive/url;ssl=true" -e '"select * from table name"
Status,output = commands.getstatusoutput(cmd)
If status ==0:
   Print output your text
Else:
   Print "error"

I am getting an error for the output. It should return the table structure of hive.

Second approach:

From pyhive import hive

Not able to import pyhive. I am using python version as 2.7.13


问:
Flutter fetch api index
I want to retrieve the next address recount shipto 0 .
I can only retrieve shipto 0 .
When it comes up with more than 1 address ,
it will recount shipto 0 . Sorry , I am practicing

I can't fetch the next address

but I can fetch sequence shipto 0

RangeError (index): Invalid value: Only valid value is 0: 1

This is fetchapi

```<code>var loading = false;
Future fetchMos() async {
List<Item> listitem = [];
listitem.clear();
loading = true;
var client = http.Client();
String mosUrl =
  '';
 var url = Uri.parse(mosUrl);
 var headers = {
'Client-Token': '',
'Content-Type': 'application/json',
 };
var response = await client.get(url, headers: headers);
if (response.statusCode == 200) {
var data = jsonDecode((utf8.decode(response.bodyBytes)))['items'];
for (var index in data) {
  listitem.add(Item.fromJson(index));
  print(data);
}
loading = false;
}
return listitem;
}
</code>```

This is Json

```<code>   {
        "items": [
 {
    "custnum": "",
    "name": "",
    "address": [
        {
            "shipto": 0,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        },
        {
           "shipto": 1,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        },
        {
            "shipto": 2,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        },
        {
            "shipto": 3,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        }
         {
        "custnum": "",
        "name": "",
        "address": [
           {
            "shipto": 0,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        },
        {
           "shipto": 1,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        },
    ]
}
],
</code>```

Title: Flutter fetch api index

Body:
I want to retrieve the next address recount shipto 0 .
I can only retrieve shipto 0 .
When it comes up with more than 1 address ,
it will recount shipto 0 . Sorry , I am practicing

I can't fetch the next address

but I can fetch sequence shipto 0

RangeError (index): Invalid value: Only valid value is 0: 1

This is fetchapi

var loading = false;
Future fetchMos() async {
List<Item> listitem = [];
listitem.clear();
loading = true;
var client = http.Client();
String mosUrl =
  '';
 var url = Uri.parse(mosUrl);
 var headers = {
'Client-Token': '',
'Content-Type': 'application/json',
 };
var response = await client.get(url, headers: headers);
if (response.statusCode == 200) {
var data = jsonDecode((utf8.decode(response.bodyBytes)))['items'];
for (var index in data) {
  listitem.add(Item.fromJson(index));
  print(data);
}
loading = false;
}
return listitem;
}

This is Json

   {
        "items": [
 {
    "custnum": "",
    "name": "",
    "address": [
        {
            "shipto": 0,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        },
        {
           "shipto": 1,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        },
        {
            "shipto": 2,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        },
        {
            "shipto": 3,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        }
         {
        "custnum": "",
        "name": "",
        "address": [
           {
            "shipto": 0,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        },
        {
           "shipto": 1,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        },
    ]
}
],


问:
Failed assertion: line 99 pos 16: 'assetName.isNotEmpty': is not true
I want to pass the parameter link from my reusable handbookoption widget to the pdf viewer class. tried passing the widget but returns assetName.isNotEmpty. also tried  widget.link  but same error. It is a stateful widget also

reusable widget

```<code>class HandbookOptions extends StatefulWidget {
  final String link;
  late String label;
  late String description;
  late String source;
HandbookOptions({super.key, required this.source,required this.label,required this.description, required this.link});
  State<HandbookOptions> createState() => _HandbookOptionsState();
  }
class _HandbookOptionsState extends State<HandbookOptions>{
  void initState() {
    super.initState();
    print(widget.link);
  }
  @override
  Widget build(BuildContext context) {
    double width = MediaQuery.of(context).size.width; //width of the  screen
    double height = MediaQuery.of(context).size.height; // height of the screen
    return SizedBox(
      height: 80,
      child: Card(
        color: Colors.black,
        clipBehavior: Clip.antiAlias,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(12)
          ),
        child: Stack(
          alignment: Alignment.topCenter,
          children: [
            Ink(
              height: 200,
              child: InkWell(
                onTap: () => Navigator.of(context).pushNamed(
                  widget.source,
                  arguments: 'Text from homepage',
                ),
              ),
            ),
            Padding(
              padding:  const EdgeInsets.symmetric(vertical: 10),
              child: Text(widget.label,
                style: const TextStyle(color: Colors.white,fontWeight: FontWeight.bold, fontSize: 25),
              ),
            ),
            Padding(
              padding: const EdgeInsets.only(top: 45),
              child: Text(widget.description,
                style: const TextStyle(color: Colors.white, fontSize: 15),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
</code>```

handbook options
this is where to choose which pdf file to view

```<code>class Handbook extends StatefulWidget {
  const Handbook({super.key});
  @override
  State<StatefulWidget> createState() => _HandbookState();
}

class _HandbookState extends State<Handbook> {

  String headline = "";
  String type = "";
@override
  void initState() {
    super.initState();
  }

  @override

  Widget build(BuildContext context) {
  double width = MediaQuery.of(context).size.width; ///width of screen
  double height = MediaQuery.of(context).size.height;///height of screen
  final user = FirebaseAuth.instance.currentUser!;
  final uid = user.uid;
    return GestureDetector(
      onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
      child: Scaffold(
        backgroundColor: const Color.fromARGB(31, 146, 144, 144),
        appBar: AppBar(
          title: const Text('Handbook'),
          leading: IconButton(onPressed: () => Navigator.of(context).pop(), icon: const Icon(Icons.arrow_circle_left_outlined, color: Colors.white,)),
          centerTitle: true,
          backgroundColor: Colors.black,
        ),
        body: SingleChildScrollView(
          child: Padding(
            padding: EdgeInsets.only(left: 20.0, right: 20, top: height * 0.24),
            child: Column(
              children: [
              HandbookOptions(link: 'assets/pdf/Regnum_Dei.pdf', source: '/pdf', label: 'Regnum Dei', description: 'Anthem and Map'),
              const SizedBox(height: 10,),
              ],
            ),
          ),
        ),
      ),
    );
  }

}```

//pdf viewer class

class PDFViewer extends StatefulWidget {
  final String link;
  const PDFViewer({super.key, required this.link});
  @override
  // ignore: library_private_types_in_public_api
  _PDFViewerState createState() => _PDFViewerState();
}

class _PDFViewerState extends State<PDFViewer> {
  late PdfViewerController _pdfViewerController;
  final GlobalKey<SfPdfViewerState> _pdfViewerStateKey = GlobalKey();
  @override
  void initState() {
    _pdfViewerController = PdfViewerController();
    super.initState();
    print(widget.link);
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
        child: Scaffold(
      body: SfPdfViewer.asset(
          widget.link,
          pageLayoutMode: PdfPageLayoutMode.single,
          controller: _pdfViewerController,
          key: _pdfViewerStateKey),
      appBar: AppBar(
        backgroundColor: Colors.black,
        actions: <Widget>[
          IconButton(
              onPressed: () {
                _pdfViewerStateKey.currentState!.openBookmarkView();
              },
              icon: Icon(
                Icons.bookmark,
                color: Colors.white,
              )),
          IconButton(
              onPressed: () {
                _pdfViewerController.jumpToPage(5);
              },
              icon: Icon(
                Icons.arrow_drop_down_circle,
                color: Colors.white,
              )),
          IconButton(
              onPressed: () {
                _pdfViewerController.zoomLevel = 1.25;
              },
              icon: Icon(
                Icons.zoom_in,
                color: Colors.white,
              ))
        ],
      ),
    ));
  }
}

the error
[![enter image description here][1]][1]

  [1]: https://i.stack.imgur.com/S01H2.png
```

Body:
I want to pass the parameter link from my reusable handbookoption widget to the pdf viewer class. tried passing the widget but returns assetName.isNotEmpty. also tried  widget.link  but same error. It is a stateful widget also

reusable widget

class HandbookOptions extends StatefulWidget {
  final String link;
  late String label;
  late String description;
  late String source;
HandbookOptions({super.key, required this.source,required this.label,required this.description, required this.link});
  State<HandbookOptions> createState() => _HandbookOptionsState();
  }
class _HandbookOptionsState extends State<HandbookOptions>{
  void initState() {
    super.initState();
    print(widget.link);
  }
  @override
  Widget build(BuildContext context) {
    double width = MediaQuery.of(context).size.width; //width of the  screen
    double height = MediaQuery.of(context).size.height; // height of the screen
    return SizedBox(
      height: 80,
      child: Card(
        color: Colors.black,
        clipBehavior: Clip.antiAlias,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(12)
          ),
        child: Stack(
          alignment: Alignment.topCenter,
          children: [
            Ink(
              height: 200,
              child: InkWell(
                onTap: () => Navigator.of(context).pushNamed(
                  widget.source,
                  arguments: 'Text from homepage',
                ),
              ),
            ),
            Padding(
              padding:  const EdgeInsets.symmetric(vertical: 10),
              child: Text(widget.label,
                style: const TextStyle(color: Colors.white,fontWeight: FontWeight.bold, fontSize: 25),
              ),
            ),
            Padding(
              padding: const EdgeInsets.only(top: 45),
              child: Text(widget.description,
                style: const TextStyle(color: Colors.white, fontSize: 15),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

handbook options
this is where to choose which pdf file to view

class Handbook extends StatefulWidget {
  const Handbook({super.key});
  @override
  State<StatefulWidget> createState() => _HandbookState();
}

class _HandbookState extends State<Handbook> {

  String headline = "";
  String type = "";
@override
  void initState() {
    super.initState();
  }

  @override

  Widget build(BuildContext context) {
  double width = MediaQuery.of(context).size.width; ///width of screen
  double height = MediaQuery.of(context).size.height;///height of screen
  final user = FirebaseAuth.instance.currentUser!;
  final uid = user.uid;
    return GestureDetector(
      onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
      child: Scaffold(
        backgroundColor: const Color.fromARGB(31, 146, 144, 144),
        appBar: AppBar(
          title: const Text('Handbook'),
          leading: IconButton(onPressed: () => Navigator.of(context).pop(), icon: const Icon(Icons.arrow_circle_left_outlined, color: Colors.white,)),
          centerTitle: true,
          backgroundColor: Colors.black,
        ),
        body: SingleChildScrollView(
          child: Padding(
            padding: EdgeInsets.only(left: 20.0, right: 20, top: height * 0.24),
            child: Column(
              children: [
              HandbookOptions(link: 'assets/pdf/Regnum_Dei.pdf', source: '/pdf', label: 'Regnum Dei', description: 'Anthem and Map'),
              const SizedBox(height: 10,),
              ],
            ),
          ),
        ),
      ),
    );
  }

}```

//pdf viewer class

class PDFViewer extends StatefulWidget {
  final String link;
  const PDFViewer({super.key, required this.link});
  @override
  // ignore: library_private_types_in_public_api
  _PDFViewerState createState() => _PDFViewerState();
}

class _PDFViewerState extends State<PDFViewer> {
  late PdfViewerController _pdfViewerController;
  final GlobalKey<SfPdfViewerState> _pdfViewerStateKey = GlobalKey();
  @override
  void initState() {
    _pdfViewerController = PdfViewerController();
    super.initState();
    print(widget.link);
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
        child: Scaffold(
      body: SfPdfViewer.asset(
          widget.link,
          pageLayoutMode: PdfPageLayoutMode.single,
          controller: _pdfViewerController,
          key: _pdfViewerStateKey),
      appBar: AppBar(
        backgroundColor: Colors.black,
        actions: <Widget>[
          IconButton(
              onPressed: () {
                _pdfViewerStateKey.currentState!.openBookmarkView();
              },
              icon: Icon(
                Icons.bookmark,
                color: Colors.white,
              )),
          IconButton(
              onPressed: () {
                _pdfViewerController.jumpToPage(5);
              },
              icon: Icon(
                Icons.arrow_drop_down_circle,
                color: Colors.white,
              )),
          IconButton(
              onPressed: () {
                _pdfViewerController.zoomLevel = 1.25;
              },
              icon: Icon(
                Icons.zoom_in,
                color: Colors.white,
              ))
        ],
      ),
    ));
  }
}

the error
[![enter image description here][1]][1]

  [1]: https://i.stack.imgur.com/S01H2.png


问:
How to make a table in bootstrap with top heading vertical text and left side heading?
I am trying to make a table with horizontal and vertical heading and middle tr data should move top to bottom just like in the given diagram

currently my table is like this -

table,
.table {
  color: #000;
}

.table-design {
  padding: 40px !important;
}

.table thead th {
  vertical-align: bottom;
  border-bottom: 2px solid #dee2e6;
  text-align: center;
  transform: rotate(90deg);
  white-space: nowrap;
  height: 160px;
  font-size: 16px;
}

table tr:nth-child(even) {
  background-color: #f2f2f2 !important;
}

 ::-webkit-scrollbar {
  width: 2px !important;
  border-radius: 10px !important
}

/* Track */

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

/* Handle */

::-webkit-scrollbar-thumb {
  background: #a3d1ff;
}

.table-responisve {
  width: 100%;
  overflow: auto;
}

table tr th,
table tr td {
  min-width: 200px;
  text-align: center;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><section class="table-design">
  <div class="table-responisve">
    <table id="editableTable" class="table table-bordered table-striped mb-0">
      <thead>
        <tr>
          <th style="display:none;">S.NO</th>
          <th>Date</th>
          <th>Country</th>
          <th>Region</th>
          <th>City</th>
          <th>Sightseeingpoint</th>
          <th>HiDrive</th>
          <th>Totalphoto</th>
          <th>Totalvideo</th>
        </tr>
      </thead>
      <tbody>
        <tr>

          <td>"2022-11-20"</td>
          <td>"neitherland"</td>
          <td>"posher"</td>
          <td>"amsterdam"</td>
          <td>yes</td>
        </tr>
      </tbody>
    </table>
  </div>
</section></code>```

How will I scroll top to bottom with fix header, also need to decrease header width, and how to add a header on left side too just as shown in the diagram above ?

Body:
I am trying to make a table with horizontal and vertical heading and middle tr data should move top to bottom just like in the given diagram

currently my table is like this -

table,
.table {
  color: #000;
}

.table-design {
  padding: 40px !important;
}

.table thead th {
  vertical-align: bottom;
  border-bottom: 2px solid #dee2e6;
  text-align: center;
  transform: rotate(90deg);
  white-space: nowrap;
  height: 160px;
  font-size: 16px;
}

table tr:nth-child(even) {
  background-color: #f2f2f2 !important;
}

 ::-webkit-scrollbar {
  width: 2px !important;
  border-radius: 10px !important
}

/* Track */

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

/* Handle */

::-webkit-scrollbar-thumb {
  background: #a3d1ff;
}

.table-responisve {
  width: 100%;
  overflow: auto;
}

table tr th,
table tr td {
  min-width: 200px;
  text-align: center;
}

          S.NO
          Date
          Country
          Region
          City
          Sightseeingpoint
          HiDrive
          Totalphoto
          Totalvideo

          "2022-11-20"
          "neitherland"
          "posher"
          "amsterdam"
          yes

How will I scroll top to bottom with fix header, also need to decrease header width, and how to add a header on left side too just as shown in the diagram above ?


问:
Getting the contents of a DIV (which contains sheet music) as an image, with Python
Basically I would like a program that can search through multiple websites which provide sheet music, and which extracts a given piece.
So heres an example:
https://thesession.org/tunes/54

So, the thing is, that the sheet music, though it looks like an image, is, as far as I can see, somehow generated so that every note and line is a separate element.

So I'm really wondering how to extract this. I kind of know that they use certain software to convert so called "abc notation" into an visual sheet music, but I think that programming that conversion would be over my head, and maybe unnecesarily complicated.


问:
Powershell Works Local but Intune Gives Error
I am running the below code and will work without issue locally in Powershell. When I try to push to systems in Intune Powershell Scripts it gives me a failure. When I setup a log it states the location does not exist. I assume there is a format issue but can't seem to find any.

```<code>Start-Transcript -Path "C:\log.txt"
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "RestartApps" -PropertyType 'DWORD' -Value 1
</code>```

This should create a DWORD in registry and set its value to 1. Really a basic script.

Body:
I am running the below code and will work without issue locally in Powershell. When I try to push to systems in Intune Powershell Scripts it gives me a failure. When I setup a log it states the location does not exist. I assume there is a format issue but can't seem to find any.

Start-Transcript -Path "C:\log.txt"
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "RestartApps" -PropertyType 'DWORD' -Value 1

This should create a DWORD in registry and set its value to 1. Really a basic script.


问:
Nuxtjs on GAE is caching html and resulting in 404 on js files
I'm having a weird behavior with Nuxt in GAE.

I have 404 on JS files when updating production, it looks like HTML is being cached more than it should, always 304, so it's pointing to previous built js files that are not available anymore, I don't have this behavior in a common docker container, as soon as I create a new build, the html is served with 200 status code.

So basically if the user that previously have accessed doesn't clean the cache after the build, everything is broken.

These are my configurations (basically the same as the recommended on Nuxt docs), I've just removed the secure because it conflicts with cloudflare ssl:

app.yaml

runtime: nodejs16

handlers:
  - url: /_nuxt
    static_dir: dist/_nuxt

  - url: /(.*\.(gif|png|jpg|ico|txt))$
    static_files: static/\1
    upload: static/.*\.(gif|png|jpg|ico|txt)$

  - url: /.*
    script: auto

automatic_scaling:
  min_idle_instances: 1
  min_instances: 1

```
<p>nuxt.config.js</p>
<pre class="lang-js prettyprint-override"><code>{
  ssr: true,
  target: 'static'
}
</code>```

build commands

{
  "scripts": {
    "dev": "nuxt",
    "build": "nuxt build && nuxt generate",
    "gcp-build": "nuxt build && nuxt generate",
    "start": "nuxt start",
    "generate": "nuxt generate",
  }
}
```

I have tried to threat html files as static files on app.yaml but that lead to issues with router redirection (I redirect every non trailing slash url to with a trailing slash), sitemap was not available anymore, canonical urls were being built always leading to root path "/". So I gave up with this approach.

I don't believe is a Cloudflare reason either because the appspot.com url that Google provides have the same issue.

Body:
I'm having a weird behavior with Nuxt in GAE.

I have 404 on JS files when updating production, it looks like HTML is being cached more than it should, always 304, so it's pointing to previous built js files that are not available anymore, I don't have this behavior in a common docker container, as soon as I create a new build, the html is served with 200 status code.

So basically if the user that previously have accessed doesn't clean the cache after the build, everything is broken.

These are my configurations (basically the same as the recommended on Nuxt docs), I've just removed the secure because it conflicts with cloudflare ssl:

app.yaml

runtime: nodejs16

handlers:
  - url: /_nuxt
    static_dir: dist/_nuxt

  - url: /(.*\.(gif|png|jpg|ico|txt))$
    static_files: static/\1
    upload: static/.*\.(gif|png|jpg|ico|txt)$

  - url: /.*
    script: auto

automatic_scaling:
  min_idle_instances: 1
  min_instances: 1

nuxt.config.js

{
  ssr: true,
  target: 'static'
}

build commands

{
  "scripts": {
    "dev": "nuxt",
    "build": "nuxt build && nuxt generate",
    "gcp-build": "nuxt build && nuxt generate",
    "start": "nuxt start",
    "generate": "nuxt generate",
  }
}

I have tried to threat html files as static files on app.yaml but that lead to issues with router redirection (I redirect every non trailing slash url to with a trailing slash), sitemap was not available anymore, canonical urls were being built always leading to root path "/". So I gave up with this approach.

I don't believe is a Cloudflare reason either because the appspot.com url that Google provides have the same issue.


问:
Extracting minimum/maximum/average value from multiple CSV files to one
I am currently trying to build a script to extract min max and average from each spreadsheet and logging in into one.
My dataset:
Data set is consisten across all 10000 csv files.

My ideal result would I would like to achieve is:
Filename,Col2_min,col2_max, col2_avr, Col3_min,col3_max, col3_avr, Col4_min,col4_max, col4_avr, Col5_min,col5_max, col5_avr,

NameOfFile1, min, max, average, min, max, average, min, max, average, min, max, average
NameOfFile2, min, max, average, min, max, average, min, max, average, min, max, average

CSV do not have any column names- they just start with values - csv was split into multiple files as these will need to be processed seperatly in another algorythm.

I for the time being I cant get the script to pull the data in this order- it simply comes out scrambled. Furthermore, no idea how to make it crawl through all csv within the folder. Any help greatly appriciated.

```<code>import pandas as pd
import numpy as np
import csv

df = pd.read_csv(r'G:\10_11_2022 03_12_2022-001.csv')

col_max=df.max(axis=0)
col_min=df.min(axis=0)
col_avr=df.mean(axis=0)

header = ['filename', 'T_Max','T_Min' 'T_Avr','SB_Max','SB_Min' 'SB_Avr' 'EB_Max','EB_Min' 'EB_Avr', 'FB_Max','FB_Min' 'FB_Avr']
data = ['1', df.max(col2), df.min(col2), df.mean(col2),df.max(col3), df.min(col3), df.mean(col3),df.max(col4), df.min(col4), df.mean(col4),df.max(col5), df.min(col5), df.mean(col5)]

with open('Results.csv', 'w', encoding='UTF8', newline='') as f:
          writer = csv.writer(f)
          writer.writerow(header)
          writer.writerow(data)
</code>```

Body:
I am currently trying to build a script to extract min max and average from each spreadsheet and logging in into one.
My dataset:
Data set is consisten across all 10000 csv files.

My ideal result would I would like to achieve is:
Filename,Col2_min,col2_max, col2_avr, Col3_min,col3_max, col3_avr, Col4_min,col4_max, col4_avr, Col5_min,col5_max, col5_avr,

NameOfFile1, min, max, average, min, max, average, min, max, average, min, max, average
NameOfFile2, min, max, average, min, max, average, min, max, average, min, max, average

CSV do not have any column names- they just start with values - csv was split into multiple files as these will need to be processed seperatly in another algorythm.

I for the time being I cant get the script to pull the data in this order- it simply comes out scrambled. Furthermore, no idea how to make it crawl through all csv within the folder. Any help greatly appriciated.

import pandas as pd
import numpy as np
import csv

df = pd.read_csv(r'G:\10_11_2022 03_12_2022-001.csv')

col_max=df.max(axis=0)
col_min=df.min(axis=0)
col_avr=df.mean(axis=0)

header = ['filename', 'T_Max','T_Min' 'T_Avr','SB_Max','SB_Min' 'SB_Avr' 'EB_Max','EB_Min' 'EB_Avr', 'FB_Max','FB_Min' 'FB_Avr']
data = ['1', df.max(col2), df.min(col2), df.mean(col2),df.max(col3), df.min(col3), df.mean(col3),df.max(col4), df.min(col4), df.mean(col4),df.max(col5), df.min(col5), df.mean(col5)]

with open('Results.csv', 'w', encoding='UTF8', newline='') as f:
          writer = csv.writer(f)
          writer.writerow(header)
          writer.writerow(data)


问:
Axios Get Request In Pinia Store Will Fetch Data But Params Do Not Show In URL?
I can fetch data fine when using axios inside my Laravel Pinia project, but the URL parameters won't show up in the url? Here is my code:

```<code>getters: {
    axiosParams() {
        window.csrfToken = document.querySelector('meta[name="csrf-token"]').content;

        const params = new URLSearchParams();
        params.append('_token', csrfToken);
        params.append('q', this.q);
        params.append('availableNamesOnly', this.filters.availableNamesOnlyEnabled);
        params.append('selectedTlds', Object.assign({}, this.filters.selectedTlds));
        params.append('priceRange', this.filters.priceRange);

        return params;
    }
},
</code>```

Next is my method to fetch the data:

```<code>actions: {
    fetchSearchResults() {
        self = this;

        axios.get('/search/', {
            params: self.axiosParams,
        })
        .then(function (response) {
            self.results.defaultResults = response.data.defaultResults;
            self.results.allEndingsResults = response.data.allEndingsResults;
            self.results.aiResults = response.data.aiResults;
            self.results.seoResults = response.data.seoResults;
            self.results.funResults = response.data.funResults;
            self.results.mixResults = response.data.mixResults;
            self.results.hasResults = response.data.hasResults;
            self.results.display = response.data.display;
            console.log(response.data);
        })
        .catch(function (error) {
            console.log(error);
        })
        .then(function () {
            // always executed
        });
    },
}
</code>```

Body:
I can fetch data fine when using axios inside my Laravel Pinia project, but the URL parameters won't show up in the url? Here is my code:

getters: {
    axiosParams() {
        window.csrfToken = document.querySelector('meta[name="csrf-token"]').content;

        const params = new URLSearchParams();
        params.append('_token', csrfToken);
        params.append('q', this.q);
        params.append('availableNamesOnly', this.filters.availableNamesOnlyEnabled);
        params.append('selectedTlds', Object.assign({}, this.filters.selectedTlds));
        params.append('priceRange', this.filters.priceRange);

        return params;
    }
},

Next is my method to fetch the data:

actions: {
    fetchSearchResults() {
        self = this;

        axios.get('/search/', {
            params: self.axiosParams,
        })
        .then(function (response) {
            self.results.defaultResults = response.data.defaultResults;
            self.results.allEndingsResults = response.data.allEndingsResults;
            self.results.aiResults = response.data.aiResults;
            self.results.seoResults = response.data.seoResults;
            self.results.funResults = response.data.funResults;
            self.results.mixResults = response.data.mixResults;
            self.results.hasResults = response.data.hasResults;
            self.results.display = response.data.display;
            console.log(response.data);
        })
        .catch(function (error) {
            console.log(error);
        })
        .then(function () {
            // always executed
        });
    },
}


问:
How to arrange response from same endpoint based on the authorization?
I am using express for endpoints, and PostgreSQL for the database. In the app, there are multiple user types, called user and issuer. Issuers are able to create certificates and issue them to users. I am having trouble returning different responses for the same endpoint based on the user role.

For instance I have getCreatedCertificates endpoint, which brings certificates created by an issuer. These certificates are public, meaning that any user can also see these created certificates inside the issuer's profile. But they should see it with less detailed information compared to what the creator of the certificate is seeing. They are technically both retrieving the same thing, which is certificates created by that issuer, but issuer him/herself should be able to access much more detailed information.

I don't think separating this into another endpoint is a good solution, they are almost  same with the exception of few different select columns. I also don't want to check the user role every time within a controller function, this brings too much boilerplate code on every one of the endpoints. I think middleware function is the way to go but I am unable imagine how that middleware function would efficiently and clearly know the return values for each GET endpoints and feed them into the controller function. How can I achieve what I am trying to do?


问:
Fetch Python Logger Formatter Variables in Code
I have a Django project and this is what the logger formatter configuration looks like.

```<code>'formatters': {
    'simple': {
        'format': '%(asctime)s SCORPIO [%(request_id)s] ' + os.environ['ENVIRONMENT'] + ': %(message)s',
        'datefmt': '%Y-%m-%dT%H:%M:%S',
    },
},
</code>```

How does Python pick the different variables (asctime, request_id) provided in the format? I need to fetch the request_id variable in case of a failure and display it on a page.

I've mostly worked with Java in which these variables are picked from the ThreadContext so I tried looking for such an alternative in Python but couldn't find one.

Body:
I have a Django project and this is what the logger formatter configuration looks like.

'formatters': {
    'simple': {
        'format': '%(asctime)s SCORPIO [%(request_id)s] ' + os.environ['ENVIRONMENT'] + ': %(message)s',
        'datefmt': '%Y-%m-%dT%H:%M:%S',
    },
},

How does Python pick the different variables (asctime, request_id) provided in the format? I need to fetch the request_id variable in case of a failure and display it on a page.

I've mostly worked with Java in which these variables are picked from the ThreadContext so I tried looking for such an alternative in Python but couldn't find one.


问:
Bamboo CI/CD: triggers for environments
I would like to ask about triggers between environments.

I try to implement this automatic CI/CD pipline in Bamboo:

-build+unit tests

-deploy to Dev

-run e2e tests on Dev

-if successful, deploy to QA

-run e2e tests on QA

-if successful, deploy to Staging.

I have created:

-1 build plan for "build+unit tests"

-1 deployment project with 3 environments

-3 separate build plans for e2e tests, each of them has "a successful deployment to environment" ( Dev, QA, Staging) as a trigger

But, I cannot figure out how to create a trigger on QA environment to start deployment of QA environment only if my plan with e2e tests are green on Dev (I have found 4 available triggers on environment level, but none of them allow to use a different plan (in my case a plan with e2e tests) as a trigger).

Do you have ay idea how to solve this?

Thanks!

Title: Bamboo CI/CD: triggers for environments


问:
How to include queryStringParameter in an eventBridge trigger in my SAM template.yaml file
I have the following definitions in my template.yaml file.

In it I define an event that schedules the defined Lambda function to run at an interval. I'd like to a) include parameters in the trigger, and b) define multiple triggers.

With respect to a: my Lambda function uses event.get('event_type', None) to capture queryStrings from an API gateway trigger (not shown below) to define some logic in the Lambda function. I'd like the eventBridge trigger to serve the same input.

With respect to b) I intend to create several events that serve different values for the queryString. Each of these will have different schedules serve different values for the querystring.

```<code>Resources:
  myNewFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: myNewFunction/
      Handler: app.lambda_handler
      Runtime: python3.8
      MemorySize: 2048
      Architectures:
        - x86_64
      Layers:
      - !Ref AsanaLayer
      Events:
        testEveryMinute:
          Type: Schedule
          Properties:
            Schedule: 'rate(1 minute)'
            Name: TestSchedule
            Description: runs myNewFunction at a given interval
            Enabled: true
</code>```

I've tried a few things (including https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-httpparameters.html).

The only thing that works is to manually create the JSON payload in the eventBridge web Portal "configure target input" dialog. But ideally I'd like to define this in the template.yaml file.

I know you can download the yaml definition from eventBridge, but I have not been able to successfully integrate this into my existing template.yaml file

Body:
I have the following definitions in my template.yaml file.

In it I define an event that schedules the defined Lambda function to run at an interval. I'd like to a) include parameters in the trigger, and b) define multiple triggers.

With respect to a: my Lambda function uses event.get('event_type', None) to capture queryStrings from an API gateway trigger (not shown below) to define some logic in the Lambda function. I'd like the eventBridge trigger to serve the same input.

With respect to b) I intend to create several events that serve different values for the queryString. Each of these will have different schedules serve different values for the querystring.

Resources:
  myNewFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: myNewFunction/
      Handler: app.lambda_handler
      Runtime: python3.8
      MemorySize: 2048
      Architectures:
        - x86_64
      Layers:
      - !Ref AsanaLayer
      Events:
        testEveryMinute:
          Type: Schedule
          Properties:
            Schedule: 'rate(1 minute)'
            Name: TestSchedule
            Description: runs myNewFunction at a given interval
            Enabled: true

I've tried a few things (including https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-httpparameters.html).

The only thing that works is to manually create the JSON payload in the eventBridge web Portal "configure target input" dialog. But ideally I'd like to define this in the template.yaml file.

I know you can download the yaml definition from eventBridge, but I have not been able to successfully integrate this into my existing template.yaml file


问:
how to resolve android manifest file to run app using android studio
```<code><?xml version='1.0' encoding='utf-8'?>
<manifest xmlns:tools="http://schemas.android.com/tools"
    android:hardwareAccelerated="true" android:versionCode="110602" android:versionName="11.6.2" package="com.digi.efrickindia" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        android:exported="true"
        android:hardwareAccelerated="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:usesCleartextTraffic="true"
        tools:targetApi="m">
        <activity
            android:name="MainActivity"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
            android:exported="true"
            android:label="@string/activity_name"
            android:launchMode="singleTop"
            android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
            android:windowSoftInputMode="adjustResize"
            tools:ignore="ExtraText">
            <intent-filter
                android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <service android:exported="true" android:name="com.transistorsoft.cordova.backgroundfetch.HeadlessJobService" android:permission="android.permission.BIND_JOB_SERVICE" />
        <receiver
            android:name="com.transistorsoft.cordova.backgroundfetch.HeadlessBroadcastReceiver"
            android:exported="false">
            <intent-filter>
                <action android:name="${applicationId}.event.BACKGROUND_FETCH" />
            </intent-filter>
        </receiver>
        <service android:name="com.anrip.cordova.ForegroundService" />
        <meta-data android:name="com.transistorsoft.locationmanager.license_key" android:value="c89fcca72cdf7b7c885ab575f98b67d1a035b1fac79e45d344ec47e49ec2f0d2" />
    </application>
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-feature android:name="android.hardware.location.gps"
        />
</manifest>

</code>```

Merging Errors:
Error: android:exported needs to be explicitly specified for element <receiver#com.transistorsoft.tsbackgroundfetch.BootReceiver>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. Frick_LMS.app main manifest (this file), line 21

Error: android:exported needs to be explicitly specified for element <receiver#com.transistorsoft.locationmanager.BootReceiver>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. Frick_LMS.app main manifest (this file), line 25

Body:
<?xml version='1.0' encoding='utf-8'?>
<manifest xmlns:tools="http://schemas.android.com/tools"
    android:hardwareAccelerated="true" android:versionCode="110602" android:versionName="11.6.2" package="com.digi.efrickindia" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        android:exported="true"
        android:hardwareAccelerated="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:usesCleartextTraffic="true"
        tools:targetApi="m">
        <activity
            android:name="MainActivity"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
            android:exported="true"
            android:label="@string/activity_name"
            android:launchMode="singleTop"
            android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
            android:windowSoftInputMode="adjustResize"
            tools:ignore="ExtraText">
            <intent-filter
                android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <service android:exported="true" android:name="com.transistorsoft.cordova.backgroundfetch.HeadlessJobService" android:permission="android.permission.BIND_JOB_SERVICE" />
        <receiver
            android:name="com.transistorsoft.cordova.backgroundfetch.HeadlessBroadcastReceiver"
            android:exported="false">
            <intent-filter>
                <action android:name="${applicationId}.event.BACKGROUND_FETCH" />
            </intent-filter>
        </receiver>
        <service android:name="com.anrip.cordova.ForegroundService" />
        <meta-data android:name="com.transistorsoft.locationmanager.license_key" android:value="c89fcca72cdf7b7c885ab575f98b67d1a035b1fac79e45d344ec47e49ec2f0d2" />
    </application>
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-feature android:name="android.hardware.location.gps"
        />
</manifest>

Merging Errors:
Error: android:exported needs to be explicitly specified for element <receiver#com.transistorsoft.tsbackgroundfetch.BootReceiver>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. Frick_LMS.app main manifest (this file), line 21

Error: android:exported needs to be explicitly specified for element <receiver#com.transistorsoft.locationmanager.BootReceiver>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. Frick_LMS.app main manifest (this file), line 25


问:
how to implement two complement in binary digits in python?
I am trying to find a solution to implement Two's Complement on binary digits .For example from right to left if there are 0s they remain so and the first 1 that  find it remains 1 but the rest  must invert them but  don't know how to do it .Also  want the input to take it from calling another def.

100100 = 011100 or 0101001 = 1010111  am expecting this


问:
Why does code not work after using fopen() command
I created  FILE *ptr to read a file, and after I declare ptr =fopen("file_name.txt", "r");
none of my code written afterwards will work.

BELOW IS SOME OF THE ACTUAL CODE

```<code>#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#define MAXFILE 30
#define MAX 50
</code>```

typedef struct Student
{

```<code>int stdid;
char *fname;
char *lname;
int day;
int month;
int year;
</code>```

}Student;

typedef struct Course
{

```<code>char *cid;
char *cname;
float credit;
</code>```

}Course;

typedef struct Enrollment
{

```<code>int stdid;
int cid;
char *semester;
float score;
</code>```

}Enrollment;

int main()
{

```<code>char stud[MAXFILE], courses[MAXFILE], enroll[MAXFILE];
printf("TESTING1");

scanf("%s %s %s",stud,courses,enroll);

int studnum,coursenum,enrollnum;

FILE *st, *cou, *enr;
st = fopen("stud","r");
cou = fopen("courses","r");
enr = fopen("enroll","r");

printf("TESTING2");

if(st==NULL || cou == NULL || enr== NULL)
{
  printf("unable to open file\n");
  exit(1);
}

fscanf(st,"%d",&studnum);

Student *students = (Student*)(malloc(sizeof(Student) * studnum));
for(int i =0; i<studnum;i++)
{
    char ftemp[MAX],ltemp[MAX];
    int fir, las;
    fscanf(st,"%d %s %s %d %d %d",&students[i].stdid, ftemp, ltemp, &students[i].day, &students[i].month, &students[i].year);
    fir = strlen(ftemp)+1;
    las = strlen(ltemp)+1;
    strcpy(students[i].fname,ftemp);
    strcpy(students[i].lname,ltemp);
    students[i].fname = malloc(fir * sizeof(char));
    students[i].lname = malloc(las * sizeof(char));
    strcpy(students[i].fname,ftemp);
    strcpy(students[i].lname,ltemp);
}
//reading the students.txt file and filling out Student type array with data;

printf("TESTING3");

fscanf(cou,"%d",&coursenum);

Course *course = (Course*)(malloc(sizeof(Course)*coursenum));
for(int i =0; i<coursenum;i++)
{
    char cidtemp[MAX], cntemp[MAX];
    int tempcid, tempcn;
    fscanf(cou,"%s %s %f",cidtemp, cntemp, &course[i].credit);
    tempcid = strlen(cidtemp)+1;
    tempcn = strlen(cntemp)+1;

    course[i].cid = malloc(tempcid*sizeof(char));
    course[i].cname = malloc(tempcn * sizeof(char));
    strcpy(course[i].cid,cidtemp);
    strcpy(course[i].cname, cntemp);

}
//reading the couses.txt file and filling out an array of type Course with the data

printf("TESTING4");

fscanf(enr,"%d",&enrollnum);

Enrollment *enrollment = (Enrollment*)(malloc(sizeof(Enrollment)*enrollnum));

for(int i =0; i<enrollnum; i++)
{
int stdid;
int cid;
char *semester;
float score;

char semest[MAX];
int semtemp;
fscanf(enr,"%d %d %s %f",&enrollment[i].stdid, &enrollment[i].cid, semest, &enrollment[i].score);

semtemp = strlen(semest)+1;

enrollment[i].semester = malloc(semtemp * sizeof(char));
strcpy(enrollment[i].semester, semest);

printf("%d\t%d\t%s\t%.0f \n", enrollment[i].stdid, enrollment[i].cid, enrollment[i].semester, enrollment[i].score);
}
//reading the enrollment files and fill out at array of type Enrollment

//testing new arrays

printf("%d", enrollnum);
for(int i = 0; i<enrollnum; i ++)
{
    printf("%d\t%d\t%s\t%.0f \n", enrollment[i].stdid, enrollment[i].cid, enrollment[i].semester, enrollment[i].score);
}

fclose(st);
fclose(cou);
fclose(enr);

for(int i =0; i < studnum;i++)
{
    free(students[i].fname);
    free(students[i].lname);
}
free(students);
for(int i =0; i < coursenum;i++)
{
    free(course[i].cid);
    free(course[i].cname);
}
free(course);
for(int i =0; i < enrollnum;i++)
{
    free(enrollment[i].semester);
}
free(enrollment);

return 0;
</code>```

}

Body:
I created  FILE *ptr to read a file, and after I declare ptr =fopen("file_name.txt", "r");
none of my code written afterwards will work.

BELOW IS SOME OF THE ACTUAL CODE

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#define MAXFILE 30
#define MAX 50

typedef struct Student
{

int stdid;
char *fname;
char *lname;
int day;
int month;
int year;

}Student;

typedef struct Course
{

char *cid;
char *cname;
float credit;

}Course;

typedef struct Enrollment
{

int stdid;
int cid;
char *semester;
float score;

}Enrollment;

int main()
{

char stud[MAXFILE], courses[MAXFILE], enroll[MAXFILE];
printf("TESTING1");

scanf("%s %s %s",stud,courses,enroll);

int studnum,coursenum,enrollnum;

FILE *st, *cou, *enr;
st = fopen("stud","r");
cou = fopen("courses","r");
enr = fopen("enroll","r");

printf("TESTING2");

if(st==NULL || cou == NULL || enr== NULL)
{
  printf("unable to open file\n");
  exit(1);
}

fscanf(st,"%d",&studnum);

Student *students = (Student*)(malloc(sizeof(Student) * studnum));
for(int i =0; i<studnum;i++)
{
    char ftemp[MAX],ltemp[MAX];
    int fir, las;
    fscanf(st,"%d %s %s %d %d %d",&students[i].stdid, ftemp, ltemp, &students[i].day, &students[i].month, &students[i].year);
    fir = strlen(ftemp)+1;
    las = strlen(ltemp)+1;
    strcpy(students[i].fname,ftemp);
    strcpy(students[i].lname,ltemp);
    students[i].fname = malloc(fir * sizeof(char));
    students[i].lname = malloc(las * sizeof(char));
    strcpy(students[i].fname,ftemp);
    strcpy(students[i].lname,ltemp);
}
//reading the students.txt file and filling out Student type array with data;

printf("TESTING3");

fscanf(cou,"%d",&coursenum);

Course *course = (Course*)(malloc(sizeof(Course)*coursenum));
for(int i =0; i<coursenum;i++)
{
    char cidtemp[MAX], cntemp[MAX];
    int tempcid, tempcn;
    fscanf(cou,"%s %s %f",cidtemp, cntemp, &course[i].credit);
    tempcid = strlen(cidtemp)+1;
    tempcn = strlen(cntemp)+1;

    course[i].cid = malloc(tempcid*sizeof(char));
    course[i].cname = malloc(tempcn * sizeof(char));
    strcpy(course[i].cid,cidtemp);
    strcpy(course[i].cname, cntemp);

}
//reading the couses.txt file and filling out an array of type Course with the data

printf("TESTING4");

fscanf(enr,"%d",&enrollnum);

Enrollment *enrollment = (Enrollment*)(malloc(sizeof(Enrollment)*enrollnum));

for(int i =0; i<enrollnum; i++)
{
int stdid;
int cid;
char *semester;
float score;

char semest[MAX];
int semtemp;
fscanf(enr,"%d %d %s %f",&enrollment[i].stdid, &enrollment[i].cid, semest, &enrollment[i].score);

semtemp = strlen(semest)+1;

enrollment[i].semester = malloc(semtemp * sizeof(char));
strcpy(enrollment[i].semester, semest);

printf("%d\t%d\t%s\t%.0f \n", enrollment[i].stdid, enrollment[i].cid, enrollment[i].semester, enrollment[i].score);
}
//reading the enrollment files and fill out at array of type Enrollment

//testing new arrays

printf("%d", enrollnum);
for(int i = 0; i<enrollnum; i ++)
{
    printf("%d\t%d\t%s\t%.0f \n", enrollment[i].stdid, enrollment[i].cid, enrollment[i].semester, enrollment[i].score);
}

fclose(st);
fclose(cou);
fclose(enr);

for(int i =0; i < studnum;i++)
{
    free(students[i].fname);
    free(students[i].lname);
}
free(students);
for(int i =0; i < coursenum;i++)
{
    free(course[i].cid);
    free(course[i].cname);
}
free(course);
for(int i =0; i < enrollnum;i++)
{
    free(enrollment[i].semester);
}
free(enrollment);

return 0;

}


问:
how to show the duplicate error message in particular row based on duplicate input using angular12
here i am using template forms for binding the values under array and there is inline edit available for each row, issue is that, if i am giving duplicate for 3 rows under order number or the name, it shows error message in only one row and rest duplicate row is left without showing error message, and when changing the duplicate value to the correct value, then based on sorting the duplicate error message moves to the sorted place of the corrected value.

TS::

```<code>  //Duplicate check for order number
  public checkForDuplicate(event: any) {
    this.agentNotinView.map((x: any) => {
      x.error = false;
    });
    var valueOrderNumArr = this.agentNotinView.map(function (item: any) {
      return +item.orderNum;
    });
    var isDuplicate = valueOrderNumArr.some(function (item: any, idx: any) {
      return valueOrderNumArr.indexOf(item) != idx;
    });
    if (isDuplicate) {
      event.error = true;
    }
    if (event.orderNum == null || event.orderNum == '') {
      this.disableSave = true;
    }
    this.agentNotinView = this.agentNotinView.sort(
      (a: any, b: any) => a.orderNum - b.orderNum
    );
  }

  //Duplicate check for column display name
  public checkForNameDuplicate(event: any) {
    this.agentNotinView.map((x: any) => {
      x.colerror = false;
    });
    var valueColNameArr = this.agentNotinView.map(function (item: any) {
      return item.columnDisplayName;
    });
    var isDuplicate = valueColNameArr.some(function (item: any, idx: any) {
      return valueColNameArr.indexOf(item) != idx;
    });
    if (isDuplicate) {
      event.colerror = true;
    }
    if (event.columnDisplayName == null || event.columnDisplayName == '') {
      this.disableSave = true;
    }
  }
</code>```

html:

```<code>  <div class="row">
                <div class="col-9">
                  <input
                    type="text"
                    [(ngModel)]="customer.value"
                    [ngModelOptions]="{ standalone: true }"
                    (focusout)="checkForNameDuplicate(customer)"
                    class="block form-control"
                  />
                  <span *ngIf="customer.colerror" class="text-danger">
                    Duplicate Entry</span
                  >
                  <span
                    *ngIf="customer.columnDisplayName == ''"
                    class="text-danger"
                    >Cannot be empty</span
                  >
                </div>
                <div class="col-3">
                  <input
                    type="text"
                    [(ngModel)]="customer.order"
                    [ngModelOptions]="{ standalone: true }"
                    class="w-50 block form-control"
                    (focusout)="checkForDuplicate(customer)"
                  />
                  <span
                    *ngIf="customer.error && customer.orderNum != ''"
                    class="text-danger"
                  >
                    Duplicate Entry</span
                  >
                  <span *ngIf="customer.orderNum == ''" class="text-danger"
                    >Cannot be empty</span
                  >
                </div>
              </div>
</code>```

DEMO

so in this first image, i am not able to get duplicate error message in other place where i ave used same number and same name, basically if i have 3 duplicates, i need to show duplicate error message under 2 rows.

if there is any better approach also i am fine to go with it

Body:
here i am using template forms for binding the values under array and there is inline edit available for each row, issue is that, if i am giving duplicate for 3 rows under order number or the name, it shows error message in only one row and rest duplicate row is left without showing error message, and when changing the duplicate value to the correct value, then based on sorting the duplicate error message moves to the sorted place of the corrected value.

TS::

  //Duplicate check for order number
  public checkForDuplicate(event: any) {
    this.agentNotinView.map((x: any) => {
      x.error = false;
    });
    var valueOrderNumArr = this.agentNotinView.map(function (item: any) {
      return +item.orderNum;
    });
    var isDuplicate = valueOrderNumArr.some(function (item: any, idx: any) {
      return valueOrderNumArr.indexOf(item) != idx;
    });
    if (isDuplicate) {
      event.error = true;
    }
    if (event.orderNum == null || event.orderNum == '') {
      this.disableSave = true;
    }
    this.agentNotinView = this.agentNotinView.sort(
      (a: any, b: any) => a.orderNum - b.orderNum
    );
  }

  //Duplicate check for column display name
  public checkForNameDuplicate(event: any) {
    this.agentNotinView.map((x: any) => {
      x.colerror = false;
    });
    var valueColNameArr = this.agentNotinView.map(function (item: any) {
      return item.columnDisplayName;
    });
    var isDuplicate = valueColNameArr.some(function (item: any, idx: any) {
      return valueColNameArr.indexOf(item) != idx;
    });
    if (isDuplicate) {
      event.colerror = true;
    }
    if (event.columnDisplayName == null || event.columnDisplayName == '') {
      this.disableSave = true;
    }
  }

html:

                  <input
                    type="text"
                    [(ngModel)]="customer.value"
                    [ngModelOptions]="{ standalone: true }"
                    (focusout)="checkForNameDuplicate(customer)"
                    class="block form-control"
                  />

                    Duplicate Entry
                  Cannot be empty

                  <input
                    type="text"
                    [(ngModel)]="customer.order"
                    [ngModelOptions]="{ standalone: true }"
                    class="w-50 block form-control"
                    (focusout)="checkForDuplicate(customer)"
                  />

                    Duplicate Entry
                  Cannot be empty

DEMO

so in this first image, i am not able to get duplicate error message in other place where i ave used same number and same name, basically if i have 3 duplicates, i need to show duplicate error message under 2 rows.

if there is any better approach also i am fine to go with it


问:
Get teams members details of MS Teams using Teams.js/sdk
In configurable MS Teams tab app, is it possible get teams member details using Temas.js such as how it gives the context details like below</p>
```<code>import { app, Context } from "@microsoft/teams-js";

app.getContext().then((context: Context) => {
    /*...*/
});
</code>```

Body:
In configurable MS Teams tab app, is it possible get teams member details using Temas.js such as how it gives the context details like below

import { app, Context } from "@microsoft/teams-js";

app.getContext().then((context: Context) => {
    /*...*/
});


问:
transform a Spark(Java) object into SparkR object
I need to transform(convert) below Spark(Java) object into SparkR object ,below my object

struct_schema_megdp(output_count)
.....
Java ref type org.apache.spark.sql.types.StructType id 32
and able to get the fields only

sparkR.callJMethod(struct_schema_megdp(output_count), "fields")
[[1]]
Java ref type org.apache.spark.sql.types.StructField id 38

[[2]]
Java ref type org.apache.spark.sql.types.StructField id 39

```<code>
I want it to be converted to SparkR , e.g below object(schema):

</code>```

struct_schema <- function(output_count)

{

return(do.call(SparkR::structType, lapply(SparkR::dtypes(output_count), function(x) SparkR::structField(x[1], x[2]))))

}

struct_schema(output_count)
StructType
|-name = "word", type = "StringType", nullable = TRUE
|-name = "count", type = "StringType", nullable = TRUE

```<code>

I expected to be like :

> **struct_schema(output_count)**
StructType
|-name = "word", type = "StringType", nullable = TRUE
|-name = "count", type = "StringType", nullable = TRUE
</code>```

Body:
I need to transform(convert) below Spark(Java) object into SparkR object ,below my object

struct_schema_megdp(output_count)
.....
Java ref type org.apache.spark.sql.types.StructType id 32
and able to get the fields only

sparkR.callJMethod(struct_schema_megdp(output_count), "fields")
[[1]]
Java ref type org.apache.spark.sql.types.StructField id 38

[[2]]
Java ref type org.apache.spark.sql.types.StructField id 39

I want it to be converted to SparkR , e.g below object(schema):

struct_schema <- function(output_count)

{

return(do.call(SparkR::structType, lapply(SparkR::dtypes(output_count), function(x) SparkR::structField(x[1], x[2]))))

}

struct_schema(output_count)
StructType
|-name = "word", type = "StringType", nullable = TRUE
|-name = "count", type = "StringType", nullable = TRUE

I expected to be like :

> **struct_schema(output_count)**
StructType
|-name = "word", type = "StringType", nullable = TRUE
|-name = "count", type = "StringType", nullable = TRUE


问:
Properties.Resources results in MissingManifestResourceException in .NET Forms app
In .NET Framework I was able to add images to the project ressources and get them via Properties.Resources.resource_name. I've tried the same thing with a .NET 6 Forms app. Intellicode suggests me my ressource

```<code>var tmp = Properties.Resources.icon_refresh;
</code>```

However when ever I hit this line of code I get the following error message:

```<code>System.Resources.MissingManifestResourceException: "Could not find the resource "Properties.Resources.resources" among the resources
</code>```

Am I missing something important for the .NET 6 app?

Body:
In .NET Framework I was able to add images to the project ressources and get them via Properties.Resources.resource_name. I've tried the same thing with a .NET 6 Forms app. Intellicode suggests me my ressource

var tmp = Properties.Resources.icon_refresh;

However when ever I hit this line of code I get the following error message:

System.Resources.MissingManifestResourceException: "Could not find the resource "Properties.Resources.resources" among the resources

Am I missing something important for the .NET 6 app?


问:
AAD B2C REST API call - display error on following step
I've been looking for a way to not interrupt the user journey in a AAD B2C custom policy after receiving a HTTP 409 response from a REST API call which is invoked by a validation techcnical profile with ContinueOnError=true. I tried doing what is suggested here Error handling in Azure B2C Custom Policy REST Call (adding a dummy VTP which succeeds after the one that doesn't), but I keep getting a server error from AAD B2C and it doesn't seem like the second VTP get's called, despite ContinueOnError=true on the first one.

What I'm trying to achieve is: handle HTTP 409 responses from a REST API and customise the rest of the user journey on the basis of the error code received.

The way in which I'm trying to achieve it is: orchestration step x calls a technical profile which outputs a few claims that are obtained via a validation technical profile which calls a REST API. Orchestration step x+1 defines some custom behaviour on the basis of the error code received from the REST API. The API error response is formatted in the way in which it is expected by AAD B2C https://learn.microsoft.com/en-us/azure/active-directory-b2c/restful-technical-profile.

The only viable way I've found so far is to use an API proxy, which converts the HTTP 409 responses to HTTP 200. I would rather not do this if I can.

Any ideas would be appreciated.