qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
3,770,781
What is the overhead in the string structure that causes sizeof() to be 32 ?
2010/09/22
[ "https://Stackoverflow.com/questions/3770781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/387527/" ]
In g++5.2 (in e.g. g++4.9, it is different) a string is basically defined as : ``` class string { char* bufferp; size_t length; union { char local_buffer[16]; size_t capacity; }; }; ``` On an ordinary computer this adds up to 32 bytes (8+8+16). The actual definition is of course ``` typedef basic_s...
It is library dependent. You shouldn't rely on the size of `std::string` objects because it is likely to change in different environments (obviously between different standard library vendors, but also between different versions of the same library). Keep in mind that `std::string` implementations are written by peopl...
3,770,781
What is the overhead in the string structure that causes sizeof() to be 32 ?
2010/09/22
[ "https://Stackoverflow.com/questions/3770781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/387527/" ]
`std::string` typically contains a buffer for the "small string optimization" --- if the string is less than the buffer size then no heap allocation is required.
In g++5.2 (in e.g. g++4.9, it is different) a string is basically defined as : ``` class string { char* bufferp; size_t length; union { char local_buffer[16]; size_t capacity; }; }; ``` On an ordinary computer this adds up to 32 bytes (8+8+16). The actual definition is of course ``` typedef basic_s...
3,770,781
What is the overhead in the string structure that causes sizeof() to be 32 ?
2010/09/22
[ "https://Stackoverflow.com/questions/3770781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/387527/" ]
It is library dependent. You shouldn't rely on the size of `std::string` objects because it is likely to change in different environments (obviously between different standard library vendors, but also between different versions of the same library). Keep in mind that `std::string` implementations are written by peopl...
Q: Why is a dog yellow? A: It's not necessarily. The size of a (an?) std::string object is implementation-dependent. I just checked MS VC++ 2010. It does indeed use 32 bytes for std::string. There is a 16 byte union that contains either the text of the string, if it will fit, or a pointer to heap storage for longer st...
3,770,781
What is the overhead in the string structure that causes sizeof() to be 32 ?
2010/09/22
[ "https://Stackoverflow.com/questions/3770781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/387527/" ]
My guess is: ``` class vector { char type; struct Heap { char* start; char* end; char* allocatedEnd; }; struct Stack { char size; char data[27]; } union { Stack stackVersion; Heap heapVersion; } version; }; ``` But...
It is library dependent. You shouldn't rely on the size of `std::string` objects because it is likely to change in different environments (obviously between different standard library vendors, but also between different versions of the same library). Keep in mind that `std::string` implementations are written by peopl...
3,770,781
What is the overhead in the string structure that causes sizeof() to be 32 ?
2010/09/22
[ "https://Stackoverflow.com/questions/3770781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/387527/" ]
Most modern `std::string` implementations1 save very small strings directly on the stack in a statically sized `char` array instead of using dynamic heap storage. This is known as [Small (or Short) String Optimisation](https://stackoverflow.com/q/10315041/1968) (SSO). It allows implementations to avoid heap allocations...
It is library dependent. You shouldn't rely on the size of `std::string` objects because it is likely to change in different environments (obviously between different standard library vendors, but also between different versions of the same library). Keep in mind that `std::string` implementations are written by peopl...
3,770,781
What is the overhead in the string structure that causes sizeof() to be 32 ?
2010/09/22
[ "https://Stackoverflow.com/questions/3770781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/387527/" ]
`std::string` typically contains a buffer for the "small string optimization" --- if the string is less than the buffer size then no heap allocation is required.
Q: Why is a dog yellow? A: It's not necessarily. The size of a (an?) std::string object is implementation-dependent. I just checked MS VC++ 2010. It does indeed use 32 bytes for std::string. There is a 16 byte union that contains either the text of the string, if it will fit, or a pointer to heap storage for longer st...
3,770,781
What is the overhead in the string structure that causes sizeof() to be 32 ?
2010/09/22
[ "https://Stackoverflow.com/questions/3770781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/387527/" ]
Most modern `std::string` implementations1 save very small strings directly on the stack in a statically sized `char` array instead of using dynamic heap storage. This is known as [Small (or Short) String Optimisation](https://stackoverflow.com/q/10315041/1968) (SSO). It allows implementations to avoid heap allocations...
In g++5.2 (in e.g. g++4.9, it is different) a string is basically defined as : ``` class string { char* bufferp; size_t length; union { char local_buffer[16]; size_t capacity; }; }; ``` On an ordinary computer this adds up to 32 bytes (8+8+16). The actual definition is of course ``` typedef basic_s...
3,770,781
What is the overhead in the string structure that causes sizeof() to be 32 ?
2010/09/22
[ "https://Stackoverflow.com/questions/3770781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/387527/" ]
My guess is: ``` class vector { char type; struct Heap { char* start; char* end; char* allocatedEnd; }; struct Stack { char size; char data[27]; } union { Stack stackVersion; Heap heapVersion; } version; }; ``` But...
Q: Why is a dog yellow? A: It's not necessarily. The size of a (an?) std::string object is implementation-dependent. I just checked MS VC++ 2010. It does indeed use 32 bytes for std::string. There is a 16 byte union that contains either the text of the string, if it will fit, or a pointer to heap storage for longer st...
3,770,781
What is the overhead in the string structure that causes sizeof() to be 32 ?
2010/09/22
[ "https://Stackoverflow.com/questions/3770781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/387527/" ]
Most modern `std::string` implementations1 save very small strings directly on the stack in a statically sized `char` array instead of using dynamic heap storage. This is known as [Small (or Short) String Optimisation](https://stackoverflow.com/q/10315041/1968) (SSO). It allows implementations to avoid heap allocations...
Q: Why is a dog yellow? A: It's not necessarily. The size of a (an?) std::string object is implementation-dependent. I just checked MS VC++ 2010. It does indeed use 32 bytes for std::string. There is a 16 byte union that contains either the text of the string, if it will fit, or a pointer to heap storage for longer st...
60,440,764
I have a (n,n,2) numpy array whose elements I want to select based on a (n,n) mask without using loops. Is there a way to vectorize this operation in numpy? Say I have a numpy array ``` X = array([[[18, 8], [ 9, 2], [11, 4], [18, 14]], [[ 8, 10], [13, 5], [13, 6], ...
2020/02/27
[ "https://Stackoverflow.com/questions/60440764", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5013900/" ]
You have to find another way to do you backups because max\_allowed\_packet can't be set to that value. [The doc](https://mariadb.com/kb/en/server-system-variables/#max_allowed_packet) states that the max is 1GB. Are you sure that you need a value that big? The value should be as big as your biggest blob, not the siz...
(I'll address your question from many angles. You may not realize how many issues you actually have.) **Clarification**. So, you have rows bigger than the max allowed for `max_allowed_packet`, and hence for `mysqldump`? **SELECT**. Can you even `SELECT` those rows? If not, you are in an even bigger pickle. **Backup*...
24,792,839
I'm about to begin cursing at my computer! I have one program that output a datetime as a string, but I want to feed it into another as a datetime. The string I get is on the form: ``` dd/MM/yy hh:mm:ss ``` And I would like to find an appropriate way to get a DateTime object back. I'm thinking something like: ``...
2014/07/17
[ "https://Stackoverflow.com/questions/24792839", "https://Stackoverflow.com", "https://Stackoverflow.com/users/869148/" ]
The hour is not in 12-hour format. For 24-hour format, it's H. ``` string date = "11/07/14 18:19:20"; string dateformat = "dd/MM/yy H:mm:ss"; DateTime converted_date = DateTime.ParseExact(date, dateformat, CultureInfo.InvariantCulture); ```
'hh' for hour is actually 12 hour clock, 01-12. I think you want 'HH' or 'H' for 24-hour clock ('HH' is zero-padded, 'H' is not). Check out: <http://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx> for specific formats.
12,090
I know it's been a while so it's not going to be any surprise to hear that I'm handing in my diamond. As for reasons, it's multifaceted. Certainly I got burnt out on a lot of issues (handling the system tagging issue and the unprotection debacle specifically). However, life also threw me some fun stuff in the form of ...
2022/05/23
[ "https://rpg.meta.stackexchange.com/questions/12090", "https://rpg.meta.stackexchange.com", "https://rpg.meta.stackexchange.com/users/28591/" ]
Well, I for one would like to say Thank You! ========== You did an excellent job by us, and we are grateful. All the best!
> > I felt a great disturbance in the Force... > > > You have been with us for years. You have been a cornercube we could rely on. And you have been here for all of us. For that I want to wish you > > [So Long, and Thanks for All the Fish](https://www.youtube.com/watch?v=ojydNb3Lrrs) > > > While I feel tempt...
12,090
I know it's been a while so it's not going to be any surprise to hear that I'm handing in my diamond. As for reasons, it's multifaceted. Certainly I got burnt out on a lot of issues (handling the system tagging issue and the unprotection debacle specifically). However, life also threw me some fun stuff in the form of ...
2022/05/23
[ "https://rpg.meta.stackexchange.com/questions/12090", "https://rpg.meta.stackexchange.com", "https://rpg.meta.stackexchange.com/users/28591/" ]
Well, I for one would like to say Thank You! ========== You did an excellent job by us, and we are grateful. All the best!
Rubiks, Thanks so much for your service to the community. I remember your amusing icon from my earliest days on RPG.SE. No doubt there's some precipitating story involving a plastic gadget, a hiker taking a rest, a curious elk, and a flash of otherworldly magic.... Best wishes
12,090
I know it's been a while so it's not going to be any surprise to hear that I'm handing in my diamond. As for reasons, it's multifaceted. Certainly I got burnt out on a lot of issues (handling the system tagging issue and the unprotection debacle specifically). However, life also threw me some fun stuff in the form of ...
2022/05/23
[ "https://rpg.meta.stackexchange.com/questions/12090", "https://rpg.meta.stackexchange.com", "https://rpg.meta.stackexchange.com/users/28591/" ]
Well, I for one would like to say Thank You! ========== You did an excellent job by us, and we are grateful. All the best!
I must accept being Moose deprived ---------------------------------- I have commented any number of times that I miss our beloved Moose, and I guess we'll miss you some more. I may send you a funny pic now and again on Discord. Been great having you as part of the voices of reason for as long as you could offer us y...
12,090
I know it's been a while so it's not going to be any surprise to hear that I'm handing in my diamond. As for reasons, it's multifaceted. Certainly I got burnt out on a lot of issues (handling the system tagging issue and the unprotection debacle specifically). However, life also threw me some fun stuff in the form of ...
2022/05/23
[ "https://rpg.meta.stackexchange.com/questions/12090", "https://rpg.meta.stackexchange.com", "https://rpg.meta.stackexchange.com/users/28591/" ]
Thanks for being a great co-mod! -------------------------------- I'm sorry to see you step down as a moderator, but it's totally understandable – it can be a stressful role, and life must come first. You did a great job as moderator; I couldn't have been elected alongside anyone better. (And you're welcome to be rein...
> > I felt a great disturbance in the Force... > > > You have been with us for years. You have been a cornercube we could rely on. And you have been here for all of us. For that I want to wish you > > [So Long, and Thanks for All the Fish](https://www.youtube.com/watch?v=ojydNb3Lrrs) > > > While I feel tempt...
12,090
I know it's been a while so it's not going to be any surprise to hear that I'm handing in my diamond. As for reasons, it's multifaceted. Certainly I got burnt out on a lot of issues (handling the system tagging issue and the unprotection debacle specifically). However, life also threw me some fun stuff in the form of ...
2022/05/23
[ "https://rpg.meta.stackexchange.com/questions/12090", "https://rpg.meta.stackexchange.com", "https://rpg.meta.stackexchange.com/users/28591/" ]
> > I felt a great disturbance in the Force... > > > You have been with us for years. You have been a cornercube we could rely on. And you have been here for all of us. For that I want to wish you > > [So Long, and Thanks for All the Fish](https://www.youtube.com/watch?v=ojydNb3Lrrs) > > > While I feel tempt...
Rubiks, Thanks so much for your service to the community. I remember your amusing icon from my earliest days on RPG.SE. No doubt there's some precipitating story involving a plastic gadget, a hiker taking a rest, a curious elk, and a flash of otherworldly magic.... Best wishes
12,090
I know it's been a while so it's not going to be any surprise to hear that I'm handing in my diamond. As for reasons, it's multifaceted. Certainly I got burnt out on a lot of issues (handling the system tagging issue and the unprotection debacle specifically). However, life also threw me some fun stuff in the form of ...
2022/05/23
[ "https://rpg.meta.stackexchange.com/questions/12090", "https://rpg.meta.stackexchange.com", "https://rpg.meta.stackexchange.com/users/28591/" ]
> > I felt a great disturbance in the Force... > > > You have been with us for years. You have been a cornercube we could rely on. And you have been here for all of us. For that I want to wish you > > [So Long, and Thanks for All the Fish](https://www.youtube.com/watch?v=ojydNb3Lrrs) > > > While I feel tempt...
I must accept being Moose deprived ---------------------------------- I have commented any number of times that I miss our beloved Moose, and I guess we'll miss you some more. I may send you a funny pic now and again on Discord. Been great having you as part of the voices of reason for as long as you could offer us y...
12,090
I know it's been a while so it's not going to be any surprise to hear that I'm handing in my diamond. As for reasons, it's multifaceted. Certainly I got burnt out on a lot of issues (handling the system tagging issue and the unprotection debacle specifically). However, life also threw me some fun stuff in the form of ...
2022/05/23
[ "https://rpg.meta.stackexchange.com/questions/12090", "https://rpg.meta.stackexchange.com", "https://rpg.meta.stackexchange.com/users/28591/" ]
Thanks for being a great co-mod! -------------------------------- I'm sorry to see you step down as a moderator, but it's totally understandable – it can be a stressful role, and life must come first. You did a great job as moderator; I couldn't have been elected alongside anyone better. (And you're welcome to be rein...
Rubiks, Thanks so much for your service to the community. I remember your amusing icon from my earliest days on RPG.SE. No doubt there's some precipitating story involving a plastic gadget, a hiker taking a rest, a curious elk, and a flash of otherworldly magic.... Best wishes
12,090
I know it's been a while so it's not going to be any surprise to hear that I'm handing in my diamond. As for reasons, it's multifaceted. Certainly I got burnt out on a lot of issues (handling the system tagging issue and the unprotection debacle specifically). However, life also threw me some fun stuff in the form of ...
2022/05/23
[ "https://rpg.meta.stackexchange.com/questions/12090", "https://rpg.meta.stackexchange.com", "https://rpg.meta.stackexchange.com/users/28591/" ]
Thanks for being a great co-mod! -------------------------------- I'm sorry to see you step down as a moderator, but it's totally understandable – it can be a stressful role, and life must come first. You did a great job as moderator; I couldn't have been elected alongside anyone better. (And you're welcome to be rein...
I must accept being Moose deprived ---------------------------------- I have commented any number of times that I miss our beloved Moose, and I guess we'll miss you some more. I may send you a funny pic now and again on Discord. Been great having you as part of the voices of reason for as long as you could offer us y...
74,539,394
Problem ======= I have a list of approximatly 200000 nodes that represent lat/lon position in a city and I have to compute the Minimum Spanning Tree. I know that I need to use Prim algorithm but first of all I need a connected graph. (We can assume that those nodes are in a Euclidian plan) To build this connected gra...
2022/11/22
[ "https://Stackoverflow.com/questions/74539394", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20576185/" ]
The Delaunay triangulation of a point set is always a superset of the EMST of these points. So it is absolutely "reliable"\*. And recommended, as it has a size linear in the number of points and can be efficiently built. \*When there are cocircular point quadruples, neither the triangulation nor the EMST are uniquely ...
There's a big question here of what libraries you have access to and how much you trust yourself as a coder. (I'm assuming the fact that you're new on SO should not be taken as a measure of your overall experience as a programmer - if it is, well, RIP.) If we assume you don't have access to Delaunay and can't implemen...
11,137,677
Just a quick preparation for my exam, for example I have: ``` f(x) = 5x<sup>2</sup> + 4x * log(x) + 2 ``` Would the big O be `O(x<sup>2</sup> + x * log(x))` or should I take consideration of non-logarithmic coefficients such as 5 or 4? Likewise, consider this code ``` for (int i = 0; i < block.length; i++) for...
2012/06/21
[ "https://Stackoverflow.com/questions/11137677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1359720/" ]
Complexity for `f(x) = 5x^2 + 4xlogx + 2` is `O(x^2)` because ``` O(g(x) + k(x)) = max(O(g(x), k(x)) // and O(X^2) > O(xlogx) //additionally coeffs are disregarded O(c*g(x)) = O(g(x)) ``` So if you have a sum you just select the largest complexity as at the end of the day, when *n* goes to infinity the largest comp...
`O(x**2)` because: `lim n^2 if (x->8) = 8` `lim 5n^2 if (x->8) = 8` `8 is infinity` but if you have the sum of few expressions you need to understood the fastest growing function. it will be an answer on you question. any other constant before expression will give you the same answer. In that case you should use [...
58,190,850
I have created a bubble conversation html. Now I am trying to add a footer to it. (Footer similar code in <https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_fixed_footer>) ```css ul { list-style: none; margin: 0; padding: 0; } ul li { display: inline-block; clear: both; padding: 5px; ...
2019/10/01
[ "https://Stackoverflow.com/questions/58190850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2132478/" ]
check this out: `css grid` is a very good property of `css`. we can divide screen into number of columns and rows . i used here css-grid. for more info on css-grid read <https://css-tricks.com/snippets/css/complete-guide-grid/> ```css ul { list-style: none; margin: 0; padding: 0; di...
Due to `padding-bottom` could not be applied here, my answer didn't fit in the case, therefore I've done a research on the alternatives for a grid layout proposed and, surprisingly, for the `fixed` positioning of the footer block. In this example I've decided to leave the code without the `<ul>` which has quite a big...
24,659,851
I have this class: ``` class fileUnstructuredView { private: void* view; public: operator void*() { return view; } }; ``` and it can do this: ``` void* melon = vldf::fileUnstructuredView(); ``` but it cant do that: ``` int* bambi = vldf::fileUnstructuredView(); //or int* bambi = (int*)vldf::f...
2014/07/09
[ "https://Stackoverflow.com/questions/24659851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1314976/" ]
Yes, you can have a conversion function template. ``` template <class T> operator T*() { return static_cast<T*>(view); } ```
Use a template to allow conversions to all types, and then use `enable_if` to only allow it for POD and basic types. ``` class fileUnstructuredView { private: void* view; public: template<class T, class enabled=typename std::enable_if<std::is_pod<T>::value>::type > operator T*() { //implic...
25,242,700
I am not sure why the action bar does not appear on my main menu, i already cleaned my project but it still doesn't work. **the main xml** ``` <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/action_settings" android:orderInCategory="100" android:showAsAction="...
2014/08/11
[ "https://Stackoverflow.com/questions/25242700", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3829911/" ]
try this ``` @Override public boolean onCreateOptionsMenu(Menu menu) { // TODO Auto-generated method stub MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.main, (Menu) menu); return super.onCreateOptionsMenu(menu); } ```
change the code to this way and check it works ``` @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); return super.onCreateOptionsMenu(menu); } ``` check the link for more how it works (<http://www.androidhive.info/20...
25,242,700
I am not sure why the action bar does not appear on my main menu, i already cleaned my project but it still doesn't work. **the main xml** ``` <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/action_settings" android:orderInCategory="100" android:showAsAction="...
2014/08/11
[ "https://Stackoverflow.com/questions/25242700", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3829911/" ]
try this ``` @Override public boolean onCreateOptionsMenu(Menu menu) { // TODO Auto-generated method stub MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.main, (Menu) menu); return super.onCreateOptionsMenu(menu); } ```
In your Manifest, for your activity, make sure you declare it has Actionbar: ``` <activity android:name="com.test.activities.MyActivity" android:configChanges="orientation|keyboardHidden|screenSize" android:label="@string/app_name" android:screenOrientation="portrait" android:th...
25,242,700
I am not sure why the action bar does not appear on my main menu, i already cleaned my project but it still doesn't work. **the main xml** ``` <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/action_settings" android:orderInCategory="100" android:showAsAction="...
2014/08/11
[ "https://Stackoverflow.com/questions/25242700", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3829911/" ]
try this ``` @Override public boolean onCreateOptionsMenu(Menu menu) { // TODO Auto-generated method stub MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.main, (Menu) menu); return super.onCreateOptionsMenu(menu); } ```
You can use [ActionBarsherlock](http://actionbarsherlock.com/) or AppCompat for supporting actionbar for android versions below 3.0 . For using ABS(actionbarsherlock) You can extend your activity by `SherlockActivity` and change your method to ``` @Override public boolean onCreateOptionsMenu(Menu menu) { // T...
25,242,700
I am not sure why the action bar does not appear on my main menu, i already cleaned my project but it still doesn't work. **the main xml** ``` <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/action_settings" android:orderInCategory="100" android:showAsAction="...
2014/08/11
[ "https://Stackoverflow.com/questions/25242700", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3829911/" ]
try this ``` @Override public boolean onCreateOptionsMenu(Menu menu) { // TODO Auto-generated method stub MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.main, (Menu) menu); return super.onCreateOptionsMenu(menu); } ```
try 100% working on 2.2 to 4.4. just add support libraries. ``` activity_main_actions.xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" > <!-- Refresh --> <item android:id="@+id/action_refresh...
3,048,188
I want to create and then open a txt file using the ShellExecute command. I have used this code for years with Delphi 7 and it worked: ``` function Execute(CONST ExeName, Parameters: string): Boolean; begin Result:= ShellExecute(0, 'open', PChar(ExeName), PChar(Parameters), nil, SW_SHOWNORMAL)> 32; end; ``` Now, I...
2010/06/15
[ "https://Stackoverflow.com/questions/3048188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46207/" ]
Sounds to me like you have the "[debug spawned processes](http://docwiki.embarcadero.com/RADStudio/en/Embarcadero_Debuggers)" option turned on. When that's enabled, the debugger interrupts the new process at the earliest possible time. Press the "run" button to let it continue running. You can confirm this hypothesis ...
Shot in the dark here, but try running the IDE as administrator, and then not as administrator. That may be a factor. Some users make a shortcut with the administrator option set, so that the auto-update runs successfully. So you may be running the IDE as admin, if you've done that.
3,048,188
I want to create and then open a txt file using the ShellExecute command. I have used this code for years with Delphi 7 and it worked: ``` function Execute(CONST ExeName, Parameters: string): Boolean; begin Result:= ShellExecute(0, 'open', PChar(ExeName), PChar(Parameters), nil, SW_SHOWNORMAL)> 32; end; ``` Now, I...
2010/06/15
[ "https://Stackoverflow.com/questions/3048188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46207/" ]
Sounds to me like you have the "[debug spawned processes](http://docwiki.embarcadero.com/RADStudio/en/Embarcadero_Debuggers)" option turned on. When that's enabled, the debugger interrupts the new process at the earliest possible time. Press the "run" button to let it continue running. You can confirm this hypothesis ...
ShellExecuteW solve my problems (XE2/Win7/32bit) with "debug spawned processes" option turned off :) mybe because strings and pchar are wide pointer from 2010
3,048,188
I want to create and then open a txt file using the ShellExecute command. I have used this code for years with Delphi 7 and it worked: ``` function Execute(CONST ExeName, Parameters: string): Boolean; begin Result:= ShellExecute(0, 'open', PChar(ExeName), PChar(Parameters), nil, SW_SHOWNORMAL)> 32; end; ``` Now, I...
2010/06/15
[ "https://Stackoverflow.com/questions/3048188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46207/" ]
I had a problem yesterday with the debugger crashing my application, but running it outside the IDE it would run fine. I was using packages in my development. I used [process explorer](http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx) to verify I found I was loading a copy from another location than expec...
ShellExecuteW solve my problems (XE2/Win7/32bit) with "debug spawned processes" option turned off :) mybe because strings and pchar are wide pointer from 2010
3,048,188
I want to create and then open a txt file using the ShellExecute command. I have used this code for years with Delphi 7 and it worked: ``` function Execute(CONST ExeName, Parameters: string): Boolean; begin Result:= ShellExecute(0, 'open', PChar(ExeName), PChar(Parameters), nil, SW_SHOWNORMAL)> 32; end; ``` Now, I...
2010/06/15
[ "https://Stackoverflow.com/questions/3048188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46207/" ]
Sounds to me like you have the "[debug spawned processes](http://docwiki.embarcadero.com/RADStudio/en/Embarcadero_Debuggers)" option turned on. When that's enabled, the debugger interrupts the new process at the earliest possible time. Press the "run" button to let it continue running. You can confirm this hypothesis ...
This is not the answer for your question (I vote for Rob Kennedy & Chris Thornton), but you can write your routine in a more compact way: ``` function Executa(const ExeName, Parameters: string): Boolean; begin Result := (ShellExecute(0, 'open', PChar(ExeName), Pointer(Parameters), nil, SW_SHOWNORMAL) > 32); end...
3,048,188
I want to create and then open a txt file using the ShellExecute command. I have used this code for years with Delphi 7 and it worked: ``` function Execute(CONST ExeName, Parameters: string): Boolean; begin Result:= ShellExecute(0, 'open', PChar(ExeName), PChar(Parameters), nil, SW_SHOWNORMAL)> 32; end; ``` Now, I...
2010/06/15
[ "https://Stackoverflow.com/questions/3048188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46207/" ]
Same by me , i solved it by replacing ShellExecute with following: ``` function TformMain.CreateProcessSimple( sExecutableFilePath : string ) : string; function GetExeByExtension(sExt : string) : string; var sExtDesc:string; begin with TRegistry.Create do begin try RootKey:=HKEY_CLASSES_ROO...
ShellExecuteW solve my problems (XE2/Win7/32bit) with "debug spawned processes" option turned off :) mybe because strings and pchar are wide pointer from 2010
3,048,188
I want to create and then open a txt file using the ShellExecute command. I have used this code for years with Delphi 7 and it worked: ``` function Execute(CONST ExeName, Parameters: string): Boolean; begin Result:= ShellExecute(0, 'open', PChar(ExeName), PChar(Parameters), nil, SW_SHOWNORMAL)> 32; end; ``` Now, I...
2010/06/15
[ "https://Stackoverflow.com/questions/3048188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46207/" ]
Sounds to me like you have the "[debug spawned processes](http://docwiki.embarcadero.com/RADStudio/en/Embarcadero_Debuggers)" option turned on. When that's enabled, the debugger interrupts the new process at the earliest possible time. Press the "run" button to let it continue running. You can confirm this hypothesis ...
I had a problem yesterday with the debugger crashing my application, but running it outside the IDE it would run fine. I was using packages in my development. I used [process explorer](http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx) to verify I found I was loading a copy from another location than expec...
3,048,188
I want to create and then open a txt file using the ShellExecute command. I have used this code for years with Delphi 7 and it worked: ``` function Execute(CONST ExeName, Parameters: string): Boolean; begin Result:= ShellExecute(0, 'open', PChar(ExeName), PChar(Parameters), nil, SW_SHOWNORMAL)> 32; end; ``` Now, I...
2010/06/15
[ "https://Stackoverflow.com/questions/3048188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46207/" ]
Sounds to me like you have the "[debug spawned processes](http://docwiki.embarcadero.com/RADStudio/en/Embarcadero_Debuggers)" option turned on. When that's enabled, the debugger interrupts the new process at the earliest possible time. Press the "run" button to let it continue running. You can confirm this hypothesis ...
Same by me , i solved it by replacing ShellExecute with following: ``` function TformMain.CreateProcessSimple( sExecutableFilePath : string ) : string; function GetExeByExtension(sExt : string) : string; var sExtDesc:string; begin with TRegistry.Create do begin try RootKey:=HKEY_CLASSES_ROO...
3,048,188
I want to create and then open a txt file using the ShellExecute command. I have used this code for years with Delphi 7 and it worked: ``` function Execute(CONST ExeName, Parameters: string): Boolean; begin Result:= ShellExecute(0, 'open', PChar(ExeName), PChar(Parameters), nil, SW_SHOWNORMAL)> 32; end; ``` Now, I...
2010/06/15
[ "https://Stackoverflow.com/questions/3048188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46207/" ]
Shot in the dark here, but try running the IDE as administrator, and then not as administrator. That may be a factor. Some users make a shortcut with the administrator option set, so that the auto-update runs successfully. So you may be running the IDE as admin, if you've done that.
ShellExecuteW solve my problems (XE2/Win7/32bit) with "debug spawned processes" option turned off :) mybe because strings and pchar are wide pointer from 2010
3,048,188
I want to create and then open a txt file using the ShellExecute command. I have used this code for years with Delphi 7 and it worked: ``` function Execute(CONST ExeName, Parameters: string): Boolean; begin Result:= ShellExecute(0, 'open', PChar(ExeName), PChar(Parameters), nil, SW_SHOWNORMAL)> 32; end; ``` Now, I...
2010/06/15
[ "https://Stackoverflow.com/questions/3048188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46207/" ]
This is not the answer for your question (I vote for Rob Kennedy & Chris Thornton), but you can write your routine in a more compact way: ``` function Executa(const ExeName, Parameters: string): Boolean; begin Result := (ShellExecute(0, 'open', PChar(ExeName), Pointer(Parameters), nil, SW_SHOWNORMAL) > 32); end...
Shot in the dark here, but try running the IDE as administrator, and then not as administrator. That may be a factor. Some users make a shortcut with the administrator option set, so that the auto-update runs successfully. So you may be running the IDE as admin, if you've done that.
3,048,188
I want to create and then open a txt file using the ShellExecute command. I have used this code for years with Delphi 7 and it worked: ``` function Execute(CONST ExeName, Parameters: string): Boolean; begin Result:= ShellExecute(0, 'open', PChar(ExeName), PChar(Parameters), nil, SW_SHOWNORMAL)> 32; end; ``` Now, I...
2010/06/15
[ "https://Stackoverflow.com/questions/3048188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46207/" ]
This is not the answer for your question (I vote for Rob Kennedy & Chris Thornton), but you can write your routine in a more compact way: ``` function Executa(const ExeName, Parameters: string): Boolean; begin Result := (ShellExecute(0, 'open', PChar(ExeName), Pointer(Parameters), nil, SW_SHOWNORMAL) > 32); end...
ShellExecuteW solve my problems (XE2/Win7/32bit) with "debug spawned processes" option turned off :) mybe because strings and pchar are wide pointer from 2010
22,760,270
I'm making a scatter plot that uses two different symbols based on a condition in the data. In a for loop iterating through the rows of the data, if a condition is met a point is plotted with a circle, and if not met the point is plotted with a square: ``` for i in thick.index: if thick['Interest'][i] == 1: ...
2014/03/31
[ "https://Stackoverflow.com/questions/22760270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3087409/" ]
FireMonkey images use a 32-bit per pixel schema with 8 bits each for red, green and blue plus an extra 8 bits for transparency, also called an alpha channel. If the value of the alpha channel is #FF the pixel will be opaque, #00 will be completely transparent and values in between will vary the transparency accordingly...
Yoy can change de background color (simple color) of Image and select it in the MultiResBitmap editor BEFORE load the bipmap image (bitmap with white on background): ![enter image description here](https://i.stack.imgur.com/9TpZG.png) Or add real transparency to the image and convert it to PNG. If you load a PNG wit...
22,760,270
I'm making a scatter plot that uses two different symbols based on a condition in the data. In a for loop iterating through the rows of the data, if a condition is met a point is plotted with a circle, and if not met the point is plotted with a square: ``` for i in thick.index: if thick['Interest'][i] == 1: ...
2014/03/31
[ "https://Stackoverflow.com/questions/22760270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3087409/" ]
Yoy can change de background color (simple color) of Image and select it in the MultiResBitmap editor BEFORE load the bipmap image (bitmap with white on background): ![enter image description here](https://i.stack.imgur.com/9TpZG.png) Or add real transparency to the image and convert it to PNG. If you load a PNG wit...
I give a code answer here [Is there an FMX function to set a TImage's transparent color at runtime?](https://stackoverflow.com/questions/22948442/is-there-an-fmx-function-to-set-a-timages-transparent-color-at-runtime) that might solve this problem. It's in C++ with XE5, but I imagine conversion to Delphi should be fair...
22,760,270
I'm making a scatter plot that uses two different symbols based on a condition in the data. In a for loop iterating through the rows of the data, if a condition is met a point is plotted with a circle, and if not met the point is plotted with a square: ``` for i in thick.index: if thick['Interest'][i] == 1: ...
2014/03/31
[ "https://Stackoverflow.com/questions/22760270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3087409/" ]
FireMonkey images use a 32-bit per pixel schema with 8 bits each for red, green and blue plus an extra 8 bits for transparency, also called an alpha channel. If the value of the alpha channel is #FF the pixel will be opaque, #00 will be completely transparent and values in between will vary the transparency accordingly...
I give a code answer here [Is there an FMX function to set a TImage's transparent color at runtime?](https://stackoverflow.com/questions/22948442/is-there-an-fmx-function-to-set-a-timages-transparent-color-at-runtime) that might solve this problem. It's in C++ with XE5, but I imagine conversion to Delphi should be fair...
51,320,770
As shown in the image, the constraints are not visible besides activating them. I have no idea how to solve this problem. ![Screenshot](https://i.stack.imgur.com/7h8je.png) Thanks. [Edit] Here is the XML Code, i haven't changed anything just added the Elements on the Design Tab. ``` <?xml version="1.0" encoding="ut...
2018/07/13
[ "https://Stackoverflow.com/questions/51320770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7489860/" ]
It is happen In Android Studio 3.1.3 when We are using appcompact-v7:28.0.0-alpha3 library (It automatically take this library). Open the build.gradle (Module:app) and check in the dependencies that which version of appcompact are you using. If "com.android.support:appcompat-v7:28.0.0-alpha3" then just changed the alph...
Well this is a known **issue in appCompat library version** v7-28.0.0alpha/ which is being used directly with the latest build tools! there are **two solutions** to this! either **upgrade your build tools** from your sdk manager's tools tab! or **second way** is reverting back to 27.1.1 [![enter image descriptio...
51,320,770
As shown in the image, the constraints are not visible besides activating them. I have no idea how to solve this problem. ![Screenshot](https://i.stack.imgur.com/7h8je.png) Thanks. [Edit] Here is the XML Code, i haven't changed anything just added the Elements on the Design Tab. ``` <?xml version="1.0" encoding="ut...
2018/07/13
[ "https://Stackoverflow.com/questions/51320770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7489860/" ]
It is happen In Android Studio 3.1.3 when We are using appcompact-v7:28.0.0-alpha3 library (It automatically take this library). Open the build.gradle (Module:app) and check in the dependencies that which version of appcompact are you using. If "com.android.support:appcompat-v7:28.0.0-alpha3" then just changed the alph...
My version version of Android Studio (v3.1.4) has a slightly different line of code for appcompact with no mention of alpha3 `implementation 'com.android.support:appcompact-v7:28.0.0-rc01'` so i just changed it to above version 27 and clicked Sync Project With Gradle Files and it now shows the constraints perfectly...
7,048,472
I have been using the following to get and email people in my database. The problem is now that the database has over 500+ members the script slows down and SHOWS each member email address in TO: field. I tried a suggestion on another site to use BCC instead but I was wondering isn't there a way to alter this to send t...
2011/08/13
[ "https://Stackoverflow.com/questions/7048472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/892728/" ]
php's mail() is very inefficient, I suggest using something like [phpmailer](http://phpmailer.worxware.com/) from the manual: > > Note: > > > It is worth noting that the mail() function is not suitable for larger > volumes of email in a loop. This function opens and closes an SMTP > socket for each email, which ...
You need to use PHPMailer as it is meant to be used for just this situation. the trouble with mail() is that it opens and closes a connection after each email. You obviously want to open 1 connection, send all your emails (one by one) and close the connection. Something like [below](http://www.twmsc2011.com/docs/exten...
33,473,236
Hi guys I have a problem displaying my map values. This is my code : **CustomAdapter:** ``` Map<String, List<Show>> map; List<Map.Entry<String, List<Show>>> list; public WorldShowsAdapter(Context context, Map<String, List<Show>> map) { this.context = context; this.map = map; list...
2015/11/02
[ "https://Stackoverflow.com/questions/33473236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Provide more codes might help to imporove accuracy of an answer; however, let's be assuming you have already been able to discover all characteristic values. Usually you just need to iterate all characteristics and set/write value according to each Client Characteristic Configuration(CCC) descriptor in `CBPeripheralDel...
You need to check for the availability of the characteristic's notification. [From Apple's doc](https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/PerformingCommonCentralRoleTasks/PerformingCommonCentralRoleTasks.html#//apple_ref/doc/uid/TP40013257-CH3-SW7...
57,357,189
I have a program which gets a very big txt data and changes the order of some columns in this txt data. For more details about what it does exactly see my question [here](https://stackoverflow.com/questions/57274751/change-order-of-columns-in-a-txt-file). I use a list with maps and I can imagine that this is too much f...
2019/08/05
[ "https://Stackoverflow.com/questions/57357189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8271518/" ]
In cases like this, it makes sense, if at all possible, to read the file line by line and handle each line seperately, and NOT keep the whole file in memory. Currently your code looks like this: 1. read all lines into list L 2. for each row in L find all columns 3. convert rows in L to maps (using "null" string insid...
You can specify the maximum memory JVM can use by specyfying: -Xmx eg. `-Xmx8G`, Use M or G
57,357,189
I have a program which gets a very big txt data and changes the order of some columns in this txt data. For more details about what it does exactly see my question [here](https://stackoverflow.com/questions/57274751/change-order-of-columns-in-a-txt-file). I use a list with maps and I can imagine that this is too much f...
2019/08/05
[ "https://Stackoverflow.com/questions/57357189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8271518/" ]
In cases like this, it makes sense, if at all possible, to read the file line by line and handle each line seperately, and NOT keep the whole file in memory. Currently your code looks like this: 1. read all lines into list L 2. for each row in L find all columns 3. convert rows in L to maps (using "null" string insid...
We aren't really able to give a concrete recommendation for the amount of memory to allocate, because that will depend greatly on your server setup, the size of your user base, and their behaviour. You will need to find a value that works for you, i.e. no noticeable GC pauses, and no OutOfMemory errors. For reference,...
88,846
I'm approaching the end of the first year of my PhD and I really am struggling to find what my research question is. I'm slightly panicing that I don't know what I'm doing yet and I get very little support from my supervisor. I've spent time exploring the literature and I have a few broad ideas of potential areas. The ...
2017/05/02
[ "https://academia.stackexchange.com/questions/88846", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/72922/" ]
Several things come to mind: First, know that this is frustrating for many PhD students and it is normal for people to feel anxious if they aren't on a set course for their dissertation at the end of year 1. Second, is it possible that your advisor is not a great match for you? My dissertation chair was not an expert...
As HEITZ has written, there are many styles and his seems to be firmly in the 'you must reach the answer within yourself' category. Yes, it's very true that students can be influenced into doing something they weren't 100% in love with and therefore end up being disillusioned, but they are there to guide you and the ...
88,846
I'm approaching the end of the first year of my PhD and I really am struggling to find what my research question is. I'm slightly panicing that I don't know what I'm doing yet and I get very little support from my supervisor. I've spent time exploring the literature and I have a few broad ideas of potential areas. The ...
2017/05/02
[ "https://academia.stackexchange.com/questions/88846", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/72922/" ]
There are several advising 'styles' if you can call them that. The spectrum probably runs from 'do this project now' to 'let's meet repeatedly for 6 months until something materializes' Professors are not usually trained in project management, so you might need to step up here and take control of your destiny. He or s...
As HEITZ has written, there are many styles and his seems to be firmly in the 'you must reach the answer within yourself' category. Yes, it's very true that students can be influenced into doing something they weren't 100% in love with and therefore end up being disillusioned, but they are there to guide you and the ...
41,181,742
I want to do an OCR benchmark for scanned text (typically any scan, i.e. A4). I was able to find some NEOCR datasets [here](http://datasets.visionbib.com/), but NEOCR is not really what I want. I would appreciate links to sources of free databases that have appropriate images and the actual texts (contained in the ima...
2016/12/16
[ "https://Stackoverflow.com/questions/41181742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1804389/" ]
I've had good luck using university research data sets in a number of projects. These are often useful because the input and expected results need to be published to independently reproduce the study results. One example is the UNLV data set for the [Fourth Annual Test of OCR Accuracy](https://github.com/tesseract-ocr/...
Coco dataset : <https://vision.cornell.edu/se3/coco-text-2/> Char74Kdatase : <http://www.ee.surrey.ac.uk/CVSSP/demos/chars74k/> COCO dataset is a benchmark dataset for images. World's toughest competitions are arranged using COCO dataset. It can be used for object detecion, image captioning, OCR.
42,984,884
It is awfully often required to write repeatable pieces of code. Consider the following example from `Java` (although, it may not be the best example, but I hope you get the general idea...) `String X = rs.getString("X");` Where `X` will have values: `'name'`,`'surname'` ... and `20`-`30` other values. (Another ...
2017/03/23
[ "https://Stackoverflow.com/questions/42984884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5532778/" ]
In such scenarios, the best thing you could do is to use a constant array together with a HashMap. The constant array will hold keynames for the hashmap whereas the hashmap will also hold the value for each one. For instance: ``` String[] keys = {"name", "surname", "whatever" }; HashMap<String, String> elements = new...
In IntelliJ we have "Live Template" feature that you use to generate part of the code. For example, when you type "sout" , IntelliJ suggests "System.out.println". When you type "main" , Eclipse suggests "public static void main(String[] args)" You can create something like that for pieces of code that are very commo...
42,984,884
It is awfully often required to write repeatable pieces of code. Consider the following example from `Java` (although, it may not be the best example, but I hope you get the general idea...) `String X = rs.getString("X");` Where `X` will have values: `'name'`,`'surname'` ... and `20`-`30` other values. (Another ...
2017/03/23
[ "https://Stackoverflow.com/questions/42984884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5532778/" ]
Probably I am looking for something that does not exist. So, I'll just post my '*hard way*' of achieving, what I have described in my question (in hope that this would be useful for somebody - sometime). Here I will preset a small code generator I am using to generate java, html, jsp, xsd and other codes. I am usin...
In IntelliJ we have "Live Template" feature that you use to generate part of the code. For example, when you type "sout" , IntelliJ suggests "System.out.println". When you type "main" , Eclipse suggests "public static void main(String[] args)" You can create something like that for pieces of code that are very commo...
42,984,884
It is awfully often required to write repeatable pieces of code. Consider the following example from `Java` (although, it may not be the best example, but I hope you get the general idea...) `String X = rs.getString("X");` Where `X` will have values: `'name'`,`'surname'` ... and `20`-`30` other values. (Another ...
2017/03/23
[ "https://Stackoverflow.com/questions/42984884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5532778/" ]
You can do that with a lightweight code generator like Telosys : * <http://www.telosys.org/> * <https://modeling-languages.com/telosys-tools-the-concept-of-lightweight-model-for-code-generation/> In your case Telosys-CLI with a DSL model is probably the right choice, you'll just have to create your specific templates...
In IntelliJ we have "Live Template" feature that you use to generate part of the code. For example, when you type "sout" , IntelliJ suggests "System.out.println". When you type "main" , Eclipse suggests "public static void main(String[] args)" You can create something like that for pieces of code that are very commo...
42,984,884
It is awfully often required to write repeatable pieces of code. Consider the following example from `Java` (although, it may not be the best example, but I hope you get the general idea...) `String X = rs.getString("X");` Where `X` will have values: `'name'`,`'surname'` ... and `20`-`30` other values. (Another ...
2017/03/23
[ "https://Stackoverflow.com/questions/42984884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5532778/" ]
In such scenarios, the best thing you could do is to use a constant array together with a HashMap. The constant array will hold keynames for the hashmap whereas the hashmap will also hold the value for each one. For instance: ``` String[] keys = {"name", "surname", "whatever" }; HashMap<String, String> elements = new...
If I understand your problem correctly, you have a `ResultSet` with a lot of columns. And you do not want to get them one by one. It is possible to get all the columns from a `ResultSet` the following way: ``` ResultSetMetaData metaData = resultSet.getMetaData(); for (int columnIndex = 1; columnIndex <= metaData.getCo...
42,984,884
It is awfully often required to write repeatable pieces of code. Consider the following example from `Java` (although, it may not be the best example, but I hope you get the general idea...) `String X = rs.getString("X");` Where `X` will have values: `'name'`,`'surname'` ... and `20`-`30` other values. (Another ...
2017/03/23
[ "https://Stackoverflow.com/questions/42984884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5532778/" ]
Probably I am looking for something that does not exist. So, I'll just post my '*hard way*' of achieving, what I have described in my question (in hope that this would be useful for somebody - sometime). Here I will preset a small code generator I am using to generate java, html, jsp, xsd and other codes. I am usin...
In such scenarios, the best thing you could do is to use a constant array together with a HashMap. The constant array will hold keynames for the hashmap whereas the hashmap will also hold the value for each one. For instance: ``` String[] keys = {"name", "surname", "whatever" }; HashMap<String, String> elements = new...
42,984,884
It is awfully often required to write repeatable pieces of code. Consider the following example from `Java` (although, it may not be the best example, but I hope you get the general idea...) `String X = rs.getString("X");` Where `X` will have values: `'name'`,`'surname'` ... and `20`-`30` other values. (Another ...
2017/03/23
[ "https://Stackoverflow.com/questions/42984884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5532778/" ]
You can do that with a lightweight code generator like Telosys : * <http://www.telosys.org/> * <https://modeling-languages.com/telosys-tools-the-concept-of-lightweight-model-for-code-generation/> In your case Telosys-CLI with a DSL model is probably the right choice, you'll just have to create your specific templates...
In such scenarios, the best thing you could do is to use a constant array together with a HashMap. The constant array will hold keynames for the hashmap whereas the hashmap will also hold the value for each one. For instance: ``` String[] keys = {"name", "surname", "whatever" }; HashMap<String, String> elements = new...
42,984,884
It is awfully often required to write repeatable pieces of code. Consider the following example from `Java` (although, it may not be the best example, but I hope you get the general idea...) `String X = rs.getString("X");` Where `X` will have values: `'name'`,`'surname'` ... and `20`-`30` other values. (Another ...
2017/03/23
[ "https://Stackoverflow.com/questions/42984884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5532778/" ]
Probably I am looking for something that does not exist. So, I'll just post my '*hard way*' of achieving, what I have described in my question (in hope that this would be useful for somebody - sometime). Here I will preset a small code generator I am using to generate java, html, jsp, xsd and other codes. I am usin...
If I understand your problem correctly, you have a `ResultSet` with a lot of columns. And you do not want to get them one by one. It is possible to get all the columns from a `ResultSet` the following way: ``` ResultSetMetaData metaData = resultSet.getMetaData(); for (int columnIndex = 1; columnIndex <= metaData.getCo...
42,984,884
It is awfully often required to write repeatable pieces of code. Consider the following example from `Java` (although, it may not be the best example, but I hope you get the general idea...) `String X = rs.getString("X");` Where `X` will have values: `'name'`,`'surname'` ... and `20`-`30` other values. (Another ...
2017/03/23
[ "https://Stackoverflow.com/questions/42984884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5532778/" ]
You can do that with a lightweight code generator like Telosys : * <http://www.telosys.org/> * <https://modeling-languages.com/telosys-tools-the-concept-of-lightweight-model-for-code-generation/> In your case Telosys-CLI with a DSL model is probably the right choice, you'll just have to create your specific templates...
If I understand your problem correctly, you have a `ResultSet` with a lot of columns. And you do not want to get them one by one. It is possible to get all the columns from a `ResultSet` the following way: ``` ResultSetMetaData metaData = resultSet.getMetaData(); for (int columnIndex = 1; columnIndex <= metaData.getCo...
31,981,072
I installed cordova-plugin-splashscreen but this doesnt help me. What lines should I add to my config.xml file and where to place the splash.9.png file? Previously (before updating my Cordova version to the latest one) splashscreen was working fine with the following options: ``` <preference name="splashscreen" val...
2015/08/13
[ "https://Stackoverflow.com/questions/31981072", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2922399/" ]
I think you can use the attribute sortFunction. I quote from the Primefaces 5.1 User Guide page 153-154 > > Instead of using the default sorting algorithm which uses a java > comparator, you can plug-in your own sort method as well > > > ``` public int sortByModel(Object car1, Object car2) { car2.compareTo(...
You need to use sortFunction="#{testBean.customSort}" and you can customized your sorting.
680,957
> > For the Fibonacci sequence $F\_1=F\_2=1$, $F\_{n+2}=F\_n+F\_{n+1}$, prove that $$\sum\_{i=1}^n F\_i= F\_{n+2} - 1$$ for $n\ge 1$. > > > I don't quite know how to approach this problem. Can someone help and explain please?
2014/02/18
[ "https://math.stackexchange.com/questions/680957", "https://math.stackexchange.com", "https://math.stackexchange.com/users/124878/" ]
Let us do an induction on $n$. * *Induction start.* For $n=1$, we have $F\_1=1=F\_3-1$, so the induction start is done. * *Induction hypothesis.* Let us assume we proved the assertion already for $n-1$. * *Induction step.* Then $$\sum\_{k=1}^n F\_k = \color{red}{\sum\_{k=1}^{n-1} F\_k} + F\_n = \color{red}{F\_{n+1}-...
Just for fun, let us try to prove $\sum\limits\_{k=1}^n F\_k= F\_{n+2} - 1$ using [Binet's formula](http://en.wikipedia.org/wiki/Fibonacci_number#Closed-form_expression). --- Recall that we have $$F\_n=\frac{a^n-b^n}{\sqrt5}$$ where $a=\frac{1+\sqrt5}2$ and $b=\frac{1-\sqrt5}2$. A few identities, that are easy to ch...
680,957
> > For the Fibonacci sequence $F\_1=F\_2=1$, $F\_{n+2}=F\_n+F\_{n+1}$, prove that $$\sum\_{i=1}^n F\_i= F\_{n+2} - 1$$ for $n\ge 1$. > > > I don't quite know how to approach this problem. Can someone help and explain please?
2014/02/18
[ "https://math.stackexchange.com/questions/680957", "https://math.stackexchange.com", "https://math.stackexchange.com/users/124878/" ]
We define $F\_{n + 2} = F\_n + F\_{n + 1}$. From this we see that $$F\_n = F\_{n + 2} - F\_{n + 1}\\ \sum\_{i = 1}^nF\_n = \sum\_{i = 1}^n \left(F\_{n + 2} - F\_{n + 1}\right)\\ \sum\_{i = 1}^nF\_n = F\_{n + 2} - F\_2\\ \sum\_{i = 1}^nF\_n = F\_{n + 2} - 1$$ We basically hinge upon the large amounts of cancellation ...
Just for fun, let us try to prove $\sum\limits\_{k=1}^n F\_k= F\_{n+2} - 1$ using [Binet's formula](http://en.wikipedia.org/wiki/Fibonacci_number#Closed-form_expression). --- Recall that we have $$F\_n=\frac{a^n-b^n}{\sqrt5}$$ where $a=\frac{1+\sqrt5}2$ and $b=\frac{1-\sqrt5}2$. A few identities, that are easy to ch...
680,957
> > For the Fibonacci sequence $F\_1=F\_2=1$, $F\_{n+2}=F\_n+F\_{n+1}$, prove that $$\sum\_{i=1}^n F\_i= F\_{n+2} - 1$$ for $n\ge 1$. > > > I don't quite know how to approach this problem. Can someone help and explain please?
2014/02/18
[ "https://math.stackexchange.com/questions/680957", "https://math.stackexchange.com", "https://math.stackexchange.com/users/124878/" ]
**Hint** $\: $ It is straightforward to inductively prove this basic theorem on additive telescopy $$\rm\ g(n)\ =\ \sum\_{i\: =\: 1}^n\:\ f(i)\ \ \iff\ \ \ g(n) - g(n\!-\!1)\ =\ f(n)\ \ for\ \ n> 1,\,\ \ g(1)=f(1)$$ Your is special case $\rm\ f(n) = F\_n,\ \ g(n) = F\_{n+2}-1,\, $ which is easily checked to satisfy t...
Just for fun, let us try to prove $\sum\limits\_{k=1}^n F\_k= F\_{n+2} - 1$ using [Binet's formula](http://en.wikipedia.org/wiki/Fibonacci_number#Closed-form_expression). --- Recall that we have $$F\_n=\frac{a^n-b^n}{\sqrt5}$$ where $a=\frac{1+\sqrt5}2$ and $b=\frac{1-\sqrt5}2$. A few identities, that are easy to ch...
229,353
In my main page (call it `index.aspx`) I call ``` <%Html.RenderPartial("_PowerSearch", ViewData.Model);%> ``` Here the `viewdata.model != null` When I arrive at my partial: ``` <%=ViewData.Model%> ``` Says `viewdata.model == null` What gives?!
2008/10/23
[ "https://Stackoverflow.com/questions/229353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11333/" ]
Have you tried just passing in ViewData instead of ViewData.Model? This is an abridged version what I use in my helpers (shamelessly stolen from the Storefront series): ``` /// <summary> /// Renders a LoggingWeb user control. /// </summary> /// <param name="helper">Helper to extend.</param> /// <pa...
This is untested: ``` <%=Html.RenderPartial("_ColorList.ascx", new ViewDataDictionary(ViewData.Model.Colors));%> ``` Your control view is expecting view data specific to it in this case. If your control wants a property on the model called Colors then perhaps: ``` <%=Html.RenderPartial("_ColorList.ascx", new ViewDa...
55,687,308
Adjust the select box when option value is bigger using element ui How this is possible please guide It should not cut the string after selection ``` <template> <el-select v-model="value" placeholder="Select"> <el-option v-for="item in options" :key="item.value" :label="item.label" :va...
2019/04/15
[ "https://Stackoverflow.com/questions/55687308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10052353/" ]
Add some padding to the select input as follows : ``` .el-select>.el-input { display: block; padding-right: 2px; } ``` ```js var Main = { data() { return { options: [{ value: 'OptionFirstWithBigCharacter', label: 'OptionFirstWithBigCharacter' }, { ...
That's an interesting question. Obviously, the solution would be to calculate the text width of selected value and adjust select to this width, but that's a tricky task. Under the hood `el-select` uses `<input>` element to show selected item, and `<input>` can't adjust its width based on its value, so we'd need to us...
13,812
[*Garry's Mod*](http://www.garrysmod.com/) has a [copy-protection trap that shows this error](http://www.playerattack.com/news/2011/04/12/garrys-mod-catches-pirates-the-fun-way/): > > Unable to shade polygon normals > > > It made me wonder if such a problem could ever *actually* exist. Can polygon normals be shad...
2011/06/17
[ "https://gamedev.stackexchange.com/questions/13812", "https://gamedev.stackexchange.com", "https://gamedev.stackexchange.com/users/1966/" ]
"Can a polygon normal be shaded" - No, a normal is a vector which is a 1-d object, so unless you're going to actually draw the normal and shade it, that statement doesn't make much sense. However, shading polygons (2-d objects) commonly use the polygon normal in their shading calculations for light calculations to con...
It's 100% not possible to shade a normal at all. As discussed in [this link](https://www.bit-tech.net/news/gaming/garry-s-mod-traps-pirates-with-error/1/) from the comments, the message was chosen to stop people from being able to research it, to tempt them into asking about it, and outing themselves as pirates. This...
13,812
[*Garry's Mod*](http://www.garrysmod.com/) has a [copy-protection trap that shows this error](http://www.playerattack.com/news/2011/04/12/garrys-mod-catches-pirates-the-fun-way/): > > Unable to shade polygon normals > > > It made me wonder if such a problem could ever *actually* exist. Can polygon normals be shad...
2011/06/17
[ "https://gamedev.stackexchange.com/questions/13812", "https://gamedev.stackexchange.com", "https://gamedev.stackexchange.com/users/1966/" ]
Normals in 3D graphics are a 3D vector indicating orientation or direction. Normals themselves cannot be shades, as how can you shade {.1,0,.4} ? Normals can be used to shade the polygons themselves. For example, a light source at a certain angle hitting a model made of polygons at a certain angle, the normals of the...
It's 100% not possible to shade a normal at all. As discussed in [this link](https://www.bit-tech.net/news/gaming/garry-s-mod-traps-pirates-with-error/1/) from the comments, the message was chosen to stop people from being able to research it, to tempt them into asking about it, and outing themselves as pirates. This...
34,538,343
1. If I am correct, a remote-tracking branch can be created when cloning the remote repository. Are there other cases when a remote-tracking branch is created? 2. If I am right, a remote-tracking branch is updated when fetching/pulling from the remote repository. Are there other cases when a remote-tracking branch is u...
2015/12/30
[ "https://Stackoverflow.com/questions/34538343", "https://Stackoverflow.com", "https://Stackoverflow.com/users/156458/" ]
Let's take these [~~three~~ four](https://people.csail.mit.edu/paulfitz/spanish/script.html) :-) questions in order, more or less: > > 1. ... a remote-tracking branch can be created when cloning the remote repository. Are there other cases when a remote-tracking branch is created? > > > They are; and at least pot...
Answers: 1. After initially cloning a Git repository, whenever somebody pushes up a new branch, a remote-tracking branch will be created for this new branch after a doing routine `fetch` (or `pull`). 2. Not that I'm aware of. Fetching or pulling should be the only two operations that update a remote-tracking branch. 3...
44,280,718
I have 4 byte data stream, I know at what bite I wanted to split them and assign them to a different variable. keeping in mind the data I receive is in hex format. let's say, ``` P_settings 4bytes p_timeout [6:0] p_s_detected[7] p_o_timeout [14:8] p_o_ti...
2017/05/31
[ "https://Stackoverflow.com/questions/44280718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5073018/" ]
Try code like this. You said input was a stream. ``` public class P_Settings { byte p_timeout; //[6:0] Boolean p_s_detected; //[7] byte p_o_timeout; // [14:8] Boolean p_o_timeout_set; // [15] byte override_l_lvl; //[23:16] byte l_b_lvl; //[31:24] pub...
SO it turns out it much easier that i thought.. 1) separate them by single byte and put them in a buffer and & operate them individually and you will get the data. thanks for all the support. \*\* ``` byte input = (byte)( buffer[10]);//1 byte var p_timeout = (byte)(input & 0x7F); ...
51,558,105
I have an array consisting of hashes in the following form: ``` array = [ {"id": 1, "items": [{"item_code": 1, "qty": 2},{"item_code": 2, "qty": 2}]}, {"id": 2, "items": [{"item_code": 3, "qty": 2},{"item_code": 4, "qty": 2}]}, {"id": 1, "items": [{"item_code": 5, "qty": 2},{"item_code": ...
2018/07/27
[ "https://Stackoverflow.com/questions/51558105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6166821/" ]
Use [`group_by`](https://apidock.com/rails/Enumerable/group_by) and [`each_with_object`](https://apidock.com/rails/Enumerable/each_with_object): ``` ary.group_by { |elem| elem[:id] }. each_with_object([]) do |(id, grouped_ary), out| out << { id: id, items: grouped_ary.map { |h| h[:items]...
You can combine `group_by` and `transform_values!` (for the latter you need Ruby 2.4.0 and later, otherwise you can use `each_with_object` as @Jagdeep pointed out) ``` array.group_by { |item| item[:id] } .transform_values! { |v| v.flat_map { |subitem| subitem[:items] } } .map { |(id, items)| Hash["id", id, "it...
51,558,105
I have an array consisting of hashes in the following form: ``` array = [ {"id": 1, "items": [{"item_code": 1, "qty": 2},{"item_code": 2, "qty": 2}]}, {"id": 2, "items": [{"item_code": 3, "qty": 2},{"item_code": 4, "qty": 2}]}, {"id": 1, "items": [{"item_code": 5, "qty": 2},{"item_code": ...
2018/07/27
[ "https://Stackoverflow.com/questions/51558105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6166821/" ]
Use [`group_by`](https://apidock.com/rails/Enumerable/group_by) and [`each_with_object`](https://apidock.com/rails/Enumerable/each_with_object): ``` ary.group_by { |elem| elem[:id] }. each_with_object([]) do |(id, grouped_ary), out| out << { id: id, items: grouped_ary.map { |h| h[:items]...
``` array.each_with_object({}) { |g,h| h.update(g[:id]=>g[:items]) { |_,o,n| o+n } }. map { |k,v| { id: k, items: v } } #=> [{:id=>1, :items=>[{:item_code=>1, :qty=>2}, {:item_code=>2, :qty=>2}, # {:item_code=>5, :qty=>2}, {:item_code=>6, :qty=>2}]}, # {:id=>2, :items=>[{:item_code=>...
51,558,105
I have an array consisting of hashes in the following form: ``` array = [ {"id": 1, "items": [{"item_code": 1, "qty": 2},{"item_code": 2, "qty": 2}]}, {"id": 2, "items": [{"item_code": 3, "qty": 2},{"item_code": 4, "qty": 2}]}, {"id": 1, "items": [{"item_code": 5, "qty": 2},{"item_code": ...
2018/07/27
[ "https://Stackoverflow.com/questions/51558105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6166821/" ]
There is no need for `group_by`. Go straight with `each_with_object` directly from the scratch. ``` array. each_with_object({}) do |hash, acc| acc[hash[:id]] ? acc[hash[:id]][:items] |= hash[:items] : acc[hash[:id]] = hash end.values #β‡’ [{:id=>1, :items=>[{:item_code=>1, :qty=>2}, # ...
You can combine `group_by` and `transform_values!` (for the latter you need Ruby 2.4.0 and later, otherwise you can use `each_with_object` as @Jagdeep pointed out) ``` array.group_by { |item| item[:id] } .transform_values! { |v| v.flat_map { |subitem| subitem[:items] } } .map { |(id, items)| Hash["id", id, "it...
51,558,105
I have an array consisting of hashes in the following form: ``` array = [ {"id": 1, "items": [{"item_code": 1, "qty": 2},{"item_code": 2, "qty": 2}]}, {"id": 2, "items": [{"item_code": 3, "qty": 2},{"item_code": 4, "qty": 2}]}, {"id": 1, "items": [{"item_code": 5, "qty": 2},{"item_code": ...
2018/07/27
[ "https://Stackoverflow.com/questions/51558105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6166821/" ]
Firstly I map the ids, then for each id, I make a hash with two keys: the id and a flattened map of each entry's items: ``` result = array.group_by { |e| e[:id] }.map { |id, entries| {id: id, items: entries.flat_map { |entry| entry[:items] }} } ```
You can combine `group_by` and `transform_values!` (for the latter you need Ruby 2.4.0 and later, otherwise you can use `each_with_object` as @Jagdeep pointed out) ``` array.group_by { |item| item[:id] } .transform_values! { |v| v.flat_map { |subitem| subitem[:items] } } .map { |(id, items)| Hash["id", id, "it...
51,558,105
I have an array consisting of hashes in the following form: ``` array = [ {"id": 1, "items": [{"item_code": 1, "qty": 2},{"item_code": 2, "qty": 2}]}, {"id": 2, "items": [{"item_code": 3, "qty": 2},{"item_code": 4, "qty": 2}]}, {"id": 1, "items": [{"item_code": 5, "qty": 2},{"item_code": ...
2018/07/27
[ "https://Stackoverflow.com/questions/51558105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6166821/" ]
There is no need for `group_by`. Go straight with `each_with_object` directly from the scratch. ``` array. each_with_object({}) do |hash, acc| acc[hash[:id]] ? acc[hash[:id]][:items] |= hash[:items] : acc[hash[:id]] = hash end.values #β‡’ [{:id=>1, :items=>[{:item_code=>1, :qty=>2}, # ...
``` array.each_with_object({}) { |g,h| h.update(g[:id]=>g[:items]) { |_,o,n| o+n } }. map { |k,v| { id: k, items: v } } #=> [{:id=>1, :items=>[{:item_code=>1, :qty=>2}, {:item_code=>2, :qty=>2}, # {:item_code=>5, :qty=>2}, {:item_code=>6, :qty=>2}]}, # {:id=>2, :items=>[{:item_code=>...
51,558,105
I have an array consisting of hashes in the following form: ``` array = [ {"id": 1, "items": [{"item_code": 1, "qty": 2},{"item_code": 2, "qty": 2}]}, {"id": 2, "items": [{"item_code": 3, "qty": 2},{"item_code": 4, "qty": 2}]}, {"id": 1, "items": [{"item_code": 5, "qty": 2},{"item_code": ...
2018/07/27
[ "https://Stackoverflow.com/questions/51558105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6166821/" ]
Firstly I map the ids, then for each id, I make a hash with two keys: the id and a flattened map of each entry's items: ``` result = array.group_by { |e| e[:id] }.map { |id, entries| {id: id, items: entries.flat_map { |entry| entry[:items] }} } ```
``` array.each_with_object({}) { |g,h| h.update(g[:id]=>g[:items]) { |_,o,n| o+n } }. map { |k,v| { id: k, items: v } } #=> [{:id=>1, :items=>[{:item_code=>1, :qty=>2}, {:item_code=>2, :qty=>2}, # {:item_code=>5, :qty=>2}, {:item_code=>6, :qty=>2}]}, # {:id=>2, :items=>[{:item_code=>...
70,805,143
Trying to run Hybrid Configuration Wizard (HCW) - the part where it says "Installing Hybrid Agent", fails with error code 1603 ("Setup terminiated with an Exit Code 1603"). It seems like an installation issue since it appears to be MSI log that has the error in it (see image). I imagine this could be TLS issue but I ...
2022/01/21
[ "https://Stackoverflow.com/questions/70805143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6147663/" ]
For HCW to work properly with TLS 1.2, verify the SChannel and .NET Framework registry values are enabled. Create a .REG file, copy the entire section below, then merge the file to update your entries. --- > > Windows Registry Editor Version 5.00 > > > [HKEY\_LOCAL\_MACHINE\SOFTWARE\Microsoft.NETFramework\v2.0.50...
I think the correct key names is "...\Microsoft\.NETFramework..." :-)
69,735,726
I am currently tasked to send realtime data that I stored in firestore to telegram. When I watch online tutorials, I mainly see people using realtime database to send data to telegram instead of firestore. I would like to know, is it possible to send data that is stored in firestore to telegram?
2021/10/27
[ "https://Stackoverflow.com/questions/69735726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17118274/" ]
There is nothing in the Firebase APIs that automatically sends data in Firestore to Telegram, but since both have Firestore and Telegram have APIs you can build this functionality yourself. A common approach would be to create this as a Cloud Function, which is a piece of code that automatically gets triggered when yo...
So, yes you can do it. Here the simple example on Python language. Look the all docs here: <https://firebase.google.com/docs/firestore/query-data/get-data> and <https://firebase.google.com/docs/firestore/quickstart> ``` default_app = firebase_admin.initialize_app() db = firestore.client() users_ref = db.collection(u'u...
3,614,050
It seems like the following scenario shouldn't be uncommon, but I can't figure out how to handle it in FluenNHibernate: ``` public class Product: BaseEntity { public Product() { Categories = new List<Category>(); } public virtual IList<Category> Categories { get; set; } ... } public enum ...
2010/08/31
[ "https://Stackoverflow.com/questions/3614050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/205856/" ]
I had tried the concatenated string in another instance like this, but I really wanted something that didn't need to be transformed every time. As it turns out, I found a very similar question here: [Map to a list of Enums?](https://stackoverflow.com/questions/1423927/map-to-a-list-of-enums). As described there, this o...
There are a few ways to do this, none of them as straightforward as you might expect. While NHibernate and Fluent NHibernate do quite well with a single `enum`, a collection is significantly more troublesom. Here are a couple of approaches: 1. Persist the collection to a single `nvarchar(?)` column by concatenating t...
3,614,050
It seems like the following scenario shouldn't be uncommon, but I can't figure out how to handle it in FluenNHibernate: ``` public class Product: BaseEntity { public Product() { Categories = new List<Category>(); } public virtual IList<Category> Categories { get; set; } ... } public enum ...
2010/08/31
[ "https://Stackoverflow.com/questions/3614050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/205856/" ]
[This accepted answer](https://stackoverflow.com/questions/3614050/fluentnhibernate-how-to-handle-one-to-many-values-when-the-many-is-a-simple-enum/3622023#3622023) worked for me, however the enum was mapped as in int. To get it to map as a string (my preference) I adapted the mapping as follows: ``` public void Over...
There are a few ways to do this, none of them as straightforward as you might expect. While NHibernate and Fluent NHibernate do quite well with a single `enum`, a collection is significantly more troublesom. Here are a couple of approaches: 1. Persist the collection to a single `nvarchar(?)` column by concatenating t...
3,614,050
It seems like the following scenario shouldn't be uncommon, but I can't figure out how to handle it in FluenNHibernate: ``` public class Product: BaseEntity { public Product() { Categories = new List<Category>(); } public virtual IList<Category> Categories { get; set; } ... } public enum ...
2010/08/31
[ "https://Stackoverflow.com/questions/3614050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/205856/" ]
I had tried the concatenated string in another instance like this, but I really wanted something that didn't need to be transformed every time. As it turns out, I found a very similar question here: [Map to a list of Enums?](https://stackoverflow.com/questions/1423927/map-to-a-list-of-enums). As described there, this o...
At work, while it did not concern a collection of enum value, we created a custom type (by implementing `IUserType` to store a `IDictionary<CultureInfo, string>`. We converted the dictionary into a xml document (XDocument) and we stored the data in an Xml column in Sql Server, although any string column could store th...
3,614,050
It seems like the following scenario shouldn't be uncommon, but I can't figure out how to handle it in FluenNHibernate: ``` public class Product: BaseEntity { public Product() { Categories = new List<Category>(); } public virtual IList<Category> Categories { get; set; } ... } public enum ...
2010/08/31
[ "https://Stackoverflow.com/questions/3614050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/205856/" ]
[This accepted answer](https://stackoverflow.com/questions/3614050/fluentnhibernate-how-to-handle-one-to-many-values-when-the-many-is-a-simple-enum/3622023#3622023) worked for me, however the enum was mapped as in int. To get it to map as a string (my preference) I adapted the mapping as follows: ``` public void Over...
At work, while it did not concern a collection of enum value, we created a custom type (by implementing `IUserType` to store a `IDictionary<CultureInfo, string>`. We converted the dictionary into a xml document (XDocument) and we stored the data in an Xml column in Sql Server, although any string column could store th...
24,527,478
I have a `UIView` defined in a .xib file. I need to set `translatesAutoresizingMaskIntoConstraints = NO`. This means that the frame is not translated to constraints so I need to set the size constraints by myself. I have created a working category method for a `UIView`: ``` -(NSArray*)setSizeConstraints:(CGSize)size ...
2014/07/02
[ "https://Stackoverflow.com/questions/24527478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1118969/" ]
This actually is possible. -------------------------- Simply put the view you'd like to constrain into another view, like the highlighted view here. [![enter image description here](https://i.stack.imgur.com/PPoyc.png)](https://i.stack.imgur.com/PPoyc.png) Then, add your desired constraints. Finally, pull the view y...
As you've surely found out by now, it looks like there's currently no way to set Autolayout constraints at the main `UIView` level from Interface Builder. I had a similar problem here ([Launch Screen XIB: Missing Width / Height Constraints (Xcode 6)](https://stackoverflow.com/questions/28219842/launch-screen-xib-missi...
17,509,479
I am writing a simple program which takes the arguments form the user and process them. I have the arguments in the argv which is two dimensional array. But when i ran the program, i get the garbage value and the segmentation fault error. I have tried with using argc as terminating condition and it works. But i want to...
2013/07/07
[ "https://Stackoverflow.com/questions/17509479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1930329/" ]
* If you want to iterate through program arguments looking for the terminating null pointer, your outer cycle should be ``` while (*++argv) ``` not the ``` while (++*argv) // <- incorrect! ``` that you have in your code. * Your `switch` expression is written incorrectly. While your intent is clear, your implemen...
Your ultimate problem is operator precedence. Don't try to be clever when it's unnecessary. The `*` operator does not work as you think it does. I've rewritten your code using `[0]` instead, and now it works: ``` #include <stdio.h> int main(int argc, char *argv[]) { while ((++argv)[0]) { if (argv[...
17,509,479
I am writing a simple program which takes the arguments form the user and process them. I have the arguments in the argv which is two dimensional array. But when i ran the program, i get the garbage value and the segmentation fault error. I have tried with using argc as terminating condition and it works. But i want to...
2013/07/07
[ "https://Stackoverflow.com/questions/17509479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1930329/" ]
* If you want to iterate through program arguments looking for the terminating null pointer, your outer cycle should be ``` while (*++argv) ``` not the ``` while (++*argv) // <- incorrect! ``` that you have in your code. * Your `switch` expression is written incorrectly. While your intent is clear, your implemen...
`argv` is an array of strings. `argv[0]` is the program name which in your case is `a.out`. Your options start from `argv[1]`. So you need to iterate `argv` from 1 to `argc-1` to get the options. Also see here: [Parsing Program Arguments](http://www.gnu.org/software/libc/manual/html_node/Parsing-Program-Arguments.html...
17,509,479
I am writing a simple program which takes the arguments form the user and process them. I have the arguments in the argv which is two dimensional array. But when i ran the program, i get the garbage value and the segmentation fault error. I have tried with using argc as terminating condition and it works. But i want to...
2013/07/07
[ "https://Stackoverflow.com/questions/17509479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1930329/" ]
Your ultimate problem is operator precedence. Don't try to be clever when it's unnecessary. The `*` operator does not work as you think it does. I've rewritten your code using `[0]` instead, and now it works: ``` #include <stdio.h> int main(int argc, char *argv[]) { while ((++argv)[0]) { if (argv[...
`argv` is an array of strings. `argv[0]` is the program name which in your case is `a.out`. Your options start from `argv[1]`. So you need to iterate `argv` from 1 to `argc-1` to get the options. Also see here: [Parsing Program Arguments](http://www.gnu.org/software/libc/manual/html_node/Parsing-Program-Arguments.html...
24,609,357
This is my code for generating random numbers from 1-99, but it's only generating same set of numbers (15 numbers) every time. I'm storing those numbers in an `NSArray` and getting output in `NSLog` properly. It's ok, but I want different set of random numbers with no repeated number whenever I call this random method....
2014/07/07
[ "https://Stackoverflow.com/questions/24609357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3208986/" ]
You have to seed the generator before using it. If you want to skip the seeding, you can use **arc4random\_uniform()**. It's a different algorithm and takes care of the seeding process on its own. Other than that, you can use it in your code almost exactly like you used **random()**. You'll just have to specify the upp...
Try this command before starting your arc4random ``` srand(time(NULL)); ```
24,609,357
This is my code for generating random numbers from 1-99, but it's only generating same set of numbers (15 numbers) every time. I'm storing those numbers in an `NSArray` and getting output in `NSLog` properly. It's ok, but I want different set of random numbers with no repeated number whenever I call this random method....
2014/07/07
[ "https://Stackoverflow.com/questions/24609357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3208986/" ]
You have to seed the generator before using it. If you want to skip the seeding, you can use **arc4random\_uniform()**. It's a different algorithm and takes care of the seeding process on its own. Other than that, you can use it in your code almost exactly like you used **random()**. You'll just have to specify the upp...
If I understand you correctly you want a set containing 15 random numbers between 1-99. You can use the following: ``` - (NSSet *)randomSetOfSize:(int)size lowerBound:(int)lowerBound upperBound:(int)upperBound { NSMutableSet *randomSet=[NSMutableSet new]; while (randomSet.count <size) { int randomInt=a...
32,261,091
I have a static image which will expire in 9 minutes. It has following headers set by the server: Cache-control: max0age=523 Expires: Thu, 27 Aug 2015 23:28:14 GMT (in 5 minutes) Last-Modified:Wed, 12 Nov 2014 08:06:06 GMT When I refresh the page browser makes request to server instead of serving it from the cache. ...
2015/08/27
[ "https://Stackoverflow.com/questions/32261091", "https://Stackoverflow.com", "https://Stackoverflow.com/users/250849/" ]
Referencing an answer from here: [puma initializer does not work with rails 4.2](https://stackoverflow.com/questions/32259490/puma-initializer-does-not-work-with-rails-4-2) Put the `puma.rb` file in `config/` not `config/initializers/`
you need to use foreman <https://github.com/ddollar/foreman> to run the `Procfile`. That is how heroku will spool up the app. once installed `foreman start` should do the trick. this just fooled me for a bit and I ran across your question.
68,146,769
So I've been struggling with the following problem for a while. I achieved this (John's example): [![What I achieved](https://i.stack.imgur.com/EnvfU.png)](https://i.stack.imgur.com/EnvfU.png) But what I'm trying to do is to force the hour to **always** be shown directly after the text, and if the text is too long - ...
2021/06/26
[ "https://Stackoverflow.com/questions/68146769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13505425/" ]
Something like this? ```kotlin @Preview(showBackground = true) @Composable fun Test() { Column { Message(message = "short message") Message(message = "short") Message(message = "very long message") } } @Composable fun Message(message: String) { Text("John Doe") Row(horizontalAr...
You can achieve this with a `Layout` and using `IntrinsicWidth`. You can build on this example as it only uses 2 `Text`s for the children, but this should get you on the right path. ``` @Composable fun MyRow( modifier: Modifier = Modifier, content: @Composable () -> Unit, ) { Layout( content = cont...
22,988,271
I am getting error when I try to connect database **Error:com.microsoft.sqlserver.jdbc.SQLServerConnection cannot be cast to Ptakip.Connection** * Ptakip is my Package * Connection is my Class Here is the Connection Class Code ; ``` import java.sql.*; public class Connection { private Connection cn; public ...
2014/04/10
[ "https://Stackoverflow.com/questions/22988271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3498019/" ]
I'm not sure I completely understand, but I will try to give you some information. Like David said It may seem that the first request is the last one responding, but that will vary under many circumstances. There are different ways you could do this to control the outcome or order of the requests. 1) Upon success of ...
``` var result1; var result2; $.when( $.ajax({ // First Request url: form_url, type: form_method, data: form_data, cache: false, success: function(returnhtml){ result1 = returnhtml; } }); $.ajax({...
22,988,271
I am getting error when I try to connect database **Error:com.microsoft.sqlserver.jdbc.SQLServerConnection cannot be cast to Ptakip.Connection** * Ptakip is my Package * Connection is my Class Here is the Connection Class Code ; ``` import java.sql.*; public class Connection { private Connection cn; public ...
2014/04/10
[ "https://Stackoverflow.com/questions/22988271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3498019/" ]
Gaurav, you have an error, at the end of the 1st $.ajax it must end as `),` and 2nd as `)`. You can't end with `;` ```js var result1; var result2; $.when( $.ajax({ // First Request url: form_url, type: form_method, data: form_data, cache: false, success:...
I'm not sure I completely understand, but I will try to give you some information. Like David said It may seem that the first request is the last one responding, but that will vary under many circumstances. There are different ways you could do this to control the outcome or order of the requests. 1) Upon success of ...
22,988,271
I am getting error when I try to connect database **Error:com.microsoft.sqlserver.jdbc.SQLServerConnection cannot be cast to Ptakip.Connection** * Ptakip is my Package * Connection is my Class Here is the Connection Class Code ; ``` import java.sql.*; public class Connection { private Connection cn; public ...
2014/04/10
[ "https://Stackoverflow.com/questions/22988271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3498019/" ]
I'm not sure I completely understand, but I will try to give you some information. Like David said It may seem that the first request is the last one responding, but that will vary under many circumstances. There are different ways you could do this to control the outcome or order of the requests. 1) Upon success of ...
Or use `server_response` in your code. The script begin with condition: ``` if (recherche1.length>1) { $.ajax({ // First Request type :"GET", url : "result.php", data: data, cache: false, success: function(server_response){ $('.price1').html(server_resp...
22,988,271
I am getting error when I try to connect database **Error:com.microsoft.sqlserver.jdbc.SQLServerConnection cannot be cast to Ptakip.Connection** * Ptakip is my Package * Connection is my Class Here is the Connection Class Code ; ``` import java.sql.*; public class Connection { private Connection cn; public ...
2014/04/10
[ "https://Stackoverflow.com/questions/22988271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3498019/" ]
Gaurav, you have an error, at the end of the 1st $.ajax it must end as `),` and 2nd as `)`. You can't end with `;` ```js var result1; var result2; $.when( $.ajax({ // First Request url: form_url, type: form_method, data: form_data, cache: false, success:...
``` var result1; var result2; $.when( $.ajax({ // First Request url: form_url, type: form_method, data: form_data, cache: false, success: function(returnhtml){ result1 = returnhtml; } }); $.ajax({...
22,988,271
I am getting error when I try to connect database **Error:com.microsoft.sqlserver.jdbc.SQLServerConnection cannot be cast to Ptakip.Connection** * Ptakip is my Package * Connection is my Class Here is the Connection Class Code ; ``` import java.sql.*; public class Connection { private Connection cn; public ...
2014/04/10
[ "https://Stackoverflow.com/questions/22988271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3498019/" ]
Or use `server_response` in your code. The script begin with condition: ``` if (recherche1.length>1) { $.ajax({ // First Request type :"GET", url : "result.php", data: data, cache: false, success: function(server_response){ $('.price1').html(server_resp...
``` var result1; var result2; $.when( $.ajax({ // First Request url: form_url, type: form_method, data: form_data, cache: false, success: function(returnhtml){ result1 = returnhtml; } }); $.ajax({...
22,988,271
I am getting error when I try to connect database **Error:com.microsoft.sqlserver.jdbc.SQLServerConnection cannot be cast to Ptakip.Connection** * Ptakip is my Package * Connection is my Class Here is the Connection Class Code ; ``` import java.sql.*; public class Connection { private Connection cn; public ...
2014/04/10
[ "https://Stackoverflow.com/questions/22988271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3498019/" ]
Gaurav, you have an error, at the end of the 1st $.ajax it must end as `),` and 2nd as `)`. You can't end with `;` ```js var result1; var result2; $.when( $.ajax({ // First Request url: form_url, type: form_method, data: form_data, cache: false, success:...
Or use `server_response` in your code. The script begin with condition: ``` if (recherche1.length>1) { $.ajax({ // First Request type :"GET", url : "result.php", data: data, cache: false, success: function(server_response){ $('.price1').html(server_resp...
30,766,766
GitHub repo: <https://github.com/Yorkshireman/mywordlist> I've googled the hell out of this one. I'm sure there's a way, possibly requiring some code inside a html options hash, but I can't work it out. Any ideas? When visiting the \_edit\_word\_form.html.erb partial for a Word that DOES have one or more categories, ...
2015/06/10
[ "https://Stackoverflow.com/questions/30766766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4111480/" ]
The discussion might not be active anymore but I'll share my answer for the future visitors. Adding "{ checked: @array.map(&:to\_param) }" option as the last argument of collection\_check\_boxes may resolve your problem. Refer this [link](https://github.com/bootstrap-ruby/rails-bootstrap-forms/issues/151). Example: ...
This should be closer to what you were looking for: ``` <%= b.label(class: "checkbox-inline", :"data-value" => b.value) { b.check_box + b.text } %> ```
30,766,766
GitHub repo: <https://github.com/Yorkshireman/mywordlist> I've googled the hell out of this one. I'm sure there's a way, possibly requiring some code inside a html options hash, but I can't work it out. Any ideas? When visiting the \_edit\_word\_form.html.erb partial for a Word that DOES have one or more categories, ...
2015/06/10
[ "https://Stackoverflow.com/questions/30766766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4111480/" ]
The discussion might not be active anymore but I'll share my answer for the future visitors. Adding "{ checked: @array.map(&:to\_param) }" option as the last argument of collection\_check\_boxes may resolve your problem. Refer this [link](https://github.com/bootstrap-ruby/rails-bootstrap-forms/issues/151). Example: ...
Try changing your `_edit_word_form.html.erb` like this ``` <%= form_for(@word) do |f| %> <div class="field form-group"> <%= f.label(:title, "Word:") %><br> <%= f.text_field(:title, id: "new_word", required: true, autofocus: true, class: "form-control") %> </div> <div class="field form-group">...
30,766,766
GitHub repo: <https://github.com/Yorkshireman/mywordlist> I've googled the hell out of this one. I'm sure there's a way, possibly requiring some code inside a html options hash, but I can't work it out. Any ideas? When visiting the \_edit\_word\_form.html.erb partial for a Word that DOES have one or more categories, ...
2015/06/10
[ "https://Stackoverflow.com/questions/30766766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4111480/" ]
The discussion might not be active anymore but I'll share my answer for the future visitors. Adding "{ checked: @array.map(&:to\_param) }" option as the last argument of collection\_check\_boxes may resolve your problem. Refer this [link](https://github.com/bootstrap-ruby/rails-bootstrap-forms/issues/151). Example: ...
So user is editing a word from their word list, but you want to show checkboxes for all categories for all the words in their word list, checking those categories attached to the word being editing. Is that correct? It looks like you're missing out the first parameter in #collection\_check\_boxes, which should be the ...
30,766,766
GitHub repo: <https://github.com/Yorkshireman/mywordlist> I've googled the hell out of this one. I'm sure there's a way, possibly requiring some code inside a html options hash, but I can't work it out. Any ideas? When visiting the \_edit\_word\_form.html.erb partial for a Word that DOES have one or more categories, ...
2015/06/10
[ "https://Stackoverflow.com/questions/30766766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4111480/" ]
The discussion might not be active anymore but I'll share my answer for the future visitors. Adding "{ checked: @array.map(&:to\_param) }" option as the last argument of collection\_check\_boxes may resolve your problem. Refer this [link](https://github.com/bootstrap-ruby/rails-bootstrap-forms/issues/151). Example: ...
### What's wrong When you are calling `category_form.collection_check_boxes(:category_ids, current_user.word_list.categories.all, :id, :title)` within the `fields_for :category`, you are saying there is a method on `@word.category` called `category_ids` which will return the ids of the categories related to `@word.cat...
33,551,559
I want to ignore the punctuation.So, I'm trying to make a program that counts all the appearences of every word in my text but without taking in consideration the punctuation marks. So my program is: ``` static void Main(string[] args) { string text = "This my world. World, world,THIS WORLD ! Is this - th...
2015/11/05
[ "https://Stackoverflow.com/questions/33551559", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` string[] words = text.Split(new char[]{' ',',','-','!','.'}, StringSplitOPtions.RemoveEmptyItems); ```
It is simple - first step is to remove undesired punctuation with function `Replace` and then continue with splitting as you have it.
33,551,559
I want to ignore the punctuation.So, I'm trying to make a program that counts all the appearences of every word in my text but without taking in consideration the punctuation marks. So my program is: ``` static void Main(string[] args) { string text = "This my world. World, world,THIS WORLD ! Is this - th...
2015/11/05
[ "https://Stackoverflow.com/questions/33551559", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You should try specifying `StringSplitOptions.RemoveEmptyEntries`: ``` string[] words = text.Split(" ,-!.".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); ``` Note that instead of manually creating a `char[]` with all the punctuation characters, you may create a `string` and call `ToCharArray()` to get the ar...
It is simple - first step is to remove undesired punctuation with function `Replace` and then continue with splitting as you have it.
33,551,559
I want to ignore the punctuation.So, I'm trying to make a program that counts all the appearences of every word in my text but without taking in consideration the punctuation marks. So my program is: ``` static void Main(string[] args) { string text = "This my world. World, world,THIS WORLD ! Is this - th...
2015/11/05
[ "https://Stackoverflow.com/questions/33551559", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You should try specifying `StringSplitOptions.RemoveEmptyEntries`: ``` string[] words = text.Split(" ,-!.".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); ``` Note that instead of manually creating a `char[]` with all the punctuation characters, you may create a `string` and call `ToCharArray()` to get the ar...
``` string[] words = text.Split(new char[]{' ',',','-','!','.'}, StringSplitOPtions.RemoveEmptyItems); ```