Flatpak Installation Error: Read-only file system Posted: 12 Oct 2021 08:10 AM PDT I need to generate a Flatpak package for an application. Application .desktop file is copied into /usr/share/applications/my-app/ folder when it is installed by deb package. But it gives error when I try to generate Flatpak package by using flatpak-builder build-dir my-app.yml command. Error: error: could not create '/usr/share/applications/my-app.desktop': Read-only file system Here is the code from the .yml file: - name: my-app buildsystem: simple build-commands: - python3 setup.py install --prefix=/app . . . post-install: - install -Dm644 files/my-app.desktop /app/share/applications/my-app.desktop It tries to copy .desktop file into /usr/share... folder instead of /app/... folder even if --prefix=/app is used. What is the solution for that? |
Calling macro variables in SAS Posted: 12 Oct 2021 08:10 AM PDT I'm working with SAS enterprise 7.1 and I would like to know if there's any difference between calling a macro variable with &var. vs &var, that is, without the final dot. In general, I see that both methods work, but I would like to know if there's something that I'm missing. Thanks in advance! |
Is it possible to use both a certificate and UserName credential type with a service? C# Posted: 12 Oct 2021 08:10 AM PDT I am working on a project that makes requests to an API. The API requires an X509 certificate as a credential to be able to make requests. After referencing the service for the client and trying to make some requests, I was told that my requests were also missing a UserName header credential in order to authenticate with the API. Is it possible to use both types of credentials in a request and if so would anyone know how to set it up? Sorry if this post is poorly made, this is my first post on this website. |
SDE Spatial/Attribute Index Flagging through FME Posted: 12 Oct 2021 08:10 AM PDT We have some automated processes whose SDE readers take in large amounts of data, and they take a hit whenever they encounter corrupted or missing indexes. We are considering setting up some 'helper' processes to examine the indexes separately before the data is read in the main workflow. I know, for example, that there's ArcPy methods such as ListIndexes that can be used to check some of their properties for any given feature. I'm wondering if FME can natively do something similar and without, say, calling ArcPy through a PythonCaller? Are there any exposable parameters or validation tools (or does anyone have an approach) that could be used to examine the SDE's spatial and attribute indexes and flag problematic ones? |
Can someone explain this to me as though im 5 - Python Posted: 12 Oct 2021 08:10 AM PDT Just doing the python course on Kaggle and were on a section of strings / dictionaries.. the task is to return true if there is a keyword present in a list of phrases. People say python is very easy to learn and understand, but im having more trouble than I did when trying to learn C# Java etc.. The solution given is this. doc_list = ["The Learn Python Challenge Casino", "They bought a car, and a horse", "Casinoville?"] keyword = 'casnio' def word_search(documents, keyword): ind = [] for doc in documents: lst = doc.split() up_lst = [word.rstrip(',.').upper() for word in lst] if keyword in up_lst: ind.append(documents.index(doc)) return ind when i try to break this down to how I would write it and as i understand it, in another language it doest work.. can someone explain why and where I am going wrong. doc_list = ["The Learn Python Challenge Casino", "They bought a car, and a horse", "Casinoville?"] keyword = 'casnio' def word_search(documents, keyword): ind = [] up_lst = [] for doc in documents: lst = doc.split() for word in lst: up_lst.append[word.rstrip('.,').upper() if keyword in up_lst: ind.append(documents.index(doc)) return ind instead of outputting [0] as the first one does, it outputs [0,1,2] Its things like this that im struggling with to the point of wanting to give up becasue it just does not make any damn sence to me. So if anyone has the time to explain to me, i would be more than greatful. |
Implementing Retry call button for Retrofit 2 Posted: 12 Oct 2021 08:10 AM PDT I am using MVVM pattern for my Android app. Everything looks so good. But when a network error occur, I need to show a Snackbar with a Retry button for call that API again. my question is . How to call the API again to get posts when click Retry button ? Repo public LiveData<ResultApi<List<Post>>> getPosts(){ MutableLiveData<ResultApi<List<Post>>> posts = new MutableLiveData<>(); posts.setValue(ResultApi.loading(null)); Api api = RetrofitInstance.getRetrofitInstance().create(Api.class); Call<List<Post>> call = api.getPosts(); call.enqueue(new Callback<List<Post>>() { @Override public void onResponse(@NonNull Call<List<Post>> call, @NonNull Response<List<Post>> response) { if (response.body() != null){ posts.setValue(ResultApi.success(response.body())); } } @Override public void onFailure(@NonNull Call<List<Post>> call, @NonNull Throwable t) { posts.setValue(ResultApi.error(t.getMessage(),null)); } }); return posts; } ViewModel Repo repo; LiveData<ResultApi<List<Post>>> posts; public MyViewModel() { repo = new Repo(); posts = repo.getPosts(); } public LiveData<ResultApi<List<Post>>> getPosts(){ return posts; } Main Activity MyViewModel myViewModel = new ViewModelProvider(this).get(MyViewModel.class); myViewModel.getPosts().observe(this, new Observer<ResultApi<List<Post>>>() { @Override public void onChanged(ResultApi<List<Post>> listResultApi) { switch (listResultApi.status){ .... case ERROR: pb.dismiss(); Snackbar.make(recyclerView,"error",Snackbar.LENGTH_LONG).setAction("Retry", new View.OnClickListener() { @Override public void onClick(View v) { //call the API again } }).show(); break; } } }); |
I specified DML device use for python but still python doesnt recognise it Posted: 12 Oct 2021 08:09 AM PDT python code and errors I am working on a ML project but i dont have nvidia gpu. I have an AMD radeon RX and i am trying to run the project through DML device. As you can see in foto i have told python to use my dml device but still gives me the error that some tasks are explicitly assigned to /device:GPU:0...i have tried anything i ve seen on internet but still get it...does anyone know where i can fix the source code of default devices?? |
Grant Stores not being called when authenticating with Identity Server 4 Posted: 12 Oct 2021 08:09 AM PDT I have setup Identity Server 4 with customized stores for authorization codes, refresh tokens, reference tokens and user consents. They are setup this way: public void ConfigureServices(IServiceCollection services) { services.AddScoped<IUserRequester, UserRequester>(_ => new UserRequester(Configuration.GetSection("AzureTableStore.UserLogin").Get<TableStoreConfiguration>())); services.AddControllers().AddNewtonsoftJson(options => options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver()); X509Certificate2 certData = DownloadCertificate(Configuration.GetSection("APICertificate").Get<Secret>()); IIdentityServerBuilder builder = services.AddIdentityServer().AddSigningCredential(certData); builder.AddInMemoryClients(Clients.Get()); builder.AddInMemoryIdentityResources(Identities.Get()); builder.AddInMemoryApiResources(Apis.GetResources()); builder.AddInMemoryApiScopes(Apis.GetScopes()); builder.Services.Configure<TableStoreConfiguration>(Configuration.GetSection("AzureTableStore.UserLogin")); builder.Services.Configure<RedisConfiguration>(Configuration.GetSection("RedisCache")); builder.Services.AddTransient<IRedisConnection, RedisConnection>(); builder.Services.AddTransient<IUserRequester, UserRequester>(); builder.Services.AddTransient<IProfileService, ProfileService>(); builder.Services.AddTransient<IResourceOwnerPasswordValidator, PasswordValidator>(); builder.Services.AddTransient<IAuthorizationCodeStore, AuthorizationCodeStore>(); builder.Services.AddTransient<IReferenceTokenStore, ReferenceTokenStore>(); builder.Services.AddTransient<IRefreshTokenStore, RefreshTokenStore>(); builder.Services.AddTransient<IUserConsentStore, UserConsentStore>(); services.AddSwaggerGen(c => { // Set the swagger doc stub c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1", Title = "Authentication" }); // Set the comments path for the Swagger JSON and UI. string xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; string xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); c.IncludeXmlComments(xmlPath); }); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Authentication v1")); } app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Authentication API v1"); c.RoutePrefix = string.Empty; }); app.UseHttpsRedirection(); app.UseRouting(); app.UseIdentityServer(); app.UseAuthorization(); app.UseEndpoints(endpoints => endpoints.MapControllerRoute( name: "default", pattern: "{controller}/{action=Index}/{id?}")); } The problem I'm having is that, when I debug into the service when authenticating a user, I notice that none of my stores are called. Furthermore, I notice that Identity Server logs that it's still using the in-memory grant store. So then, how do I tell Identity Server that it should use my stores? I've followed the guide, here, and it seems to indicate that I need custom impelmentations of IPersistedGrantStore and IPersistedGrantService but I can't fathom why I should need both. Any explanation would be helpful. |
Vue / Vuetify: Search and filter as I type rather than key enter Posted: 12 Oct 2021 08:09 AM PDT I currently have a search setup that when I press enter the search method is called. What I would like to do is rather than lookup the speech is retrieve all results and hen filter down matching the search criteria. Any advice? I also have a chip group that filers by type which I would like to work with and independently to the search field. Search: <v-text-field v-model="searchQuery" prepend-inner-icon="search" placeholder="Search Content Library" solo clearable @keyup.enter="search" /> Chip group: <v-chip-group v-model="selectedFilters" multiple @change="handleChange" > <v-chip v-for="item in assetFilters" :key="item" outlined filter :value="item" > {{ item }} </v-chip> </v-chip-group> Data: data () { return { assetFilters: ['powerpoint', 'pdf', 'image', 'video', 'link', 'text'], selectedFilters: [], searchQuery: null, Method: handleChange () { console.log('asset filter change: method', this.selectedFilters) this.search() }, search () { bus.$emit('send_socket_message', { messageType: 'asset', subtype: 'searchAssets', query: this.searchQuery, assetType: this.selectedFilters }) }, |
Does having relational tables affect the performance/scalability when using TimescaleDB? Posted: 12 Oct 2021 08:09 AM PDT The chunk partitioning for hypertables is a key feature of TimescaleDB. You can also create relational tables instead of hypertables, but without the chunk partitioning. So if you have a database with around 5 relational tables and 1 hypertable, does it lose the performance and scalability advantage of chunk partitioning? |
OnPointerEnter is only called when pressing button with OVRInputModule & OFRRaycaster (Oculus Quest 2 - Unity) Posted: 12 Oct 2021 08:09 AM PDT I'm using the OVR Input Module. (and so the OVRRaycaster on my canvas) Canvas render mode : World space Everything works fine except the OnPointerEnter event which is only called when pressing the 'A' button of the oculus controller. OnPointerEvent should be called when the LaserPointer enters the RectTransform of the ui element but .. it doesn't work like that... Tried with a custom script & an EventTrigger and, of course, the results are the same. public class OnPointerEnterTest : MonoBehaviour, IPointerEnterHandler { public void OnPointerEnter(PointerEventData eventData) { Debug.Log("OnPointerEnter"); } } Does anyone have an idea or a workaround ? Too lazy to debug OVRInputModule & Raycaster for the moment ... Thank you very much if u got a solution ;) |
child templates in custom component v-data-table Posted: 12 Oct 2021 08:09 AM PDT I am creating a general component based on v-data-table. This component has templates that are displayed anywhere, such as: ..template v-slot:item.index="{ item }"> .... The idea is to be able to pass custom templates as children of the component, in this case I would like to pass "..template v-slot:item.state="{ item }"> ..." As you can see, in the source code of the ..[DataTableFuntional>] <v-data-table... component there is a commented template (..template v-slot:item.state="{ item }">) which works perfectly. But it does not suit my need since that way I would have to pass props to activate or deactivate the template because not all tables would always carry that field called "state" DataTableFuntional component <template> <div> <v-data-table class="tableBackground" :dense="dense" :headers="headers" :items="items.data" :options.sync="options" no-data-text="No hay datos disponibles" :loading-text="$t('comunes.general.cargando')" > <!-- Custom templates --> <template v-slot:body.append> <slot name="body2"></slot> </template> <template v-slot:item.state="{ item }"> <slot name="state"></slot> </template> <!-- <template v-slot:item.state="{ item }"> <div class=""> <span v-if="item.state === 1" color="red">Close</span> <span v-else-if="item.state === 2" color="green">Open</span> </div> </template> --> <!-- Default templates --> <template v-slot:item.index="{ item }"> {{ items.data.indexOf(item) + 1 }} </template> </v-data-table> </div> </template> Now, if we see this code, which is the previous component imported in any page of the site. We see that there are two "slots": v-slot: state" and "v-slot: body2" that are shown correctly, but if we see the code of the v-data-table> ... we can see that it is necessary to specify the v -slot in the template, for example: <template v-slot: item.state = "{item}"> <slot name = "state"> </slot> </template>. now, if we see the first tamplate: <template v-slot: item.state = "{item}"> <div class = ""> <span v-if = "item.state === 1" color = "red"> Close </span> <span v-else-if = "item.state === 2" color = "green"> Open </ span > </div> </template> This would be the way I would more or less like to be able to assign new templates to the v-data-table component. but it does not work. if we see the following template <template v-slot: state> {{'Hello'}} </template> This does work but I don't know how to access the item to be able to set the conditions according to the state. imported DataTableFuntional component whit child templates <DataTableFuntional :ref="'reference'" :endpoint="item.endpoint" :headers="item.headers" :actions="item.actions" :btsmall="true" > <!-- Custom templates --> <template v-slot:item.state="{ item }"> <div class=""> <span v-if="item.state === 1" color="red">Close</span> <span v-else-if="item.state === 2" color="green">Open</span > </div> </template> <template v-slot:state> {{'Hello'}} </template> <template v-slot:body2> <tr> <td></td> <td> <v-text-field type="number" label="Less than" ></v-text-field> </td> <td colspan="4"></td> </tr> </template> </DataTableFuntional> |
I am getting a chrome error problem how can I fix it? Posted: 12 Oct 2021 08:09 AM PDT unknown-error-cannot-find-chrome-binary-error I get this every time I run a program that requires google chrome to launch please help thanks. |
align text and button bottom of picture Posted: 12 Oct 2021 08:09 AM PDT I try to do like in this website : https://firster.win/ for understand bootstrap but i dont very good understand how can i put text and button bottom of picture like in this website. <html> <head> <meta charset="utf-8"> <!-- CSS only --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> <link rel="icon" href="124010.png"> <style> img{ max-width:100%; } </style> <title>FacebookMusic</title> </head> <body> <div class="container"> <div class="row"> <div class="col"> <img class="img-responsive" src="dF5SId3UHWd.svg" alt="image1"> <h3>Helps you to always listen to your favorite tracks offline. Get your free 6-month subscription. You can also download the desktop version of the player</h3> </div> <div class="col"> <img class="img-responsive" src="bg.png" alt="image2"> </div> </div> </div> </body> </html> i try to understand bootstrap grid put dont understand why dont want to put in bottom of picture like in website i have try to add but not the same, and i cant to do the same button how can i do ? and how do space from top without do padding-top i try to do photocopy of this website I'm begginer i need little help |
Plot variable of Mixed Effect Model controlling for others in ggplot Posted: 12 Oct 2021 08:10 AM PDT I run a mixed model and I would like to plot the fixed effect of one variable (z_uncertainty ) on the dependent variable (z_rating ) while controlling for the effect of the other variables using ggplot . I would also like to plot CI around the line. here's the code to create the model mixed_model <- lme(z_rating~z_Market_change+Instr+z_uncertainty, random=~1+z_Market_change+Instr+z_uncertainty|ID_n, data=share, method ='ML',control=lmeControl(opt='optim')) |
How to set param for controller prefix? Posted: 12 Oct 2021 08:10 AM PDT I want to get module parametr from contoller prefix in request object. @Controller('/:module(app)') Now in request object, I get param object like this: params: { '0': 'app' }, Why not ? params: { module: 'app' }, UPD: I have this problem only in middleware |
Searching a vector for a string, and then find the position of the string in c++ Posted: 12 Oct 2021 08:09 AM PDT I am trying to erase a string from a text file. To do this, I want to read the file into a vector, then I want to search for the position of this string, so I can use vector::erase to remove it. After the string has been erased from the vector, I can write the vector into a new file. So far, I have made all of that, but finding the position of the string. I've found all sorts of solutions using < algorithm > 's std::find, but those answers were trying to check if this string exists, not its position. Here is an example of how the text file is set up. With a string, followed by an integer, followed by .txt without spaces. Each string is on a newline. file123.txt Bob56.txt' Foo8854.txt In this case, the vector would be "file123.txt", "bob56.txt", "Foo8854.txt". This is the code I have made already: std::vector<std::string> FileInVector; std::string str; int StringPosition; std::fstream FileNames; FileNames.open("FileName Permanent Storage.txt"); while (std::getline(FileNames, str)) { if(str.size() > 0) { FileInVector.push_back(str); // Reads file, and this puts values into the vector } } //This is where it would find the position of the string: "bob56.txt" as an example FileInVector.erase(StringPosition); // Removes the string from the vector remove("FileName Permanent Storage.txt"); // Deletes old file std::ofstream outFile("FileName Permanent Storage.txt"); // Creates new file for (const auto &e : FileInVector) outFile << e << "\n"; // Writes vector without string into the new file |
How to Align Circles in table columns to the left? Posted: 12 Oct 2021 08:10 AM PDT I am new to html and trying to create a table of events that are presented as circles. I used this code to create each circle : td { border: 1px solid red; } svg { border: 1px solid blue; } <table> <tr> <td style='column-width: 3px;padding-top: 30px;text-align: left;'><svg width='50' height='50'><circle cx='2' cy='2' r='2' fill='#ff8B45'/><title>date</title></svg></td> </td> </tr> </table> My problem is that I cant find a way to align them to the left, they start from the right of the table and the more circles there is it goes more to the right... I want it to start from the left leaving space on the right. can anyone tell me how do I make that happen? |
transform julian day with decimal to date and hour in R Posted: 12 Oct 2021 08:10 AM PDT I have to convert on R a column with julian dates with decimal part (as parts of the day) to date and hour. I tried this function : as.Date(10625.15, origin=as.Date("1990-01-01 00:00:00")) But it only gave me the date without the times : "2019-02-02" Someone can help me to resolve it ? Thanks in advance!! |
Duplicating rows in one table based on duplicates in another table Posted: 12 Oct 2021 08:09 AM PDT I have two SQL Server tables: Request table: Request_no | Request_ver_no | Sketch_no | Sketch_rev ------------+------------------+-------------+------------- 1000 1 11-111 1001 1 22-222 1001 2 22-555 1002 1 33-333 TFC table: Request_no | Request_ver_no | TFC_no | Sketch_no+rev ------------+------------------+----------+---------------- 1000 1 1 11-111 1000 1 2 11-111A 1000 1 3 11-111B 1001 1 1 22-222 1001 1 2 22-222A 1001 2 1 22-555 1001 2 2 22-555A 1002 1 1 33-333B My problem is that I need to fill in the sketch revision into the Request table, but there is more than one entries with unique sketch revision per unique Request_no and Request_ver_no PK. A possible solution was to duplicate the rows in Request which has more than one unique sketch revision connected to it from TFC , and then implement a new index to differentiate these duplicates (Requests with only one unique sketch connected is set at 1 otherwise). For each duplicated Request entry the sketch revision (the last letter of Sketch_no+rev in TFC ) is copied into Sketch_rev in Request . The index is also iterated and set for every duplicate Request entry. For all the other cases without more than one sketch revision connected to the same Request entry, the revision is just copied over normally. Ideally the end result would look like this: Request table: Request_no | Request_ver_no | Sketch_no | Sketch_rev | Index ------------+------------------+-------------+--------------+-------- 1000 1 11-111 1 1000 1 11-111 A 2 1000 1 11-111 B 3 1001 1 22-222 1 1001 1 22-222 A 2 1001 2 22-555 1 1001 2 22-555 A 2 1002 1 33-333 B 1 (Blank is regarded as first revision) Don't know quite where to begin. Can someone please help me out with this query? |
Random string from vector C++ Posted: 12 Oct 2021 08:10 AM PDT I have a question about this code. I got what I was expecting but I don't understand why sometimes I get the result and sometimes not. In this case, the output suppose to show the word "dive" every time I run the code but sometimes the output is not giving me any value. Is it because the if statement? How can I get always the result("dive") and not sometimes? #include <iostream> #include <string> #include <vector> #include <ctime> using namespace std; int main() { srand(time(NULL)); vector <string> Words = {"dive", "friends", "laptop"}; string n_words = Words[rand() % Words.size()]; for(int i = 0; i < 1; i++) { if(n_words.length() <= 4) { cout << n_words << endl; } } } EDIT ANOTHER EXAMPLE: I would like to pick up a random word not longer than 4 letters from a list of words with differents lengths. When I run my code sometimes I get "dive" sometimes "lego" and sometimes nothing. Is there any way to get always some of this two values ? #include <iostream> #include <string> #include <vector> #include <ctime> using namespace std; int main() { srand(time(NULL)); vector <string> Words = {"dive", "table", "laptop", "lego", "friends"} string n_words = Words[rand() % Words.size()]; for(int i = 0; i < 1; i++) { if(n_words.length() <= 4) { cout << n_words << endl; } } } |
PySide6: Convert a nested Python OrderedDict into a QJSValue Posted: 12 Oct 2021 08:09 AM PDT I have some nested python OrderedDicts, e.g # The Object we need to convert od = OrderedDict( [ ('header', OrderedDict( [ ('stamp', OrderedDict( [ ('sec', 42), ('nanosec', 99) ] ) ), ('frame_id', 'world') ] ) ), ('name', ['x', 'y', 'z']), ('position', [1.0, 2.0, 3.0]), ('velocity', [0.0, 0.0, 0.0]), ('effort', [0.0, 0.0, 0.0]) ] ) And I need to convert this into a QJSValue. The function that does this can be given a QJSValue prototype if needed. Here is a prototype for the above value. This might makes things easier, especially when it comes to converting the list parts. # A JS Prototype that has the feilds and types, and just needs its values populating app = QCoreApplication() engine = QJSEngine() joint_state_msg_js = engine.newObject() header_msg_js = engine.newObject() stamp_msg_js = engine.newObject() stamp_msg_js.setProperty('sec',0) stamp_msg_js.setProperty('nanosec',0) header_msg_js.setProperty('stamp', stamp_msg_js) header_msg_js.setProperty('frame_id', '') joint_state_msg_js.setProperty('header', header_msg_js) joint_state_msg_js.setProperty('name', engine.newArray(3)) joint_state_msg_js.setProperty('position', engine.newArray(3)) joint_state_msg_js.setProperty('velocity', engine.newArray(3)) joint_state_msg_js.setProperty('effort', engine.newArray(3)) prototype = joint_state_msg_js print(prototype.toVariant()) The OrderedDict could have any depth. I keep trying to write a function that creates a QJSValue from the OrderedDict, or populates the prototype values, but I cannot figure out how to do either. It needs to work with any OrderedDict (any OrderedDict of primatives or other OrderedDicts). How could I write this function? Here is one of my attempts: def to_qjs_value(od: OrderedDict, prototype: QJSValue) -> QJSValue: for field_name in od: inner_dict_or_value = od[field_name] if isinstance(inner_dict_or_value, OrderedDict): inner_dict = inner_dict_or_value inner_dict_js = to_qjs_value(inner_dict, prototype) # recursion prototype.setProperty(field_name, inner_dict_js) else: inner_value = inner_dict_or_value if isinstance(inner_value, list): jslist = QJSValue() i=0 for inner_list_value in inner_value: jslist.setProperty(i, inner_list_value) i=i+1 prototype.setProperty(field_name, jslist) else: prototype.setProperty(field_name, inner_value) return prototype but this makes the result flat, and doesn't populate the lists. { 'effort': None, 'frame_id': 'world', 'header': {}, 'name': None, 'nanosec': 99, 'position': None, 'sec': 42, 'stamp': {}, 'velocity': None } Please help! Either a solution with or without using the prototype will be fine. |
Oracle sql - SP2-0552: Bind variable "T_END" not declared error, but "T_START" is fine, why? Both use TO_DATE() Posted: 12 Oct 2021 08:10 AM PDT Check this Oracle sql script: SET SERVEROUTPUT ON SIZE 200000; declare start timestamp; fin timestamp; opr varchar2(64); op varchar2(64); ext_act varchar2(64); time_sum float; counter integer := 1; query1 varchar2(4096):='select * from ITEM_HISTORY IH join PACKAGE P on P.PACKAGE_NAME = IH.PACKAGE_NAME where OPERATOR_ID = :opr and (IH.OPERATION != :op OR IH.EVENT_DATE = IH.INSTALLATION_DATE) and IH.EXTERNAL_SERVICE_ACTION != :ext_act and IH.EVENT_DATE >= :t_start and IH.EVENT_DATE < :t_end and rownum < 500000 order by IH.EVENT_DATE'; query2 varchar2(4096):='select * from (select * from ITEM_HISTORY IH join PACKAGE P on P.PACKAGE_NAME = IH.PACKAGE_NAME where OPERATOR_ID = :opr and (IH.OPERATION != :op OR IH.EVENT_DATE = IH.INSTALLATION_DATE) and IH.EXTERNAL_SERVICE_ACTION != :ext_act and IH.EVENT_DATE >= :t_start and IH.EVENT_DATE < :t_end) where rownum < 500000'; query3 varchar2(4096):='select * from ITEM_HISTORY IH join PACKAGE P on P.PACKAGE_NAME = IH.PACKAGE_NAME where OPERATOR_ID = :opr and (IH.OPERATION != :op OR IH.EVENT_DATE = IH.INSTALLATION_DATE) and IH.EXTERNAL_SERVICE_ACTION != :ext_act and IH.EVENT_DATE >= :t_start and IH.EVENT_DATE < :t_end fetch first 500000 rows only'; begin FOR query IN (SELECT column_value FROM table(sys.dbms_debug_vc2coll(query1, query2, query3))) loop dbms_output.put_line('This is query ' || counter); for i in 1..10 loop start:=systimestamp; exec :opr := '88000001'; exec :op := 'CHANGE_OWNER'; exec :ext_act := 'NOT_APPLICABLE'; exec :t_start :=TO_DATE('2018/07/01', 'yyyy/mm/dd'); exec :t_end :=TO_DATE('2020/05/01', 'yyyy/mm/dd'); query; fin := systimestamp; duration := fin - start; dbms_output.put_line('Time taken for query' || counter || ' for run ' || i || ': ' || duration); time_sum := time_sum || duration; end loop; dbms_output.put_line('Avg time for query' || counter || ': ' || time_sum / 10); time_sum := 0; counter:=counter+1; end loop; end I have error: SP2-0552: Bind variable "T_END" not declared. , but T_START is fine and is before T_END . If T_END is bad, why T_START is not? What is wrong? Originally they were t1 and t2 , but the error is the same: no error for t1 and error for t2 . |
AWS APIGateway Define canary stage in CDK Posted: 12 Oct 2021 08:10 AM PDT I define an API Gateway using CDK [Typescript] and can't find how to define the Canary setting by CDK. my goal is to define the same resources twice with little configure changes one for the stage and for the canary. Any ideas? |
React Native Scroll View Bottom Cut Off Posted: 12 Oct 2021 08:10 AM PDT I am creating a react native app (using Expo) and I've run into an issue regarding a ScrollView . More specifically, the ScrollView cuts all the content under the screen height. Here is a video example: https://imgur.com/gallery/msUk26Y The grey View at the bottom of the screen is supposed to be round at the bottom part as well, but for some reason, it's being cropped by the ScrollView. Here is the code: App.js const Stack = createNativeStackNavigator(); var innerWidth, innerHeight; function App() { if (window) { innerHeight = window.innerHeight; innerWidth = window.innerWidth; window.onresize = () => { innerHeight = window.innerHeight; innerWidth = window.innerWidth; setWidth(innerWidth); }; } const [width, setWidth] = React.useState(innerWidth); return ( <View style={{ flex: 1 }}> <ScrollView style={{ flex: 1 }} contentContainerStyle={{ flexDirection: "row", flexGrow: 1 }} > <View style={ !innerWidth ? { flex: 0, justifyContent: "center", alignItems: "center", backgroundColor: "#e0e0e0", } : innerWidth < 501 ? { flex: 0, justifyContent: "center", alignItems: "center", } : { flex: (width - 500) / 2048, justifyContent: "center", alignItems: "center", } } /> <View style={{ flex: 2.5, backgroundColor: "grey" }}> <NavigationContainer> <Stack.Navigator initialRouteName="Home" screenOptions={{ headerShown: false, }} > <Stack.Screen name="Home" component={HomeScreen} /> </Stack.Navigator> </NavigationContainer> </View> <View style={ !innerWidth ? { flex: 0, justifyContent: "center", alignItems: "center" } : innerWidth < 501 ? { flex: 0, justifyContent: "center", alignItems: "center", } : { flex: (width - 500) / 2048, justifyContent: "center", alignItems: "center", } } /> </ScrollView> </View> ); } (of course all the imports/exports are there, but not needed for this post). Here is Home.js: const HomeScreen = () => { return ( <View style={{ flex: 1, backgroundColor: '#f5f5f5'}}> <Logo/> <GooglePlacesInput/> <Recommended/> <PremiumTab/> </View> ); } export default HomeScreen; I've tried a lot of solutions I found online, but none seems to do the trick. Any help is appreciated, as I've been trying to solve this issue for quite some time now. Thanks! |
More performant alternative to select-object in Powershell Posted: 12 Oct 2021 08:10 AM PDT I read a big Json into powershell and afterwards reduce the fields via select-object -Property $myProperties Its running fine, but its slow. Are there more performant alterantives out there? I read a little bit about linq, but I am not sure if this will resolve my issues. I have also thought about reading the com ntent as hashtable via the -ashashtable operator from convertfrom-json and then removing the unnessecary properties via the .remove operator but it needs additional processing for arrays. Does anyone have a general advice, what's the preferred solution? Full Script function Start-TestDatabaseFile { param ( $folderSoll, $folderIst ) $workfolderPath = $workfolder.path $errors = 0 $dbInfo = Get-dbInformation $localFolder = "$workfolderPath\TestResults\DatabaseFileDifference" New-Item $localFolder -ItemType Directory | Out-Null $differencePerTable = "$workfolderPath\TestResults\DatabaseFilePerTable" New-Item $differencePerTable -ItemType Directory | Out-Null $keys = $result.Keys | Sort-Object foreach ($key in $keys) { #region File Datenmodell $firstItemFile = $result[$key].fileRaw.Replace('_response.json', '_Datenbank.json') $tf = $result[$key].tf $myTestfall = $myTest[$tf].root if ($null -ne $myTestfall) { $responseFile = Split-Path $firstItemFile -Leaf $myPath = $result[$key].myPath $file = Join-Path $myTest[$myTestfall].folder -ChildPath ("$myPath\$responseFile") $secondItemFile = $file.Replace('\Requests\', '\Responses_SOLL\') } else { $secondItemFile = $firstItemFile.replace($folderIst, $folderSoll) } try { $firstItemAll = Get-Content $firstItemFile -ErrorAction Stop | ConvertFrom-Json -AsHashtable $firstItem = $firstItemAll.post $firstItemExists = $true } catch { $firstItem = '{}' | ConvertFrom-Json -AsHashtable $firstItemExists = $false } try { $secondItemAll = Get-content $secondItemFile -ErrorAction Stop | ConvertFrom-Json -AsHashtable $secondItem = $secondItemAll.post $secondItemExists = $true } catch { $secondItem = '{}' | ConvertFrom-Json -AsHashtable $secondItemExists = $false } $views = $dbInfo.keys | Where-Object { $_ -like 'V*' } foreach ($view in $views) { $schalter = $dbInfo[$view].myItem if ($firstItemExists) { try { $firstItem.$view = [array]($firstItem.$view | Select-Object -Property $dbInfo[$view].fieldsCompare) } catch { [console]::WriteLine('Issue in Start-TestDatabaseFile ExceptionPoint1') } } if ($secondItemExists) { if ($null -ne $myTestfall) { $secondItem.$view = $secondItemAll.pre.$view } if ($useNewDm.$schalter) { $secondItem.$view = [array]($secondItem.$view | Select-Object -Property $dbInfo[$view].fieldsCompare) } else { $secondItem.$view = [array]($firstItemAll.pre.$view | Select-Object -Property $dbInfo[$view].fieldsCompare) } } } $firstItemJson = $firstItem | ConvertTo-Json -Depth 100 $secondItemJson = $secondItem | ConvertTo-Json -Depth 100 $result[$key].resultDatabaseFile = Compare-Json -ist $firstItemJson -soll $secondItemJson $result[$key].passedDatabaseFile = 'passed' if ($null -ne $result[$key].resultDatabaseFile.difference) { $filename = $key.replace('\', '_') $result[$key].resultDatabaseFile.difference | Out-File -FilePath ("$localFolder\$filename.json") #region tmp out $difference = $result[$key].resultDatabaseFile.difference | ConvertFrom-Json $diffKeys = (Get-Member -InputObject $difference -MemberType NoteProperty).Name foreach ($diffKey in $diffKeys) { $file = "$differencePerTable\$diffKey.json" Add-Content -Path $file -Value $key Add-Content -Path $file -Value ($difference.$diffkey | ConvertTo-Json) }
|
No comments:
Post a Comment