instruction
stringlengths
0
30k
{"Voters":[{"Id":22433443,"DisplayName":"Alia Khalifa"}]}
The easiest way is to look at the default implementation [`com.sun.rowset.JdbcRowSetImpl`](https://github.com/openjdk/jdk21u/blob/master/src/java.sql.rowset/share/classes/com/sun/rowset/JdbcRowSetImpl.java). This class has a method [`connect()`](https://github.com/openjdk/jdk21u/blob/master/src/java.sql.rowset/share/classes/com/sun/rowset/JdbcRowSetImpl.java#L612) that establishes the connection. It does this in one of three ways: * if the object was initialized with an SQL connection it returns that connection * if the object has a datasource name it uses that name to lookup a datasource * if the object has an url set it uses the `java.sql.DriverManager` to establish a connection to that url No magic here, it does the same things that you would do if you were to open a connection yourself.
Agreed with @[sultanorazbayev](https://stackoverflow.com/users/10693596/sultanorazbayev)'s answer. Should use dataclasses for simplicity ```python import logging from dataclasses import dataclass logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) def main(): @dataclass class MyCustomException(Exception): code: int message: str description: str try: raise MyCustomException( 404, "Resource not found", "This resource does not exist or unavailable" ) except MyCustomException as e: logger.info( f""" MyCustomException caught: {e.code} {e.message} {e.description} """ ) finally: logger.info("Cleaning up and exiting...") if __name__ == "__main__": main() ```
Somehow Netbeans prints German warnings to the console when building a project. Likely because my laptop is set to German, but why it is exactly I am not sure. The terminal is in English, the Java JVM locale is set to English and the netbeans.conf is also set to English. * JVM Local > java -Duser.language=en -Duser.region=US * netbeans.conf > netbeans_default_options="... -J-Duser.language=en -J-Duser.region=US" But still I get the following console warnings in German, which is annoying when Googling the meaning of these warnings: ``` Systemmodulpfad nicht zusammen mit -source 11 festgelegt io/ost/finance/io/TransactionWriterForDone.java:[43,58] Nicht-varargs-Aufruf von varargs-Methode mit ungenauem Argumenttyp für den letzten Parameter. Führen Sie für einen varargs-Aufruf eine Umwandlung mit Cast in java.lang.Object aus Führen Sie für einen Nicht-varargs-Aufruf eine Umwandlung mit Cast in java.lang.Object[] aus, um diese Warnung zu unterdrücken ``` Anybody has an answer? Is there some way that the Java compiler is still set to German?
Supposed I toss 10 dice many times (let's say, 10000 times), and I want to know the probability of the sum on 10 dice falling into a range (10 to 20, 20 to 30, ..., 50 to 60). How can I divide the value into range and calculate the probability of each range? Below is what I have til now: K=10 all_comb = rep(list(1:6),K) # set up the dice dice <- expand.grid(all_comb) #list all possible combinations dice.sums <- rowSums(dice) #calculate sum of each combination all_prob = c() #calculate the probability of each possible sum (from 10 to 60) for (i in 1:(60-10+1) ){ a = mean( dice.sums == c(10:60)[i] ) all_prob = c(all_prob,a) } print(all_prob) I hope someone can tell me how to do this. Thank you very much!
Conan packages do not contain by default the declaration of the exact version and revision that the binary used to link. The ``"zlib/1.3.Z"`` that is being listed is the "binary compatibility" declaration, saying that this built binary can be used with any patch version of zlib/1.3 without necessarily recompiling itself. If you want to store an exact copy of the dependencies versions when building a package, it can be done with: - Modifying a recipe, you can generate a file in your preferred format iterating ``self.dependencies``. This might be done in the ``generate()`` method if you want to do it pre-build, or during the ``build()`` or even in the ``package()`` method. Using something like ``dep.ref``, [read this section][1] - Without modifying the recipe, and applying it to all packages being built, you can add the same logic as above, but inside a hook ([read this section][2]). A post/pre generate/build/package might be ok for this. [1]: https://docs.conan.io/2/reference/conanfile/attributes.html#dependencies [2]: https://docs.conan.io/2/reference/extensions/hooks.html
Has anyone had experience working with RichTextField? When I add an entry in the admin panel, the code there is highlighted and its background is gray, but when output to the html template there is no design. Here are my settings: CKEDITOR_UPLOAD_PATH = 'uploads/' CKEDITOR_CONFIGS = { 'default': { 'toolbar': 'Custom', 'toolbar_Custom': [ ['Bold', 'Italic', 'Underline', 'Strike'], ['NumberedList', 'BulletedList'], ['Link', 'Unlink'],[enter image description here](https://i.stack.imgur.com/hl9tl.png) ['Image', 'CodeSnippet'], ], 'extraPlugins': 'codesnippet', 'width': '550px', }, } [enter image description here](https://i.stack.imgur.com/J2vTB.png) I didn't add any plugins except ckeditor itself
RichTextField django + html
|python|html|css|django|backend|
null
|php|jquery|wordpress|onclick|
null
A Worksheet Change: Two Cells Combined - - You need to disable events before writing to the same worksheet and reenable them afterwards. - You don't want to disable events if there is no intersection i.e. if it's not one of the two cells that was changed. <!-- language: lang-vb --> Private Sub Worksheet_Change(ByVal Target As Range) Dim irg As Range: Set irg = Intersect(Me.Range("D7,G7"), Target) If irg Is Nothing Then Exit Sub ' it's not one of the cells; do nothing Application.EnableEvents = False Select Case irg.Address(0, 0) Case "D7", "D7,G7" Me.Range("G7") = "=1-D7" Case "G7" Me.Range("D7") = "=1-G7" End Select Application.EnableEvents = True End Sub
This is my first question here, so thanks in advance to anyone replying to this humble student. I'm trying to define a function using psycopg2. I have split into two stages. First the parameters necessary for connection, which I managed to read through documentation and solve. Now, my issue is dealing with the query to pass it through the function. Ex: def databasequery(database, user, password, host, port): psycopg2.connect( database=database, user=user, password=password, host=host, port=port, ) conn = get_connection() curr = conn.cursor() print(databasequery("Select * from customers", "your_database","your_user","your_password","your_host","your_port")) How can I add the query to pass through the function?
How do I create a Line Graph on App Script?
|google-apps-script|
I'm able to run the query without running into any issues. Test code I ran in BigQuery below. Perhaps there aren't any Processing_Method equal to 'Natural/Dry.' You can try a wildcard search and use NORMALIZE_AND_CASEFOLD(Processing_Method) like in example 2. WITH a AS ( SELECT 'Natural/Dry' AS Processing_Method UNION ALL SELECT 'Test') SELECT * FROM a WHERE Processing_Method='Natural/Dry' ----------------- WITH a AS ( SELECT 'Natural/Dry' AS Processing_Method UNION ALL SELECT 'Test') SELECT * FROM a WHERE NORMALIZE_AND_CASEFOLD(Processing_Method) like '%natural%dry%'
`orientation` does not seem to work as desired.\ Working with `aspect-ratio` may be the better way. ``` @media only screen and (max-aspect-ratio: 1/1) { //portrait } @media only screen and (min-aspect-ratio: 1/1) { //landscape } ```
The OP code is convoluted and difficult to read. As far as I can see, it's supposed to calculate the number of days until pay day, which should be on the 25th of the month, or if that falls on a Sat or Sun, to be the previous Friday. There are too many issues in the OP code to address each one. See [*Get difference between 2 dates in JavaScript?*][1] and the linked duplicate for some of the issues. Here's a simple solution based on the above rules. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> /* Return next pay day. * * If defaultPayDate falls on Sat or Sun, set payDate to prior Fri * If payDate is after baseDate, get next month's pay date * * @param {number} defaultPayDate - day of month for pay day * @param {Date} baseDate - date to calculate days to pay day from * @returns {Date} - next pay day */ function getNextPayday(defaultPayDate = 25, baseDate = new Date()) { // Get payday for the baseDate month let payDate = new Date(baseDate.getFullYear(), baseDate.getMonth(), defaultPayDate); // If on Sat (6) or Sun (0), shift to prior Fri if (!payDate.getDay() % 6) { // Subtract 2 from Sun, 1 from Sat payDate.setDate(payDate.getDate() - (payDate.getDay() + 2 % 7)); } // If baseDate is after payDate, get next month's pay day if (payDate.getDate() < baseDate.getDate()) { payDate = getNextPayday(defaultPayDate, new Date(baseDate.getFullYear(), baseDate.getMonth() + 1, 1)); } return payDate; } /* Days to next payday is not inclusive. Requires getNextPayday * * @param {number} defaultPayDate - day of month for pay day * @param {Date} baseDate - date to calculate days to pay day from * @returns {number} - days to next pay day (integer) */ function getDaysToNextPay(defaultPayDate = 25, baseDate = new Date()) { let payDate = getNextPayday(defaultPayDate, baseDate); // Use UTC to get differnce in days as UTC days are always exactly 8.64e7 ms long let daysToPayday = (Date.UTC(payDate.getFullYear(), payDate.getMonth(), payDate.getDate()) - Date.UTC(baseDate.getFullYear(), baseDate.getMonth(), baseDate.getDate())) / 8.64e7; return daysToPayday; } // Example let d = new Date(); console.log('Today is : ' + d.toDateString()); console.log('Next payday is : ' + getNextPayday(25, d).toDateString()); console.log('Days to next payday: ' + getDaysToNextPay(25, d)); <!-- end snippet --> [1]: https://stackoverflow.com/questions/3224834/get-difference-between-2-dates-in-javascript
In the below program, composite types(`X` & `map[string]int`) doesn't need explicit conversion, for assignability, because underlying type of composite types(`X` & `map[string]int`) is `map[string]int`, looks fine package main type X map[string]int func main() { var x X var y map[string]int x = y y = x } ---------- In the below code, package main type RationalNumber struct { x int y int } type Numerator int type Denominator int // Constructor func newRational(n, d int) RationalNumber { g := gcd(n, d) return RationalNumber{ x: n / g, y: d / g, } } // Selector func (r RationalNumber) numer() Numerator { return r.x } func (r RationalNumber) denom() Denominator { return r.y } func main() { } func gcd(a int, b int) int { // (15, 21) (-15, 21) (15, -21) (-15, -21) var f func(int, int) int f = func(x int, y int) int { if x%y == 0 { return y } return gcd(y, x%y) } if mod(a) < mod(b) { return f(mod(b), mod(a)) } return f(mod(a), mod(b)) } func mod(x int) int { // helper if x < 0 { return -x } return x } ----- underlying type of identifier `Numerator` is `int` and `r.x` is of type `int`, but `return r.x` gives error. So, why `return r.x` gives error? `cannot use r.x (variable of type int) as Numerator value in return statement`
yesterday I had the bad idea to update Anaconda (the system was asking for it). Now, I cannot use Jupyter Notebook anymore:( Below is the error I have when I am trying to mount the drive: -- ``` from google.colab import drive drive.mount('/content/drive') ``` -- --------------------------------------------------------------------------- ``` ModuleNotFoundError Traceback (most recent call last) Cell In[2], line 1 ----> 1 from google.colab import drive 2 drive.mount('/content/drive') ModuleNotFoundError: No module named 'google.colab' -- (Looking at the answer to the 1st question below) I tried to re-install google.colab: "pip install google-colab", but it fails. Below is the partial output (I put "..." when I cut): -- ... Collecting pandas~=0.24.0 (from google-colab) Using cached pandas-0.24.2.tar.gz (11.8 MB) Preparing metadata (setup.py): started Preparing metadata (setup.py): still running... Preparing metadata (setup.py): finished with status 'error' Note: you may need to restart the kernel to use updated packages. error: subprocess-exited-with-error python setup.py egg_info did not run successfully. exit code: 1 ` [324 lines of output] C:\Users\Asus\AppData\Local\Temp\pip-install-dnzbmumm\pandas_2bb5dd525f08419f83f59a4ca511da28\setup.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html import pkg_resources C:\Users\Asus\AppData\Local\Temp\pip-install-dnzbmumm\pandas_2bb5dd525f08419f83f59a4ca511da28\setup.py:50: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead. _CYTHON_INSTALLED = ver >= LooseVersion(min_cython_ver) warning: pandas\_libs\algos_take_helper.pxi:89:4: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310 ... ``` --
How to evaluate the probability of a range in R?
|r|range|probability|
I have submitted [my kaggle](https://www.kaggle.com/code/abzshaikh/explain-kaggle-solutions-using-rag-and-vector-db) note but it doesn't show in the my work tab of the [competition](https://www.kaggle.com/competitions/data-assistants-with-gemma/code). Tried reaching people on kaggle had no luck. How should I associate the notebook with competition? I added the competition through 'add input' button on the user interface, it is still not showing.
Kaggle notebook not showing in my work tab of the competition
|data-science|kaggle|gemma|
null
turf.js expects WGS84 coordinates. If you are using Openlayers to transform between projections you do not need to reverse that with toMercator/toWgs84 const geosonGeometry = geojsonFormat.writeGeometryObject(modifyEvtNullifierAsGeom, { featureProjection: 'EPSG:3857', dataProjection:'EPSG:4326' }); const buffered = turf.buffer(geosonGeometry, 60, {units: 'kilometers'}); const asOLFeature = geojsonFormat.readFeature(buffered, { dataProjection:'EPSG:4326', featureProjection: 'EPSG:3857' });
This isn't really how to use fixtures. If you want to get a specific fixture, for example, this one: ``` id_one: name: MyString nation: one slug: MyString ``` Don't assign an id. Then in your test class call `shops(:id_one)`. Minitest will grab the correct shop fixture from that. Since those names (ie `id_one`) are up to you, people tend to give them names with meaning, for instance roles. Note how you can assign a fixture to another fixture using the name of the fixture (as opposed to the id). ``` # fixtures/users.yml owner: name: An Owner consumer: name: A Shopper # fixtures/shops.yml department_store: name: ABC Department Store # fixtures/roles.yml owner: name: owner consumer: name: consumer # fixtures/roleshopuser.yml owner: user: owner shop: department_store role: owner consumer: user: consumer shop: department_store role: consumer ```
` ``` class convexLinear(nn.Module): def __init__(self, size_in, size_out): super().__init__() self.size_in, self.size_out = size_in, size_out weights = torch.Tensor(size_out, size_in) self.weights = nn.Parameter(weights) nn.init.kaiming_uniform_(self.weights, a=math.sqrt(5)) def forward(self, x): w_times_x= torch.mm(x, F.softplus(self.weights.t())) return w_times_x ``` ``` class ICNN(nn.Module): def __init__(self, n_input, n_hidden, n_output): super(ICNN, self).__init__() self.layers = nn.ModuleDict() self.depth = len(n_hidden) self.layers[str(0)] = nn.Linear(n_input, n_hidden[0]).float() nn.init.xavier_uniform_(self.layers[str(0)].weight) # Create create NN with number of elements in n_hidden as depth for i in range(1, self.depth): self.layers[str(i)] = convexLinear(n_hidden[i-1], n_hidden[i]).float() self.layers[str(self.depth)] = convexLinear(n_hidden[self.depth-1], n_output).float() def forward(self, x): # First layer x = x.view(-1, 3, 3) det = torch.det(x) det = det.view(-1, 1) x_t = x.transpose(1, 2) mult = torch.bmm(x_t, x) trace = torch.diagonal(mult, dim1=1, dim2=2).sum(1) trace = trace.view(-1, 1) x = torch.cat((trace, det), 1) z = x.clone() z = self.layers[str(0)](z) for layer in range(1, self.depth): z = self.layers[str(layer)](z) z = F.softplus(z) z = torch.square(z) y = self.layers[str(self.depth)](z) return y ``` ``` n_input = 2 n_output = 1 n_hidden = [64, 64] icnn = ICNN(n_input, n_hidden, n_output) ``` x is a 600, 9 data set which gets converted to a 600, 2 set in def forward: Output is supposed to be 600, 1 But the code gives very bad results for any other combination of n_hidden. In case of any doubts - I need a convex, non-decreasing activation with non-negative weights for the linear layers
{"Voters":[{"Id":298225,"DisplayName":"Eric Postpischil"},{"Id":162698,"DisplayName":"Rob"},{"Id":1974224,"DisplayName":"Cristik"}]}
There is absolutely positioned element `.data` with some content. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-css --> * { padding: 0; margin: 0; border: 0; box-sizing: border-box; } .container { position: relative; height: 100dvh; width: 100dvw; overflow: hidden; } .data { position: absolute; display: flex; flex-direction: column; border: solid 2px red; max-width: 10em; /* inset: 0.7em 0.7em 0.7em 0.7em; */ inset: 0.7em 0.7em auto 0.7em; } .data ul { display: flex; flex-direction: column; overflow-y: auto; list-style: none; } .data button { align-self: flex-end; } <!-- language: lang-html --> <div class="container"> <div class="data"> <button>&#x2715;</button> <ul> <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li> <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi volutpat tincidunt lorem, at gravida tellus consectetur in. Aliquam ac mi mauris. Sed imperdiet convallis velit non egestas. Nunc tempor porta nisl, vel vestibulum sem blandit eget. Mauris pharetra tincidunt felis, in imperdiet nunc malesuada nec. Duis placerat id felis maximus euismod. Nam convallis tellus ut tortor gravida, sed venenatis lorem egestas.</li> <li>In ac dolor a nibh ultricies vulputate. Curabitur mattis dignissim eros, eu lacinia est convallis in. Mauris et suscipit purus. Nulla facilisi. Morbi fermentum magna ut sodales pharetra. Sed feugiat, urna sed faucibus cursus, diam ligula faucibus arcu, ut tincidunt eros orci quis orci.</li> <ul> </div> </div <!-- end snippet --> With `inset: 0.7em 0.7em auto 0.7em;` of `.data` style its height is shrank according to small content, but scroll is disappears for large content, i.e it is looks like `overflow: hidden;` With `inset: 0.7em 0.7em 0.7em 0.7em;` of `.data` style its height is stretched for large content and scroll is appears, but the height does not shrink in case of small content. How to keep `overflow: auto;` for large content and height shrink for small one at the same time?
When updating a specific user, I want to run `unique` validation for the 'username' and 'studentNumber' fields, but only for other users and not for the same user being updated because its already owned by them. If I use `unique:users` only, it will cause errors when updating because it will run the validation against the user themselves. Instead, I used `Rule::unique('users')->ignore($user->id)` to ignore the user being updated, but I need to pass the id of the user being updated to the `Form Request`. How do I accomplish this? **UserController.php** ```laravel public function update(UpdateUserRequest $request, string $id) { try{ DB::table('users')->where('id',$id)->update($request->validated()); }catch(Exception $ex){ return response()->json(['message' => $ex->getMessage()], 409); } } ``` **UpdateUserRequest.php** ```laravel public function rules(): array { return [ 'username' => [ Rule::unique('users')->ignore($user->id), 'string', 'max:255'], 'studentNumber' => [ Rule::unique('users')->ignore($user->id), 'string'], ]; } ```
Jupyter notebook: " No module named 'google.colab'", after having updated Anaconda
|python-3.x|anaconda|jupyter|google-colaboratory|
null
It means that you need to pass the pointer `a` defined in `main` to the function `fn` by reference. In C passing by reference means passing an object indirectly through a pointer to it. Thus dereferencing the passed pointer the function will have a direct access to the object pointed to by the pointer and can change it. void fn(char **n) { /* * imagine this variable 'b' is * a part of a structure of * some library */ char *b = "hello, world!"; *n = b; } And in main you need to write fn( &a ); Pay attention to that the pointer `a` will be valid after the function call because it points to a string literal used in `fn` and string literals have static storage duration.
You're running the action in another thread. The app then thinks its finished and disposes what the thread needs - Its not about a delay. You could do: private async Task asynchronous () { ProjectItemsEvents_AfterAddProjectItems(); } This will however be marked as a warning since it doesn't use await. If there is no async stuff in "ProjectItemsEvents_AfterAddProjectItems" private async Task asynchronous () { await Task.FromResult(ProjectItemsEvents_AfterAddProjectItems()); }
|c++|
|javascript|reactjs|api|axios|response|
in this code function must take one index and simply delete it. And a problem is in delete_current_transaction, pycharm says that (index = self.ui.tableView.selectedIndexes()\[0\]) **list index out of range**. Edit_current_transaction also must take only one category. But it don't gives this type of error ``` def edit_current_transaction(self): index = self.ui.tableView.selectedIndexes()[0] id = str(self.ui.tableView.model().data(index)) date = self.ui_window.dataEdit.text() category = self.ui_window.cb_chose_category.currentText() description = self.ui_window.le.description.text() balance = self.ui_window.le_balance.text() status = self.ui_window.cb_status.currentText() self.conn.update_transaction_query(date, category, description, balance, status, id) self.view_data() self.new_window.close() def delete_current_transaction(self): index = self.ui.tableView.selectedIndexes()[0] id = str(self.ui.tableView.model().data(index)) self.conn.delete_transaction_query(id) self.view_data() self.new_window.close() ``` i tried to make similar code ``` def delete_current_transaction(self): index = self.ui.tableView.selectedIndexes()[0] id = str(self.ui.tableView.model().data(index)) date = self.ui_window.dataEdit.text() category = self.ui_window.cb_chose_category.currentText() description = self.ui_window.le.description.text() balance = self.ui_window.le_balance.text() status = self.ui_window.cb_status.currentText() self.conn.delete_transaction_query(id, date, category, description, balance, status) self.view_data() self.new_window.close() ``` nothing changes, can someone explain to me why this happening
Instead of using `BlockMatrix` make them regular matrices. Then the operations will be performed. ```python C = sp.Matrix([[I_p, I_p], [I_p, -I_p]]) Sigma = sp.Matrix([[Sigma_1, Sigma_2], [Sigma_2, Sigma_1]]) # the @ symbol is for matrix multiplication, but * will work C_Sigma_C_transpose = C@Sigma@C.T print(C_Sigma_C_transpose ) # Matrix([[2*Sigma_1 + 2*Sigma_2, 0], [0, 2*Sigma_1 - 2*Sigma_2]]) ``` Formatted in LaTeX (from the Jupyter Notebook): [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/oyE6h.png
# 2024 March 30th > **Maximum layer size** = 52,000 mebibytes [54,525 megabytes] > > This quota is not adjustable > > https://docs.aws.amazon.com/AmazonECR/latest/userguide/service-quotas.html
If you use NPOI in C#, you can write code like below: var imageRun = paragraph.CreateRun(); using (FileStream picData = new FileStream(imagePath, FileMode.Open, FileAccess.Read)) { imageRun.AddPicture(picData, (int)NPOI.XWPF.UserModel.PictureType.PNG, imagePath, Units.ToEMU(100), Units.ToEMU(100)); CT_Drawing drawing = imageRun.GetCTR().GetDrawingList().First(); CT_GraphicalObject graphicalobject = drawing.GetInlineArray(0).graphic; //Replace the newly inserted picture, add CTAnchor, set floating attribute, delete inline attribute CT_Anchor anchor = getAnchorWithGraphic(graphicalobject, "Seal", Units.ToEMU(120), Units.ToEMU(120), Units.ToEMU(50), Units.ToEMU(-80), true); drawing.anchor = new List<CT_Anchor>() { anchor };//Add floating attribute drawing.inline.RemoveAt(0);//R } static CT_Anchor GetAnchorWithGraphic(CT_GraphicalObject ctGraphicalObject, String deskFileName, int width, int height, int leftOffset, int topOffset, bool behind) { String anchorXML = "<wp:anchor xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" " + "simplePos=\"0\" relativeHeight=\"1\" behindDoc=\"" + ((behind) ? 1 : 0) + "\" locked=\"0\" layoutInCell=\"1\" allowOverlap=\"1\">" + "<wp:simplePos x=\"0\" y=\"0\"/>" + "<wp:positionH relativeFrom=\"page\">" + "<wp:posOffset>" + leftOffset + "</wp:posOffset>" + "</wp:positionH>" + "<wp:positionV relativeFrom=\"paragraph\">" + "<wp:posOffset>" + topOffset + "</wp:posOffset>" + "</wp:positionV>" + "<wp:extent cx=\"" + width + "\" cy=\"" + height + "\"/>" + "<wp:effectExtent l=\"0\" t=\"0\" r=\"0\" b=\"0\"/>" + "<wp:wrapNone/>" + "<wp:docPr id=\"1\" name=\"Drawing 0\" descr=\"" + deskFileName + "\"/><wp:cNvGraphicFramePr/>" + "</wp:anchor>"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(anchorXML); CT_Drawing drawing = CT_Drawing.Parse(xmlDoc, XWPFPictureData.NamespaceManager); CT_Anchor anchor = drawing.GetAnchorList().First(); anchor.graphic = ctGraphicalObject; return anchor; }
If you want to save items marked with "`(!)`", you will have to enable those in your `lynx.cfg` file (which is different from the `.lynxrc` file managed by the Options Menu. See [`ENABLE_LYNXRC`][1] (in the `lynx.cfg` file): >The forms-based O'ptions menu shows a **`(!)`** marker beside items which are not saved to **`~/.lynxrc`** -- the reason for disabling some of these items is that they are likely to cause confusion if they are read from the **`.lynxrc`** file for each session. However, they can be enabled or disabled using the **`ENABLE_LYNXRC`** settings. The default (compiled-in) settings are shown below. The second column is the name by which a setting is saved to **`.lynxrc`** (which is chosen where possible to correspond with **`lynx.cf`**g). Use ***"OFF"*** to disable writing a setting, ***"ON"*** to enable it. Settings are read from .lynxrc after the corresponding data from **`lynx.cfg`**, so they override **`lynx.cfg`**, which is probably what users expect. [1]: https://lynx.invisible-island.net/lynx_help/body.html#ENABLE_LYNXRC
I'm encountering an error when attempting to use Browsershot and Puppeteer to capture a screenshot of a Blade view. The command ""C:/Program Files/nodejs/node.exe" "D:\Work_Folders\Portal\portal-project\portal-backend\vendor\spatie\browsershot\src/../bin/browser.cjs" "{""url"":""http:\/\/127.0.0.1:8000\/en\/api\/map"",""action"":""screenshot"",""options"":{""type"":""png"",""path"":""D:\\Work_Folders\\Portal\\portal-project\\portal-backend\\public\\images\/reports\/map_screenshot.png"",""args"":[],""viewport"":{""width"":800,""height"":600}}}"" failed. Exit Code: 1(General error) Working directory: D:\Work_Folders\Portal\portal-project\portal-backend\public Output: ================ Error Output: ================ [Error: ENOENT: no such file or directory, mkdtemp 'undefined\temp\puppeteer_dev_chrome_profile-XXXXXX'] { errno: -4058, code: 'ENOENT', syscall: 'mkdtemp', path: 'undefined\\temp\\puppeteer_dev_chrome_profile-XXXXXX' } $mapUrl = route('map'); $filePath = public_path('images/reports/map_screenshot.png'); Browsershot::url($mapUrl) ->setNodeBinary('C:/Program Files/nodejs/node.exe') ->setNpmBinary('C:/Program Files/nodejs/npm') ->setTempDir(public_path('images/temp')) // Set the temporary directory explicitly ->save($filePath); return view('map', compact('locations', 'mapUrl')); "dependencies": { "puppeteer": "^22.6.0" } "wemersonjanuario/wkhtmltopdf-windows": "0.12.2.3"
Problem using Browsershot and Puppeteer in Laravel
|laravel|laravel-10|
When I try and open the pickle file, this error appears: Exception in thread Thread-1 (coinsv_thread): Exception in thread Thread-2 (coinsv_thread): Traceback (most recent call last): Traceback (most recent call last): File "C:\Users\Gregory\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1073, in _bootstrap_inner File "C:\Users\Gregory\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1073, in _bootstrap_inner self.run() File "C:\Users\Gregory\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1010, in run self.run() File "C:\Users\Gregory\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1010, in run self._target(*self._args, **self._kwargs) File "c:\Users\Gregory\Desktop\Y7 Homework\Actual cOMPUTING ASESSMENT\Assesment-Y7\functionality.py", line 30, in coinsv_thread self._target(*self._args, **self._kwargs) File "c:\Users\Gregory\Desktop\Y7 Homework\Actual cOMPUTING ASESSMENT\Assesment-Y7\functionality.py", line 30, in coinsv_thread with open('rlog.pkl', 'rb') as handle: ^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'str' object cannot be interpreted as an integer with open('rlog.pkl', 'rb') as handle: ^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'str' object cannot be interpreted as an integer Here is the code: ``` def coinsv_thread(g): #try: if True: import pickle import webclient SERVER_URL = "http://gregglesthegreat.pythonanywhere.com/" with open('rlog.pkl', 'rb') as handle: a = pickle.load(handle) handle.close() if a[0] == 1: my_dict = webclient.get_variable(SERVER_URL, "d_pgp_LOGIN") my_user = my_dict.get(a[1]) my_coins = my_user[1] my_new_coins = int(my_coins) + int(g) my_user[1] = my_new_coins my_dict[a[1]] = my_user webclient.update_variable(SERVER_URL, "d_pgp_LOGIN", my_dict) else: print("Not logged in.") #except Exception as e: # print("Fail: ", e) def coinsv(g): thread = threading.Thread(target=coinsv_thread, args=(g,)) thread.start() ``` I have tried to open the file in the python shell, which works, and I have asked AI online for help.
My ICNN doesn't seem to work for any n_hidden
|machine-learning|pytorch|neural-network|
null
Regarding ForgeRock, openAM and Ping: ForgeRock maintained openAM as open source for quite a time, but stopped maintaining the opensource version some time ago afaik. ForgeRock got merged with Ping recently, that’s why you are probably confused by that. As openAM CE is not well maintained nowadays, I would not recommend to use the latest CE version of it. (The new ForgeRock AM versions are much better documented and do not have the old/new UI issues you describe.) Regarding your CORS question: probably the solution for your problem would be to configure a corresponding CORS filter on Tomcat level that will take care of the CORS handling.
I am using UPnP wizard to try to dynamically open ports, but I can't. I enabled UPnP in my router options. I'm using UPnP wizard that I downloaded from this link: [UPnP wizard](https://upnp-wizard.software.informer.com/2.0/) I downloaded this to check if UPnP works for me, because I wanted to use it for a project where I need dynamic port forwarding This is the error it shows when I open UPnP wizard: [error when opening UPnP wizard](https://i.stack.imgur.com/KHgmn.png) Then, when I try to add a rule like this: [adding port rule](https://i.stack.imgur.com/PuJKS.png) I get this error: [adding port rule error](https://i.stack.imgur.com/bLvit.png) Does the error mean I can't use UPnP with my router? Or is there something I need to do to make it work and there's still hope? Maybe a range or ports I have to use? If UPnP doesn't work on my router, are there other solutions for dynamic port forwarding that might work, even if UPnP doesn't? Thanks.
UPnP dynamic port forwarding error with UPnP wizard
|upnp|
null
I have a ViewPager 2 inside a plannerFragment, which calls 2 fragments: one (localeChoosingFragment) contains a recyclerview for the user to choose a locale, and another to choose places within that locale (localeExploringFragment). A ViewModel (japanGuideViewModel) stores the data (as MutableLiveData), including the int currentLocaleBeingViewed. When the user chooses a locale, this is updated, and an observer in the plannerFragment causes one of the tabs in the PlannerFragment to update with the name of that locale. Clicking that tab the loads the localeExploringFragment for that locale. When the observer in the plannerFragment is triggered, the tab is updated. This causes the recyclerview in the localeChoosingFragment to reset to the first position. As a workaround I have tried using a Handler to automatically scroll the recyclerview to the correct place (according to the ViewModel) but I am confused and concerned about why this is happening. Before using the ViewPager2, I added both (localeChoosingFragment and localeExploringFragment) to a framelayout manually, and tried show/hide and attach/detach, but had the same problem (the recyclerview resetting to the first position). Does anyone know why this could be? It seems a small thing, but I am concerned that there is something going on I don't and should know about, especially this early in the project. That ViewPager 2 is actually part of a fragment that is selected from another ViewPager 2, but I don't think that's what's causing the problem. I will attach a cleaned up version of my code. public class PlannerFragment extends Fragment { Context mContext; JapanVeganGuideViewModel japanVeganGuideViewModel; View plannerFragmentView; ViewPager2 plannerFragmentViewPager2; TabLayout tabLayout; public static final String TAG = "JapanVeganGuideTAG"; public PlannerFragment() { // Empty constructor for fragment Toast.makeText(mContext, "Planner Fragment instantiated", Toast.LENGTH_SHORT).show(); } public PlannerFragment(Context context, JapanVeganGuideViewModel viewModel) { this.japanVeganGuideViewModel = viewModel; this.mContext = context; Log.d(TAG, "Planner Fragment created with context and view model."); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "Planner Fragment onCreate called."); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d(TAG, "Planner Fragment onCreateView initiated."); plannerFragmentView = inflater.inflate(R.layout.fragment_planner, container, false); return plannerFragmentView; } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); Log.d(TAG, "Planner Fragment onViewCreated executed."); plannerFragmentViewPager2 = plannerFragmentView.findViewById(R.id.plannerFragmentViewPager2); tabLayout = plannerFragmentView.findViewById(R.id.plannerFragmentTabLayout); PlannerFragmentViewPager2Adapter plannerFragmentViewPager2Adapter = new PlannerFragmentViewPager2Adapter(getChildFragmentManager(), getLifecycle(), mContext, japanVeganGuideViewModel); plannerFragmentViewPager2.setAdapter(plannerFragmentViewPager2Adapter); plannerFragmentViewPager2.setUserInputEnabled(false); // TabLayoutMediator configuration to be continued... And here is the localeChoosingFragment: public class LocaleChoosingFragment extends Fragment { JapanGuideViewModel japanGuideViewModel; Context mContext; View localeChoosingFragmentView; public static final String TAG = "JapanGuideTAG"; RecyclerView localeChoosingRecyclerView; LinearLayoutManager recyclerViewLayoutManager; LocaleChoosingRecyclerViewAdapter localeChoosingAdapter; SnapHelperOneByOne snapHelper; public LocaleChoosingFragment() { Log.d(TAG, "Empty constructor called for LocaleChoosingFragment"); } public LocaleChoosingFragment(Context context, JapanGuideViewModel viewModel) { this.japanGuideViewModel = viewModel; this.mContext = context; Log.d(TAG, "Constructor called for LocaleChoosingFragment"); Toast.makeText(context, "Creating a new LocaleChoosingFragment", Toast.LENGTH_SHORT).show(); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "onCreate in LocaleChoosingFragment"); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d(TAG, "onCreateView called in LocaleChoosingFragment"); localeChoosingFragmentView = inflater.inflate(R.layout.fragment_locale_choosing, container, false); localeChoosingRecyclerView = localeChoosingFragmentView.findViewById(R.id.localeChoosingRecyclerView); return localeChoosingFragmentView; } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); Log.d(TAG, "onViewCreated in LocaleChoosingFragment."); localeChoosingAdapter = new LocaleChoosingRecyclerViewAdapter(); // ... rest of the code continues } } I was not expecting the RecyclerView in LocaleChoosingFragment to reset to the first position when the observer in the plannerFragment is trigg`your text`ered by the observer on currentLocaleBeingViewed in the View model. Everything else works as expected.
RecyclerView in Fragment Reset with ViewPager Tab Updated
|java|android|android-recyclerview|
null
After using Thymeleaf for server-side rendering in Spring, I saw a post about JTE on Reddit that was mentioning the Spring View Component library https://github.com/tschuehly/spring-view-component, prompting curiosity about different UI design approaches. What are the potential downsides of JTE and patterns that group the view and the logic needed to render it into components instead of having the views in the resources folder? Why does it look like Thymeleafe is the "standard" template engine even though the speed, syntax and the tooling of JTE looks better. What technical challenges or limitations might arise with JTE or such integrated design patterns in terms of scalability, performance, and maintainability in server-side rendering contexts? What is considered to be a modern way of structuring the UI layer of a JVM server side rendered enterprise application?
I believe `settings.gradle` file is not meant to do what you're looking for. You can include all the submodules in the `settings.gradle` file and then link as dependency the module you need in the app's `build.gradle` file, dependencies section: dependencies { ... marketOneImplementation(project(":SubModule2")) marketTwoImplementation(project(":SubModule8")) } In this way, when the `marketOne` flavor is selected then submodule 2 will be included (but not submodule 8). Same when the `marketTwo` flavor is selected.
I wrote a locking (thread- and mulitprocess-safe) wrapper around the standard `shelve` module with no external dependencies: https://github.com/cristoper/shelfcache It meets many of your requirements, but it does not have any sort of backoff strategy to prevent thundering herds, and if you want Reader-Writer lock (so that multiple threads can read, but only one write) you have to provide your own RW lock. However, if I were to do it again I'd probably "just use sqlite". The `shelve` module which abstracts over several different dbm implementations, which themselves abstract over various OS locking mechanisms, is a pain (using the shelfcache `flock` option with gdbm on Mac OS X (or busybox), for example, results in a deadlock). There are several python projects which try to provide a standard dict interface to sqlite or other persistent stores, ex: https://github.com/RaRe-Technologies/sqlitedict (Note that `sqldict` is *thread* safe even for the same database connection, but it is not safe to share the same database connection between processes.)
@Before("staticinitialization(org.mazouz.aop.Main1)") While making the below advice generic @Before("staticinitialization(*.*.*(..))") Im getting the this error Syntax error on token "staticinitialization(*.*.*(..))", ")" expected
Getting an error while making the below staticInitialisation advice generic
|aop|aspectj|aspect|
I wait until the page is loaded and use the "DOMContentLoaded" method to add eventhandlers on some p tags. This works until I open and close the modal, then the page/js freezes. Why does it freeze? ``` <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div id="div_1"> <p>One</p> <p>Two</p> <p>Three</p> </div> <p id="open_modal">open the modal</p> <script> document.addEventListener("DOMContentLoaded", () => { let test = document.querySelector("#div_1") for (let i = 0; i < test.children.length; i++) { test.children[i].addEventListener("click", () => { console.log(test.children[i].innerHTML) }); }; }); document.querySelector("#open_modal").addEventListener("click", () => { if (!document.querySelector("#modal")) { document.body.innerHTML += ` <div id="modal" style="display: block; position: fixed; padding-top: 200px; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.4)"> <div id="modal_content"> <span id="modal_close">&times;</span> <p style="color: green;">Some text in the Modal..</p> </div> </div> `; document.querySelector("#modal_close").addEventListener("click", () => { document.querySelector("#modal").style.display = "none"; }); } else { document.querySelector("#modal").style.display = "block"; }; }); </script> </body> </html> ```
@Before("staticinitialization(org.mazouz.aop.Main1)") While making the below generic @Before("staticinitialization(*.*.*(..))") Im getting the this error Syntax error on token "staticinitialization(*.*.*(..))", ")" expected
> I was given this hypothetical block of code, where although the language used is Java, and Java uses call by value, in this case call by reference Java isn't that kind of language. In some languages, notably C (as well as, oversimplifying a bit, Rust) you can specify on a per-parameter basis whether it is pass-by-ref or pass-by-value. _But in java you cannot do that_. A parameter is pass-by-value. _Period_. You can't configure it to be pass-by-ref. __However__. All types in java are _references_, except the primitives. The primitives are hardcoded. It's: `long`, `int`, `short`, `byte`, `float`, `double`, `boolean`, and `char`. That's the list. It's set in stone. You can't make your own. The list will never change. Everything else is a reference type. _including_ `String`. That means every value __is a pointer__. These pointers are passed-by-value. But they are pointers. ## So what does that mean for primitives? They are passed by value, and there are no complications here. Hence, __none what you said is going to work that way__ because when you call `foo(x)` or even `foo(arr[x])`, the value (i.e. a __copy__) is handed to the method. The method can do whatever it wants with the value it got; this will not modify either your `x` variable or the entry in your array, at all: ``` class Test { public static void main(String[] args) { int a = 5; int[] b = new int[10]; increment(a); increment(b[0]); System.out.println(a); // prints 5. Never 6. System.out.println(b[0]); // prints 10. Never 11. } public static void increment(int v) { v = v + 1; } } ``` That `increment` method does nothing and nothing you're going to do is ever going to change that. __There is no code you can put in the body of `increment` that would make this work__. A method that takes an `int` value __cannot__ modify it in the caller. ## What does that mean for non-primitives It's complicated. The best way to think about objects is a humongous beach. It's vast, nearly infinite. And objects are treasure. `new` makes new treasure: A treasure chest pops into existence, but, the rule is, all treasure must always be buried. So you bury it immediately. Variables cannot possibly hold treasure chests, this whole system works on treasure maps. So: ``` List<String> list = new ArrayList<String>(); ``` This says: 1. `new ArrayList`: Create a treasure chest. It pops into existence and is buried. Objects have no name. Hence, this object is not called `list`. It has no name. 2. `List<String> list`: Create a treasure map. It is small (just a piece of paper), and has a name. It's name is list. It is restricted: It can be blank, or, it is a map with 'X marks the spot' - but if it's that, there is _necessarily_ a treasure chest buried at X, and that is a chest of the `List<String>` type. 3. We draw a map to the buried treasure on the piece of paper called `list`. (that's what the `=` does). Now, know that `[]` and `.` are java for 'follow the map, get out a shovel, and dig'. So: ``` list.add("Hi"); ``` Says: Take the treasure map called `list`. Follow it and dig. Open the treasure chest. Open it, yell `add` at it, handing it __a copy of a treasure map__`. Because `"Hi"` is itself an expression of a non-primitive type, so it is a treasure map. In contrast, `=` is 'wipe out a map and re-assign it'. Hence: ``` int[] x = new int[1]; x[0] = 5; foo(x); System.out.println(x.length); // 1 System.out.println(x[0]); // 10 void foo(int[] arr) { arr[0] = 10; arr = new int[] {1, 2, 3}; } ``` Here `foo` is interesting. The `arr[0]` really is 'visible' to the caller. After all, `[]` is java-ese for 'follow the map, grab a shovel, an dig'. So, you have a map that leads to treasure, you make a copy of this map and hand me the map. I then follow my map (which is a copy of your map), dig, and do something to the box. If you then later also follow _your_ map and dig, you see what I did (`System.out.println(b[0])` also uses `[]`, so, also follows the map and digs). However, foo's `arr = new int[] {1,2,3};` has no effect. Because `=` is 'wipe the map and draw a new map to a new treasure'. You wipe out your __copy__ of my map. That has no effect on my map. ## So how do I do primitives pass-by-ref? You don't. Java does not make it possible. You can use an `AtomicInteger` or a `new int[1]` to do the job. Or make a class definition that captures the parameters and has setters, and pass one of those. That layer of indirection allows you to do it. ## Wait.. Strings are references, so this means I need to make defensive copies?? No. If a class def makes it impossible to modify it, then it doesn't matter: You can hand out copies of your treasure map to valuable treasure __if__ that treasure is made out of indestructible unobtainium. String has __no__ methods whatsoever to modify it. things like `.toLowerCase()` does not modify the string; it makes a new string (new treasure) and returns it (returns a map to it, to be specific).
Upon trying to output the roles on page ListRoles.cshtml with the admin account in this project it gives me System.NullReferenceException: 'Object reference not set to an instance of an object.'... I think the problem is in the Can anyone tell me how to fix it please! have tried some things but nothing worked. Here's the project: [text](https://github.com/bul-bbx/Rent_A_Car)
I have a problem outputing the roles on the page ListRoles.cshtml
|c#|asp.net-mvc|razor|asp.net-identity|.net-6.0|
null
Why don't you just validate first and then try the update? you can use one of this two examples: public function update(UpdateUserRequest $request, string $id) { $validator = Validator::make($request->all(), $request->rules()); if ($validator->fails()) { return response()->json(['errors' => $validator->errors()], 422); } $user = User::findOrFail($id); $user->update($request->all()); ... --- public function update(UpdateUserRequest $request, string $id) { $validData = $request->validated(); // if not valid it throws error or anything you change in failedValidation() method $user = User::findOrFail($id); $user->update($validData); ...
I have lost my phone. Device is logged to Google account, has Find My Device enabled and is also logged to Samsung account and has SmartThings Find enabled. If I log into Google's Find My Device app website, it thinks for a while and then announces that it can't contact the device. It doesn't show last known location. If I try to log into Samsung SmartThings Find website, it errors out: [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/YDSn2.png
How can I find a lost Samsung Device?
|mobile|samsung-galaxy|
I know in HTML 4 it's necessary, but is that still so regarding HTML5? I only ask because I heard in HTML5 it is not necessary.
Is it still necessary to use the rel="stylesheet" attribute value for the <link> tag in HTML5?
Im creating my own version of a `MarkDown` render. My goal is to read a string or file line by line then return the `MD` rendered as `HTML`. The problem im facing is my return and line by line functionaility is not-returning what I want and I dont know why. Ive tried debugging but everything seemed fine. Ive also tried chaning my for loop but still no luck. ```js //function used to render MD for the user function render(md){ let code = ""; //For functions return let mdLines = md.split('\n'); for(let i = 0; i < mdLines.length; i++){ //Statements to see what kind of MD header a line is. //I only have these statments as I just started this and am still figuring how I want to approach. if(mdLines[i].slice(0, 1) == "#"){ code += code.concat("<h1>" + mdLines[i].replace("#", "") + "</h1>") } if(mdLines[i].slice(0, 2) == "##"){ code += code.concat("<h2>" + mdLines[i].replace("##", "") + "</h2>") } if(mdLines[i].slice(0, 3) == "###"){ code += code.concat("<h3>" + mdLines[i].replace("###", "") + "</h3>") } if(mdLines[i].slice(0, 4) == "####"){ code += code.concat("<h4>" + mdLines[i].replace("#", "") + "</h4>") } if(mdLines[i].slice(0, 5) == "#####"){ code += code.concat("<h5>" + mdLines[i].replace("#", "") + "</h5>") } if(mdLines[i].slice(0, 6) == "######"){ code += code.concat("<h6>" + mdLines[i].replace("######", "") + "</h6>") } }; return code; } //editor //This is what the users .js file would be. //I have it set up like this for testing. let text1 = "## he#llo \n there \n# yooo" let text2 = "# he#llo \n there \n## yooo" console.log(render(text1)); console.log(render(text2)); ``` text1 returns `<h1># he#llo </h1><h1># he#llo </h1><h2> he#llo </h2>` text2 reutrns `<h1> he#llo </h1>` text1 should return `<h2>he#llo</h2> there <h1> yooo </h1>` text2 should return `<h1> he#llo </h1> there <h2> yooo </h2>` If someone could help me get the proper returns and some potentially reusable code for this issue it would be greatly appreciated. Ive also looked up the issue with some select terms but it seems no one has documented my very specific issue. Also for those saying it's a beginner issue just use Elseif, I did that. It dont work. Soooooo..... womp womp.
Pyside6, tableView.selectedIndexes, list index out of range
|python-3.x|indexing|qtableview|pyside6|
null
I think its problem is your code line 77 `Map<String,Dayanamic> data= sanpshot.data...` try to impliment your code like this: StreamBuilder<QuerySnapshot>( stream: FirebaseFirestore.instance.collection('users').snapshots(), builder: (context, snapshot) { if (snapshot.hasError) { return Text('Error: ${snapshot.error}'); } switch (snapshot.connectionState) { case ConnectionState.waiting: return Center(child: CircularProgressIndicator()); default: return ListView.builder( itemCount: snapshot.data!.docs.length, itemBuilder: (context, index) { final user = snapshot.data!.docs[index].data(); return ListTile( title: Text(user['username']), leading: CircleAvatar( backgroundImage: NetworkImage(user['profilePic']), ), ); }, ); } }, ),
[The question mark is reserved in HTTP URLs. <sup>[RFC 1738]</sup>][1] It represents the start of query parameters in HTTP URLs. In your case, the URL parameter ends where the symbol ***?*** is found and the query parameters begin from there. Django simply follows the [URL specification][2]. [1]: https://datatracker.ietf.org/doc/html/rfc1738#section-3.3 [2]: https://datatracker.ietf.org/doc/html/rfc1738
|c|pointers|pass-by-reference|pass-by-value|pointer-to-pointer|
this here is my formSlice and i m getting Expression expected after the closing brackets of the builder and the arrow function ``` import { createAsyncThunk, createReducer, createSlice } from "@reduxjs/toolkit"; import axios from "axios"; export const getform = createAsyncThunk("form/getForm", async () => { try { const result = await axios.get("http://localhost:5000/autoroute/"); return result.data; } catch (error) {} }); export const addform = createAsyncThunk("form/add", async (form) => { try { const result = await axios.post("http://localhost:5000/autoroute/", form); return result.data; } catch (error) {} }); export const deleteform = createAsyncThunk("form/deleteForm", async (id) => { try { const result = await axios.delete(`http://localhost:5000/autoroute/${id}`); return result.data; } catch (error) {} }); export const updateform = createAsyncThunk( "form/deleteForm", async ({ id, form }) => { try { const result = await axios.put(`http://localhost:5000/autoroute/${id}`, form); return result.data; } catch (error) {} } ); createReducer(initialState, builder = { form: [], status: null, }); export const formSlice = createSlice({ name: "form", initialState, reducers: {}, extraReducers: builder =>{ builder.getform(pending, (state) => { state.status = "pending"; }), builder.getform(pending, (state) => { state.status = "success"; }), builder.getform(pending, (state) => { state.status = "fail"; }), }, }); // Action creators are generated for each case reducer function // export const { increment, decrement, incrementByAmount } = counterSlice.actions; export default formSlice.reducer; ``` it says expression expected after the closing bracket builder of the extrareducers i was working on an older version of the reduxtoolkit but the error showed me that i need to match my code with the newer version
Can we call JSTL or Custom Tag Libraries from inside of Thymeleaf? We have numerous tags that we have built over the years and would prefer to not transform them to Thymeleaf Fragments.
null
Its better to have a Airflow DAG which has constant/stable definition i.e. tasks of the DAG are not changing when its executing. Problem with dynamic DAG is, its definition/tasks executed might change when the DAG is already executing. If in any case there is need of dynamic DAG, the min_file_process_interval should be set to value which is higher than execution time of the DAG so that new definition is not fetched during current execution.
|sql-server|azure-databricks|azure-synapse|
When I try and open the pickle file, this error appears: ``` Exception in thread Thread-1 (coinsv_thread): Exception in thread Thread-2 (coinsv_thread): Traceback (most recent call last): Traceback (most recent call last): File "C:\Users\Gregory\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1073, in _bootstrap_inner File "C:\Users\Gregory\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1073, in _bootstrap_inner self.run() File "C:\Users\Gregory\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1010, in run self.run() File "C:\Users\Gregory\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1010, in run self._target(*self._args, **self._kwargs) File "c:\Users\Gregory\Desktop\Y7 Homework\Actual cOMPUTING ASESSMENT\Assesment-Y7\functionality.py", line 30, in coinsv_thread self._target(*self._args, **self._kwargs) File "c:\Users\Gregory\Desktop\Y7 Homework\Actual cOMPUTING ASESSMENT\Assesment-Y7\functionality.py", line 30, in coinsv_thread with open('rlog.pkl', 'rb') as handle: ^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'str' object cannot be interpreted as an integer with open('rlog.pkl', 'rb') as handle: ^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'str' object cannot be interpreted as an integer ``` Here is the code: ``` def coinsv_thread(g): #try: if True: import pickle import webclient SERVER_URL = "http://gregglesthegreat.pythonanywhere.com/" with open('rlog.pkl', 'rb') as handle: a = pickle.load(handle) handle.close() if a[0] == 1: my_dict = webclient.get_variable(SERVER_URL, "d_pgp_LOGIN") my_user = my_dict.get(a[1]) my_coins = my_user[1] my_new_coins = int(my_coins) + int(g) my_user[1] = my_new_coins my_dict[a[1]] = my_user webclient.update_variable(SERVER_URL, "d_pgp_LOGIN", my_dict) else: print("Not logged in.") #except Exception as e: # print("Fail: ", e) def coinsv(g): thread = threading.Thread(target=coinsv_thread, args=(g,)) thread.start() ``` I have tried to open the file in the python shell, which works, and I have asked AI online for help.
I am using Sybase as our db and I have a query where I need to ensure that I only return one record. I have the following query that is returning more than one record and in Sybase you can't use MAX or TOP 1. What are some alternative ways to ensure that only 1 record is returned using the following query. I am also needing to do an "order by rate.effective_date desc" at the end of the query because I need to ensure the most recent date is returned also: ``` select @sign_off_amount = -- dps minutes * dpy rate --dps duration, dps is in minutes convert(money, ( select oper_sign_off*1.0/60 from dps_parms where (@effective_dt between effective_dt and expires)) * -- dpy rate/hr ( select rate.rate_amount from drv_pay..work_type_sub_category wtsc ,drv_pay..rate rate where wtsc.work_type_sub_desc = 'SIGN OFF TIME' and (wtsc.effective_date <= @effective_dt and wtsc.expire_date >= @effective_dt or wtsc.expire_date = NULL) and wtsc.work_type_seq_nbr = rate.work_type_seq_nbr and rate.full_part = 'F' and (rate.effective_date <= @effective_dt and (rate.expire_date >= @effective_dt or rate.expire_date = NULL)))) ``` I have tried to use SET ROWCOUNT 1 and SET ROWCOUNT 0 but cannot figure out where to put the syntax for that either.
How can i code in openpyxl for draggin formula filled down, similarly copy and paste in excel? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
PDO how to get key-value pairs from getchAll()?
I also found if your webcam didn't close right or something is using it, then CV2 will give this same error. I had to restart my PC to get it to work again.
{"OriginalQuestionIds":[7451126],"Voters":[{"Id":285587,"DisplayName":"Your Common Sense","BindingReason":{"GoldTagBadge":"pdo"}}]}
You'll find the code below Im not sure why this is happening, but I am still learning c++ so im not gonna be surprised if its something small and dumb lol ``` #include <iostream> void idcheck(); int main(){ bool houseID = 151; bool ID; int house1 = 1; int house2 = 2; int house3 = 3; std::cout << "*****Welcome to miniclean property managers*****\n"; std::cout << "Please enter your airBnB's address: "; std::cin >> ID; if (ID = houseID) { idcheck(); } return 0; } void idcheck(){ bool code = 144794221; int checkC; std::cout << "Please enter code: "; std::cin >> checkC; switch (checkC) { case '144794221': std::cout << "Thankyou, your house code is 8868. Enjoy your stay!"; break; default: std::cout << "Incorrect code, please try again"; break; } } ``` The code is meant to be able to be used to check into airbnbs with an access code, but the code is completely ignoring the switch and displaying this *****Welcome to miniclean property managers***** Please enter your airBnB's address: 151 Please enter code: Incorrect code, please try again So im a bit confused, help would be appreciated, thanks!
How come the switch in my idcheck code running instantly before I actually enter an input?