Hacker hai bhai hacker hai hacker hai bhai hacker hai
After some googling and asking Copilot I got an answer, which seems to be right and pushed me in the right direction.
The start_tcp_server function in pymodbus is a blocking call, which means it will not return control to your program until the server is stopped. Changing the values from the client works, so I will have to start doing that. With that change, the reading works fine.
There are probably more than one anwser. This first that came to my mind would be to make .gm-style-iw-chr absolute:
.gm-style-iw-chr {
position: absolute;
right: 0;
}
You are using route function in inertia which is not exists to use route with their names you need to use this package
For Font you can add the font or remove the font from storyboard
Your request to Install the app has been sent to workspace admins/owners once they approve your app request you get the install page after clicking Reinstall on workspace button. If you add additional scopes you have to create a new request.
Ask King .OC of the BerZerkernauts!
Try MirrorFly Flutter Chat SDK for your chat app. They offer customization as well
The code snippet provided by OP looks unnecessarily complicated for getting document embeddings.
To get document embeddings, I'd start with using the last hidden state of the [CLS] token. Specifically, OP's text_to_embedding() routine can be replaced with less than 5 lines of code. See this post for how.
According to oficial documentation https://docs.npmjs.com/cli/v7/commands/npm-publish you could use the access param as follows
npm publish --access=restricted
If you do not want your scoped package to be publicly viewable (and installable) set --access=restricted.
Unscoped packages can not be set to restricted meaning you have to add the @scope prefix to your package i.e.: @foo/yeoman-generator-wherever.
If you want to publish the package to make it publicly accesible you can set the flag --access=public.
npm publish --access=public
My advise is to check the npm version and the documentation as maybe the default behaviour for npm publish differs so better to be explicit and set the flag of what you need.
enough rebild your project and try again
You're currently putting {{ route('logout') }} as the form route as plain text.
try binding the value :action="route('logout').
Or use the designated form composable. https://inertiajs.com/forms
A bit-indexed (or Fenwick) tree can be seen as a pruned segment tree, see this answer.
Running build 3.5.11 on MacOS 15.3 - simply loading the Natural Text Editing profile, or editing the hex codes as suggested by Muhammad Huzaifa wasn't sufficient.
I needed to remove the quotes around the hex codes in the key mapping that are introduced by default.
Before: "0x1b 0x7f"
After: 0x1b 0x7f
Edit: this issue has been raised in the iTerm2 Gitlab repo and a fix merged but presumably yet to be released: https://gitlab.com/gnachman/iterm2/-/issues/12031
These two commands solved the problem for me:
1- Recursive option that allows you to change the permissions of all files in a directory and its subdirectories:
chmod -R 755 .git/
2- Force deletion of the directory and subdirectories:
rm -rf .git/
Note: You can optionally see a visual confirmation with the command:
rm -vrf .git/
Creating new WebRTC peer connections for every operation is inefficient and can lead to several issues:
Instead, use a connection management approach where you:
Im working on a very similar project and i didnt find anyone else working on it too, until now please can we connect I need some advice asap
The error can be resolved by defining title ="" before it's uses or may be @line 6.
When using the Builder widget, the parent's build method will construct a new tree of widgets so a new Builder child will not be identified the outside context of the keyboard --> do not know the keyboard change event --> height keyboard always returns 0.
Try to calculate availableHeight out of Builder widget:
Widget build(BuildContext context) {
double screenHeight = MediaQuery.sizeOf(context).height;
double keyboardHeight = MediaQuery.viewInsetsOf(context).bottom;
...
And use MediaQuery.viewInsetsOf instead, this is new recommend docs.
P/S: This [video](https://youtu.be/ceCo8U0XHqw?si=yAyRxzUt6c_L2vnC show clearly the concept of viewInsets,viewPadding and padding
While the former's explaination is correct, the code still has a mistake since it needs to be awaited on params before accessing the attribute.
export async function GET(
request: Request,
{params}: { params: Promise<{ id: string }> }
) {
const id = (await params).id
// rest of your code
}
I had the similar error experience. Not only a header comment required like stated here: https://learn.microsoft.com/en-gb/azure/databricks/notebooks/notebook-export-import
But when specifying the notebook path (in remote repository) while defining your task, make sure to omit the extension of the notebook file: .ipynb or .sql or whatever have you.
As mentioned above origin was deprecated therefore I used:
const origin = req.headers.referer
you should remove the ending slash to make it same as the origin
You could do something like this. \u{00A0} represents the Unicode code point for a non-breaking space.
#let full_names = (
"Gordon\u{00A0}Allport",
"Kurt\u{00A0}Lewin",
"Fritz\u{00A0}Heider"
)
#full_names.join(", ")
Try to open the project in Android Studio and see if you have a different error. It can be from an error you made in the kotlin files.
But how can I use a task to send a mail after adding my own SMTP? Do I need to create a Connection?
i think you are asking to do something similar to news.google.com or clustz.com. This is something complex as there are many machine learning algorithms (KMeans, DBSCAN, HDSCAN, Hierarchical, Gaussian Mixture Model etc...) available to try out especially unsupervised one. Moreover before that you need to do pre processing using NLP. Each ML algorithm has couple of parameters which should be fine tuned to get best result. So this is more like trial and error. There are many articles available on internet for the same. Refer - https://medium.com/towards-data-science/all-the-news-17fa34b52b9d
Update 2025: Renaming the branch you are on it without check it out is possible https://www.jetbrains.com/help/idea/manage-branches.html
You can use CapSolver for this. Their extension helps identify and extract the "data-sitekey" even on websites that require login,check out their guide on how to do this here, Identify Any Captcha and Parameters.
Visit the link https://codesandbox.io/p/devbox/react-virtualized-responsive-card-grid-w-infinite-scroll-forked-k5txxf?workspaceId=ws_JTeebwUUcaa7hbHFg2sG3M This contains the solution you need.
Build version: 145 Current date: 2025-02-11 11:26:16 Device: Xiaomi 23108RN04Y OS version: Android 14 (SDK 34)
Stack trace:
java.lang.NoSuchMethodError: No virtual method setRequestAgent(Ljava/lang/String;)Lcom/google/android/gms/ads/AdRequest$Builder; in class Lcom/google/android/gms/ads/AdRequest$Builder; or its super classes (declaration of 'com.google.android.gms.ads.AdRequest$Builder' appears in /data/app/~~RoQ8drpOu7cFuD_pwDGGpw==/com.lutech.theme-wc72gco-QQ5sg9phYB91AA==/base.apk!classes2.dex)
at com.unity3d.scar.adapter.v2100.requests.AdRequestFactory.getAdRequest(AdRequestFactory.java:17)
at com.unity3d.scar.adapter.v2100.requests.AdRequestFactory.buildAdRequest(AdRequestFactory.java:22)
at com.unity3d.scar.adapter.v2100.signals.SignalsCollector.getSCARSignal(SignalsCollector.java:24)
at com.unity3d.scar.adapter.v2100.signals.SignalsCollector.getSCARSignal(SignalsCollector.java:32)
at com.unity3d.scar.adapter.common.signals.SignalsCollectorBase.getSCARBiddingSignals(SignalsCollectorBase.java:43)
at com.unity3d.scar.adapter.common.ScarAdapterBase.getSCARBiddingSignals(Sca lo
I also have the same issue, I'm using ubuntu 24.04 I perfectly installed tomcat 9 and it showed the welcome page, the problem began when I wanted to access manager-gui, I followed all the changes to be done on the cong/tomcat-user.xml file step by step one after the other. so the problem is when I enter the signing-in details, it flashes and gives the same signing-in prompt 3 times then it shows error 404, I do need you help.
in your INSERT INTO :
INSERT INTO "UserForgetPasswordPending" ("Email","TokenTimestamp","Token") SELECT $1,2,$3';
you forgot the $ before the 2, so you try to insert 2 in the DB instead of TokenTimestamp ;)
Turns out the problem was not in the environment variables after all...
I was able to check weather the settings.xml file was reading the env variables correctly by running:
mvn help:effective-settings
and noticed that they were being correctly parsed.
The actual problem was that, in my settings file, I only had the credentials set up for the snapshots directory and not for the central one.
Since I had changed the version name in the pom.xml to something that did not include -SNAPSHOT, maven was trying to deploy it on the central repo and was not able to find the credentials.
The issue was solved by adding:
<server>
<id>central</id>
<username>${env.M2_USERNAME}</username>
<password>${env.M2_PASSWORD}</password>
</server>
to the settings.xml file
In the end there was nothing wrong with either docker nor maven. It was just my poor understanding of the maven build lifecycle :)
best way for problem is using
var jtoken = JToken.Parse(string)
I recently came accorss similar issue and found one can synchronously communicate with chrome extension installed on browser.
Here I have put the code on my repo: link
It's possible with this extension: https://chromewebstore.google.com/detail/jsonvue/chklaanhfefbnpoihckbnefhakgolnmc
(yes, it's an old question, but still on top of the Google results, so it's relevant)
Add the vault job to needs array to get the artifact from that job.
.
.
.
data-main:
needs: ["schema-main","vault"]
stage: clone-data
allow_failure: true
resource_group: clone
script:
- cat vault.env
This error occurs because you haven't added the import statement.
import ballerinax/mysql;
I was having the same issue on a Windows 10, Docker v27.4.0. Using the hints at Docker Community Forums and other forums around I changed from a USB dongle (fairly old) to a wired ethernet and the problem disappeared. PS I was also having issues downloading files in Chrome etc.
As replied in comment by Carlosfigueira, we can disable control, first we have to unlock the data card
Change => Repair and then Re uninstall
I strongly recommend you don't turn on the feature "files.trimTrailingWhitespace": true in VSCode.
If the project you are working on is unnormalized, the feature will trigger many irrelevant modifications in your git commit records, which is a good place for bugs to hide.
I leave this comment here in case anyone else stumbles upon the same issue I had. I had local overrides that were interfering with the sources for some reason. I had styling pointing to a whole different file until I disabled/cleaned my local overrides in the Sources tab.
Starting with Pandas 2.2.0, it is now compatible with Numpy >= 2.
https://github.com/pandas-dev/pandas/issues/55519#issuecomment-1867095954
pip install pandas==2.2.0
or
pip install --upgrade pandas
well i get the same messsages their after i start using axios inside the functions
I suggest you configure your RAG with more than one prompt, one for DIY another for TEAM. Then you can condition which prompt to use based on the retrieved documents scores/distances.
had you resolved this question?
Compensation: If the cancellation significantly impacts your travel (e.g., a long delay or overnight stay), you may be entitled to compensation, such as meal vouchers, hotel accommodations, or even a travel credit or refund. Compensation varies depending on the reason for the cancellation and the length of the delay.
Refund Options: If the cancellation causes a major disruption and you decide not to travel, you may be eligible for a full refund, even for non-refundable tickets.
Customer Service: Deltaâs customer service will assist you in finding a new itinerary, and you can also inquire about compensation or other assistance based on your specific situation.
If you have travel insurance or are part of their frequent flyer program, additional benefits might apply as well. for customer care No. 1-844-976-4875
Try:
The column order is stored as metadata in the database. Is it possible to update this metadata and then have another column order for all practical purposes (not physically on the disk)?
Log4j and Logback are both logging frameworks, while SLF4J is just a logging facade (an abstraction layer). SLF4J is typically used in conjunction with either Log4j or Logback, providing the API for logging while allowing the backend to be swapped without changing application code. Logback is considered more modern and feature-rich than Log4j 1.x but Log4j 2.x has many improvements, including asynchronous logging, making it competitive with Logback. Log4j 2.x and Logback are often chosen for new applications, while Log4j 1.x is considered outdated. In short:
Use SLF4J for a standardized logging interface. Use Logback or Log4j 2.x as the actual logging implementation.
My solution is to put a surplus line (with bash) at the end of the file. In my case a simple 'echo "" >>$FILENAME' was enough, but you could put an 'echo "%%ENDOFFILE%%" >> $FILENAME' as well.
First install Flutter SDK. And try to execute below command at project directory. hope it will resolve this issue.
flutter packages get
flutter packages upgrade
use TabBar(labelColor: Colors.black, unselectedLabelColor: Colors.grey, indicatorColor: Colors.black, ...
Use CATALINA_OPTS instead of JAVA_OPTS. Source
use labelPadding: EdgeInsets.symmetric(horizontal: 2.0), works like a charm for me
The problem seemed to be the usage of the package Microsoft.Maui.Controls.Compatilibility. Once I replaced that with the package Microsoft.Maui.Essentials (which is MAUI's equivalent of Xamarin's Xamarin.Essentials) everything was working again as expected.
In case you directly want to edit the pyproject.toml, add like
ipython-tikzmagic = {git = "[email protected]:michakraus/ipython-tikzmagic.git"}
I follow a similar practice when working on different projects, including when I was dealing with Section 8 Karim housing inspections, where attention to detail is key. Just like checking the torque on wheel nuts prevents issues down the road, double-checking compliance in housing ensures everything is secure and in place. Small steps like these can prevent major problems later!
I just need to take the data from a variable which is storing the address of an other variable which is having the actual data
In CPP I wrote this int num = *b
b -> it is containing the address of the variable which store the actual data.
re-installing the Docker desktop worked for me.
UPGRADE react-native package to 0.77.0
Looks like the issue only occurs in PyCharm's Scratch files. I had the same problem and discovered that in regular project files it works fine. Feel free to upvote this issue.
@Telman Boltaev, I'm facing the same issue, did you find a solution?
I found my problem. I was using SET @random_id = (SELECT id FROM logs ORDER BY RAND() LIMIT 1);
The ORDER BY RAND() caused the a full table scan to occur.
For example for rich snippets:
<meta itemprop="datePublished" content="<?php echo date("Y-m-d H:i:s e", strtotime($dateStringVar)); ?>">
You need to install Bosch coines sdk
Please why this is working for me, only when I am running my web app on localhost? I am starting the project from Visual Studio.I set wrong SPN for https://localhost:44396 than its throwing error as expected.
System.Net.AuthenticationManager.CustomTargetNameDictionary .Add("https://localhost:44396/", "HTTP/incorrect_value");
But when I deploy my app on IIS server, than its not working. When I set the wrong value on client, the windows authentication is still working fine
System.Net.AuthenticationManager.CustomTargetNameDictionary .Add("https://myapp.domain.com/", "HTTP/incorrect_value");
Why my client is still passing the windows authentication, even when I set wrong SPN for the destination URL?
Here are a few points to consider:
Socket.IO is a library that enables real-time, bidirectional, and event-based communication between web clients and servers. It's often used for applications that require real-time data exchange, such as chat applications or live updates.
Setup:
Frontend: Capture audio from the user's microphone using the Web Audio API or similar technology. This can be achieved by accessing the user's microphone and processing audio data in real-time.
Backend: Use a server-side framework (like Node.js with Express) to handle incoming audio data. Socket.IO can be integrated to establish a real-time connection between the client and server.
Processing Audio: The captured audio needs to be streamed to the backend where it can be processed using a speech-to-text API. You might use services like Google Cloud Speech-to-Text, Azure Speech Services, or open-source solutions depending on your requirements and budget. Convert the audio stream into the format required by the speech-to-text service.
Transcription: Once the audio is processed by the speech-to-text service, the resulting text can be sent back to the client in real-time via Socket.IO.
Challenges:
Latency: Minimizing latency is critical to ensure that the transcription feels real-time.
Accuracy: The quality of the transcription can vary based on the chosen speech-to-text service and the quality of the audio input.
Scalability and Cost: Consider the cost implications of using commercial APIs for processing a large volume of audio data.
Example Projects: There are existing projects and tutorials available, such as using Azure with Socket.IO or combining React with a Python Socket.IO server, which can serve as references for building your application.
By addressing these aspects, you can create a functional real-time speech-to-text application using Socket.IO. Consider checking relevant GitHub repositories and documentation for more detailed implementation strategies.
In addition to using Socket.IO for real-time speech-to-text applications, you might want to explore some user-friendly online services that simplify the process. For example, RecCloud offers an easy-to-use speech-to-text feature that requires minimal setup and is straightforward to use. You can find more information on their website.
It Is Server Side issue not another issue so don't panic
Your query is counting all mentions of protests, but GDELT records the same event multiple times from different sources, inflating the count.
To get the number of unique protests in Iran for September 2022, modify your query to count distinct events instead of all mentions.
SELECT COUNT(DISTINCT GLOBALEVENTID) AS unique_protests
FROM `gdelt-bq.gdeltv2.events_partitioned`
WHERE _PARTITIONTIME BETWEEN TIMESTAMP('2022-09-01') AND TIMESTAMP('2022-09-30')
AND EventRootCode = '14'
AND ActionGeo_CountryCode = 'IR';
You can filter based on confidence scores:
NumMentions > X â Only count events reported multiple times.AvgTone < 0 â Focus on negative-toned events (protests usually have a negative tone).get_default_text_client is no longer available after version 0.7.2. On this version it's on line 347 of client.py. From version 0.7.3 on it's not longer in client.py.
If you really want to use it and don't want to work around it I'd suggest downgrading back to v0.7.2
IIRC, "Interpreted call to" don't do tail call optimisation?
Compile the function and try it again. I.e.
(compile 'generate-children)
etc.
add below export variable to hadoop-env.sh
export HADOOP_OPTS="$HADOOP_OPTS --add-opens java.base/java.lang=ALL-UNNAMED"
I just had the same bug. I had the package @astrojs/node installed as a dev-dependency and now just installed it as an dependency instead. Now it works.
PowerShell command
Install-Module -Name Microsoft.WinGet.Client
Repair-WinGetPackageManager
First we need to delete the service id which holds this identifiers app id. After that you can able to easily uncheck or remove the capabilities in app store connect.
Tadaaa....
#appstoreconnect #signinwithapple #apple #ios #appID
No.
Only if LDAP is disabled.
Checked source code of Keycloak. org.keycloak.storage.ldap.LDAPStorageProvider class is used to query users that always performs queries via LDAP.
This is a known issue, unfortunately this is not a .NET MAUI problem but wider spread and older. You can check this link about this issue.
Slf4j using asynchronous log4j using synchronous
This way worked for me
$('#qty').prop('max', 10);
You can simply use stack to position it :)
body: Stack(
children: [
Positioned(
top: -240,
child: Container(
height: 500,
width: MediaQuery.sizeOf(context).width ,
decoration: BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.all(Radius.circular(1000))
),
),
)
],
),
āĻāĻžāϞā§āĻŦāĻžāϏāĻžāϰ āĻāύā§āĻĻ
āϤā§āĻŽāĻžāϰ āĻā§āĻā§ āĻāĻžāĻāĻĻā§āϰ āĻāϞā§,
āĻŽāύā§āϰ āĻŽāĻžāĻā§ āĻā§āĻāύāĻž āĻĸāĻžāϞā§āĨ¤
āĻļāĻŋāĻļāĻŋāϰ āĻā§āĻāĻž āĻā§āϰā§āϰ āĻŽāϤā§,
āϤā§āĻŽāĻŋ āĻāĻā§ āĻšā§āĻĻā§ āĻā§ā§ā§ āĻļāϤāĨ¤
āϤā§āĻŽāĻžāϰ āĻšāĻžāϏāĻŋ āϰā§āĻĻā§āϰ āĻāĻŋāϰāĻŖ,
āĻā§āĻŋā§ā§ āϰāĻžāĻā§ āύā§āϞ āĻāĻāύāĨ¤
āϤā§āĻŽāĻŋ āĻāĻžā§āĻž āĻā§āĻŦāύ āϝ⧠āĻļā§āύā§āϝ,
āϤā§āĻŽāĻžāϰ āĻā§āĻā§āĻž āϏā§āĻŦāĻĒā§āύ āĻ āĻĒāĻžāϰ āϏā§āĻāύā§āϧāĨ¤
āĻšāĻžāϤāĻāĻŋ āϧāϰā§, āĻšāĻžāϰāĻžāĻŦā§ āĻĻā§āϰā§,
āĻāĻžāϞā§āĻŦāĻžāϏāĻžāϰ āύā§āϞ āϏāĻŽā§āĻĻā§āϰā§āĨ¤
āϤā§āĻŽāĻŋ āĻāĻŽāĻŋâāĻāĻāĻ āĻāĻāĻžāĻļ,
āĻāĻžāϏāĻŦā§ āĻŽā§āϰāĻž āĻĒā§āϰā§āĻŽā§āϰ āĻŦāĻžāϤāĻžāϏāĨ¤
āĻāĻŦāĻŋāϤāĻžāĻāĻŋ
āĻāĻ āĻŽā§āĻšā§āϰā§āϤā§āϰ āĻāύā§āϝāĻ
āϝāĻĻāĻŋ āĻāĻžāϞ⧠āϞā§āĻā§ āĻĨāĻžāĻā§
āϞāĻžāĻāĻ āĻĢāϞ⧠āĻļā§āϝāĻŧāĻžāϰ āĻāϰāϤā§
āĻā§āϞāĻŦā§āύ āύāĻž
.......................................................................
This isn't answer to be fair, but it's further information as I see it - and comments are too short for the detail I wanted to post.
I'm also having the same problem (Android 15, Pixel 6 - Kernel build Sep 2 2024) which, I too, believe that at some relatively recent point in time was working for me (dabbling with esp32
I've tried via two APs I have (one is a RT-AX82U running stock, and the other is an of Linksys I had lying around with an oldish version of DD-WRT on it.
My Windows PC works fine, as does my partner's iPhone which suggests that it's the implementation of the DNS resolver in Android that's the culprit.
I did spot that around 5 weeks ago, several PRs were merged pertaining to mDNS, which does seem suspicious to me, although it's not clear what the cadence of updates to Android devices are, it would appear that these changes are more recent than the version I currently am running. https://android.googlesource.com/platform/packages/modules/DnsResolver/+log?s=ccdad891f6e896511c355de36ed287361c8f7a6f
I'm not a c++ dev, and the low-level net stack is something I'm not very knowledgeable about so my normal tack of dissecting the code isn't really an option. Hopefully the community can figure this one out!
The answer is INCOMPLETE and MISLEADING! There are quite some functions documented to set the last error code which but don't, and vice versa as well!
I highly suspect the lag occurs because you're using a virtual emulator, which is resource-intensive and can be slow. Try running the app on a physical deviceâit should work without lag.
const schema = z
.object({
email: z.string().email().optional(),
userName: z.string().optional(),
contactType: z.string(),
})
.refine((data) =>
data.contactType === 'email' && !data.email) ?
z.string().nonempty() : z.unknown()
});
To add two texts (title and subtitle) in a switch button, you can use a custom component or wrap it in a container with appropriate styling. Make sure to use responsive elements to stay neat on various screen sizes. If you need inspiration or other references, try checking https://www.scarsocial.com/!
I resolved the issue by manually adding references into web.config file. Which basically copy the dlls into output folder during build.
Max timeout for a lambda function is 15 minutes. You can extend it by going to configuration on the aws console. If you are talking about API limits then yes, api gateway times out in 30 seconds. AWS has recently enabled service quota increase requests for API gateway.
Go to this link after logging in
https://us-east-1.console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-E5AE38E3
Request quota increase.
Simple version:
RAND() > 0.5
Bonus: Move 0.5 between 0 and 1 for weighted probabilities.
Eg, for the statement RAND() > 0.8:
P(FALSE) = 80%, P(TRUE) = 20%.
Off course, you should not prepend nor append the characters "#" to the variable name.
Problem was that in Settings->Tools->Azure I haven't set Function Core Tools path. Seems that even if this was installed IntelliJ haven't seen this.
I know it is late, but in case anybody is seeking the answer:
This is a common error and does not indicate a critical issue. It appears even on healthy, fully functional WorkSpaces and can generally be ignored. These messages are often related to temporary network conditions or expected system behavior.
If your WorkSpace is operating normally, no action is needed. However, if youâre experiencing connectivity or performance issues, you may want to check network settings or refer to AWS WorkSpaces troubleshooting documentation for further guidance.
Today, I found an article stating that if you want to initialize a chat from an agent other than RetrieveUserProxyAgent, you should call and use RetrieveUserProxyAgent from a function. Therefore, I will fundamentally revise it in this direction.
I apologize for asking a question due to my lack of basic understanding.
https://microsoft.github.io/autogen/0.2/blog/2023/10/18/RetrieveChat/
It's also possible to use a direct link with the option engine example:
nothing more.
In 2025 (version 24.3.4), there is a similar problem, and the solution was described in an issue on their GitHub repo.
Steps:
Argument compute_metrics is used for evaluation. So try to remove compute_metrics when instancing Trainer if you don't need evaluation.
This code can just change the pattern to (cat.{0,10}(red|blue))|(white|black)|cats.{0,10}dogs, which is a little bit different from what you want. Would this be helpful?
import re
def find_ending(text='', content='', begin=None):
if not text or not content or content.find(text) == -1:
return -1
if text not in symbols or symbols[text] not in content:
return -1
end_text = symbols[text]
begin = (content.find(text) if begin is None else begin) + 1
count = 0
content = content[begin:]
reg = re.compile(r'[%s]' % re.escape(text + end_text))
for r in reg.finditer(content):
if r[0] == text:
count += 1
else:
count -= 1
if count == -1:
return r.start() + begin + len(r.group(0))
else:
return -1
pattern = r'dogs.{0,10}cats|(white|black)|(cat.{0,10}(red|blue))'
reg = re.compile(r'\w+|(\.\{\d+,\d+\})|(\([^\)]+\))|\|')
symbols = {
'{': '}',
'(': ')'
}
results = []
match = reg.search(pattern)
end = 0
while match:
if len(match[0]) != 1 and match[0][0] in symbols:
end = find_ending(match[0][0], pattern)
assert end != -1 # raise AssertError if can not find an ending position of current symbol
results.append(pattern[match.start():end])
else:
results.append(match[0])
end = len(match[0])
pattern = pattern[end:]
match = reg.search(pattern)
print(''.join(results[::-1])) # (cat.{0,10}(red|blue))|(white|black)|cats.{0,10}dogs