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
13,707
Using Twig, is it possible to strip out or replace a non-breaking space (` `)? I've got a string variable `price` (returned from the [`currency`](https://craftcms.com/docs/templating/filters#currency) filter) that prints like this: ``` Nkr 100,00 ``` What I'd like, is to strip the `Nkr ` part, so the...
2016/02/16
[ "https://craftcms.stackexchange.com/questions/13707", "https://craftcms.stackexchange.com", "https://craftcms.stackexchange.com/users/1098/" ]
Here's a different spin... Try removing everything that's **not numeric or comma**. ``` {{ price|replace('/[^0-9,]/', '') }} ```
To add space between two words use below code: ``` {{ price|replace({" ": " "})|raw |nl2br }} ``` This will work.
13,707
Using Twig, is it possible to strip out or replace a non-breaking space (` `)? I've got a string variable `price` (returned from the [`currency`](https://craftcms.com/docs/templating/filters#currency) filter) that prints like this: ``` Nkr 100,00 ``` What I'd like, is to strip the `Nkr ` part, so the...
2016/02/16
[ "https://craftcms.stackexchange.com/questions/13707", "https://craftcms.stackexchange.com", "https://craftcms.stackexchange.com/users/1098/" ]
You just think it is ` ` that get's returned from the filter, because that's how your developer tools display it, but in fact it is a *UTF-8 encoded* non-breaking space character. Have a look at the source code that is output and you won't see the ` `. The filter gets the formatting pattern from the [app/fra...
If you need to trim a non-breaking space which is the UTF-8 encoded non-breaking space character: ``` {{ value|trim(" \t\n\r\0\x0B\xC2\xA0") }} ``` This works because internally Twig uses the PHP `trim`, `ltrim`, and `rtrim functions`.
13,707
Using Twig, is it possible to strip out or replace a non-breaking space (` `)? I've got a string variable `price` (returned from the [`currency`](https://craftcms.com/docs/templating/filters#currency) filter) that prints like this: ``` Nkr 100,00 ``` What I'd like, is to strip the `Nkr ` part, so the...
2016/02/16
[ "https://craftcms.stackexchange.com/questions/13707", "https://craftcms.stackexchange.com", "https://craftcms.stackexchange.com/users/1098/" ]
You just think it is ` ` that get's returned from the filter, because that's how your developer tools display it, but in fact it is a *UTF-8 encoded* non-breaking space character. Have a look at the source code that is output and you won't see the ` `. The filter gets the formatting pattern from the [app/fra...
To add space between two words use below code: ``` {{ price|replace({" ": " "})|raw |nl2br }} ``` This will work.
13,707
Using Twig, is it possible to strip out or replace a non-breaking space (` `)? I've got a string variable `price` (returned from the [`currency`](https://craftcms.com/docs/templating/filters#currency) filter) that prints like this: ``` Nkr 100,00 ``` What I'd like, is to strip the `Nkr ` part, so the...
2016/02/16
[ "https://craftcms.stackexchange.com/questions/13707", "https://craftcms.stackexchange.com", "https://craftcms.stackexchange.com/users/1098/" ]
To add space between two words use below code: ``` {{ price|replace({" ": " "})|raw |nl2br }} ``` This will work.
If you need to trim a non-breaking space which is the UTF-8 encoded non-breaking space character: ``` {{ value|trim(" \t\n\r\0\x0B\xC2\xA0") }} ``` This works because internally Twig uses the PHP `trim`, `ltrim`, and `rtrim functions`.
72,469,393
I am trying to make the weather app in Vite , but when I run the program I get the error "TypeError: Cannot read properties of undefined (reading 'main')". Below is part of the code: ``` <div id="app" :class="{warm: weather.main && weather.main.temp > 17}"> <main> <div class="search-box"> <input ty...
2022/06/02
[ "https://Stackoverflow.com/questions/72469393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18137571/" ]
I think the problem is this line: ``` <div id="app" :class="{warm: weather.main && weather.main.temp > 17}"> ``` If you want to use js within the `class=""`, You just have to prepend it by `:`, and not wrap it in `{}`. Try changing that to: ``` <div id="app" :class="weather.main && weather.main.temp > 17 ? 'warm' ...
``` <div id="app" :class="weather?.main?.temp > 17 ? 'warm' : ''"> <main> <div class="search-box"> <input type="text" class="search-bar" placeholder="Search..." v-model="query" @keypress="fetchWeather" /> </div> <div class="weather-wrap" v-if="weather.main != 'undefined'"> <div c...
2,825,110
So I've got a Users controller, and it has (amongst others) a function called details. The idea is that a user can go to localhost:3000/user/:user\_id/details and be able to view the details of :user\_id. For example, I have a user called "tester". When I go to the uri: `http://localhost:3000/users/tester/details` I'...
2010/05/13
[ "https://Stackoverflow.com/questions/2825110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/336025/" ]
Are you using resources? If your routes look like: ``` map.resources :users ``` You could make it: ``` map.resources :users, :member => { :details => :get } ``` That would allow GET requests for the URL /users/:id/details More info here: <http://guides.rubyonrails.com/routing.html#customizing-resources>
In order to get routes like "users/:user\_id/details" change following in routes.rb ``` map.users 'users/:user_id/details', :controller => 'users', :action=>'details' ```
2,825,110
So I've got a Users controller, and it has (amongst others) a function called details. The idea is that a user can go to localhost:3000/user/:user\_id/details and be able to view the details of :user\_id. For example, I have a user called "tester". When I go to the uri: `http://localhost:3000/users/tester/details` I'...
2010/05/13
[ "https://Stackoverflow.com/questions/2825110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/336025/" ]
Are you using resources? If your routes look like: ``` map.resources :users ``` You could make it: ``` map.resources :users, :member => { :details => :get } ``` That would allow GET requests for the URL /users/:id/details More info here: <http://guides.rubyonrails.com/routing.html#customizing-resources>
I think that your problem is with setting routes in such way, that instead of `:user_id` you have `:login` (or whatever) in url `/users/tester` instead of `/users/34`. Probably you should take a look at `to_param` ([1st example](https://stackoverflow.com/questions/2269885/username-in-url-with-rails-routes), [2nd exampl...
2,825,110
So I've got a Users controller, and it has (amongst others) a function called details. The idea is that a user can go to localhost:3000/user/:user\_id/details and be able to view the details of :user\_id. For example, I have a user called "tester". When I go to the uri: `http://localhost:3000/users/tester/details` I'...
2010/05/13
[ "https://Stackoverflow.com/questions/2825110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/336025/" ]
I think that your problem is with setting routes in such way, that instead of `:user_id` you have `:login` (or whatever) in url `/users/tester` instead of `/users/34`. Probably you should take a look at `to_param` ([1st example](https://stackoverflow.com/questions/2269885/username-in-url-with-rails-routes), [2nd exampl...
In order to get routes like "users/:user\_id/details" change following in routes.rb ``` map.users 'users/:user_id/details', :controller => 'users', :action=>'details' ```
37,978,619
I have 2 tables `battles` & `battle_user` structure: `battles` table: ``` id create_date 1 2015/... ``` `battle_user` table: ``` id battle_id user_id 1 1 1 2 1 2 ``` Only 2 users accepted in each battle, the question is: Is there a way using `primary/fore...
2016/06/22
[ "https://Stackoverflow.com/questions/37978619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407412/" ]
As I said in the comments, I reluctantly will show how a unique key can be used in a de-normalized fashion, and the OP wanted to see it. The concept is that you know the users, so have them wedged in the battles table. How you then proceed on to a `battle_users` table is up to you and I would recommend no change there...
The condition is not simple, at the moment the only way to create a complex check before insert a row in MySQL table is a trigger. I created a trigger that checks if there is another record with these users, but there is a problem (maybe): you will need to delete the not created battle id. ``` delimiter $$ drop trigg...
45,983,124
I know this question has been asked before on SO, and I understood the explanation given in some of them and the solution. In fact the solutions I found was what I was doing prior to searching SO. But I am still getting an error. I have a dictionary that I set up like so: ``` var dictBarData = [String: Any]() ``` a...
2017/08/31
[ "https://Stackoverflow.com/questions/45983124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/468455/" ]
You can retrieve URL parameter(s) using multiple services such: * request\_stack * path.current * current\_route\_match Here I show you how to get your `value2` from the `param2` using the `request_stack`: ``` // Initialize the service. $requestStack = \Drupal::service('request_stack'); // Get your Master Request. ...
``` $value = \Drupal::request()->query->get('param2'); ``` Should do the trick.
37,749,771
I'm writing a code and I am selecting a dropdown and when I click the button I want to print the value in console, but it is printing `null`. Below is my code. ``` <form name="formSec" id="formSec"> <div class="bodytag1"> <table> <tr> <td colspan="2" align="cent...
2016/06/10
[ "https://Stackoverflow.com/questions/37749771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1514543/" ]
Move the references to the elements inside the document ready ``` $(document).ready(function() { var form = $('#formSec'); var task = $('#task'); var subtask = $('#subtask'); $('#Start').on("click", function() { console.log(task); }); }); ``` Now when you click on the button, it will have...
You should get the selected option first, and then you can get the value of that option. You can use this code, for example: ``` var selectedOption = task.find("option:selected"); console.log(selectedOption.text()); ```
37,749,771
I'm writing a code and I am selecting a dropdown and when I click the button I want to print the value in console, but it is printing `null`. Below is my code. ``` <form name="formSec" id="formSec"> <div class="bodytag1"> <table> <tr> <td colspan="2" align="cent...
2016/06/10
[ "https://Stackoverflow.com/questions/37749771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1514543/" ]
Move the references to the elements inside the document ready ``` $(document).ready(function() { var form = $('#formSec'); var task = $('#task'); var subtask = $('#subtask'); $('#Start').on("click", function() { console.log(task); }); }); ``` Now when you click on the button, it will have...
Use `console.log(task.val())` instead of `console.log(task)` ```js function dynamicdropdown(listindex) { document.getElementById("subtask").length = 0; switch (listindex) { case "break": document.getElementById("subtask").options[0] = new Option( "Please select Break type"); document....
9,038,337
How do a I turn off AppCode generating a closing brace `}` whenever I type the opening brace `{` character? ### What I've Tried: I looked through: Settings --> Code Style --> Objective-C and then selected "Wrapping and Braces" and in that list, nothing jumps out as disabling the automatic right brace. With such a s...
2012/01/27
[ "https://Stackoverflow.com/questions/9038337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/535054/" ]
Turn off `"AppCode" -> "Preferences" -> "Editor" -> "Smart Keys" -> "Insert Pair Bracket"` and `"Insert Pair '}'"`
Choose Xcode > Preferences, click Text Editing, and deselect `Automatically insert closing ‘}’`.
158,761
so I have two sprites, a box and an X animation (I'm making Tic-Tac-Toe). So, in the code, when I click on the box, it instantiates the X animation at the right place. The X animation does not have a background, but the box does. However, when it instantiates, it puts it *behind* the box. This doesn't make sense to m...
2018/05/17
[ "https://gamedev.stackexchange.com/questions/158761", "https://gamedev.stackexchange.com", "https://gamedev.stackexchange.com/users/112380/" ]
Though I'm not sure why, I tried messing around, and putting the Z-radius of the X Animation *behind* the box, it actually showed up in front of it (with the Z-radius of the X animation being -2 and the box being 0).
From your edit, it looks like you’ve selected the X animation GameObject. I see that it’s on the Default sorting layer. See SpriteRenderer component’s layer. If you have multiple layers, put the X animation on the a foreground layer. You can create new layers if you don’t have any. If you are not able to create/use a ...
64,689,797
I have read multiple answers given to my problem but none made any change. My problem is that when I press the "Reset" button it resets it doesn't show me all the info it should. For some reason, it can't find the id of the line I want to change. So in short: It gives errors after I press the "Reset button". ```html ...
2020/11/05
[ "https://Stackoverflow.com/questions/64689797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11632275/" ]
On `Reset()` function, you have set html data to `TotalPlayers` and `Spelers` selectors using `innerHTML`. So the inner span tags, `TotalMembers`, and `RandomNames` selectors are removed. To reset the data, it is needed to make `TotalMembers` and `RandomNames` selectors empty as follows. ```js var Names = []; var Tea...
When you initially set up the DOM, you have Players: . Notice that Element with ID=RandomNames is a child of the element with ID="Spelers". When you execute either the reset() or the randomize(), this line document.getElementById("Spelers").innerHTML = "Teams are: "; <--- will remove the child element with ID="Random...
64,689,797
I have read multiple answers given to my problem but none made any change. My problem is that when I press the "Reset" button it resets it doesn't show me all the info it should. For some reason, it can't find the id of the line I want to change. So in short: It gives errors after I press the "Reset button". ```html ...
2020/11/05
[ "https://Stackoverflow.com/questions/64689797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11632275/" ]
When resetting the values through `Reset()` function, you have removed the inner elements like `RandomNames` and `TotalMembers`. As a workaround, you can add those two elements again when resetting. ```js var Names = []; var Team1 = []; var Team2 = []; function SetName(NameClicked) { ...
When you initially set up the DOM, you have Players: . Notice that Element with ID=RandomNames is a child of the element with ID="Spelers". When you execute either the reset() or the randomize(), this line document.getElementById("Spelers").innerHTML = "Teams are: "; <--- will remove the child element with ID="Random...
63,738,830
I'm using the [Python standard library modules](https://docs.python.org/3/py-modindex.html) and the `pythoncom` and `win32com.client` modules from the `PyWin32` package to interact with Microsoft Excel. I get a list of the running Excel instances as COM object references and then when I want to close the Excel instanc...
2020/09/04
[ "https://Stackoverflow.com/questions/63738830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7393973/" ]
You shouldn't be using your Demo/Developer account for production data - envelope will be sent with the red "demonstration" watermark. When you have a paid production account, I would recommend setting up your webhooks to run on different urls: Something like `example.com/webhook/test` vs `example.com/webhook/producti...
Connect webhook is set on per account, your DEMO and Production accounts are separate entities. When you promote your ikey to production even the value is the same they are completely different. In production you still have to set your Secret Key and RSA Keypairs for the promoted ikey read here <https://www.docusign.co...
31,632,806
I have a table that stretches across the entire page. I'm zebra striping using `nth-child` on the `tr`'s to set the `background` of the row. The problem is that it is only coloring the cells and not the entire row. You can see white space in between each cell of the colored rows. You can see an example [here](http:/...
2015/07/26
[ "https://Stackoverflow.com/questions/31632806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5156529/" ]
add [`border-collapse:collapse`](https://developer.mozilla.org/en-US/docs/Web/CSS/border-collapse) to `table` > > The border-collapse CSS property determines whether a table's borders > are separated or collapsed. In the separated model, adjacent cells > each have their own distinct borders. In the collapsed model,...
Add this to your HTML: ``` <table cellspacing="0"> ``` Or via CSS ``` table {border-spacing: 0;} ```
31,632,806
I have a table that stretches across the entire page. I'm zebra striping using `nth-child` on the `tr`'s to set the `background` of the row. The problem is that it is only coloring the cells and not the entire row. You can see white space in between each cell of the colored rows. You can see an example [here](http:/...
2015/07/26
[ "https://Stackoverflow.com/questions/31632806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5156529/" ]
The CSS solution to this uses the `border-spacing` and `border-collapse` properties. Here's your `table` rule, updated: ``` table { width: 100%; border-spacing: 0; border-collapse: collapse; } ``` It used to be that margin and padding in tables were primarily controlled in the HTML with the `cellspacing...
Add this to your HTML: ``` <table cellspacing="0"> ``` Or via CSS ``` table {border-spacing: 0;} ```
31,632,806
I have a table that stretches across the entire page. I'm zebra striping using `nth-child` on the `tr`'s to set the `background` of the row. The problem is that it is only coloring the cells and not the entire row. You can see white space in between each cell of the colored rows. You can see an example [here](http:/...
2015/07/26
[ "https://Stackoverflow.com/questions/31632806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5156529/" ]
add [`border-collapse:collapse`](https://developer.mozilla.org/en-US/docs/Web/CSS/border-collapse) to `table` > > The border-collapse CSS property determines whether a table's borders > are separated or collapsed. In the separated model, adjacent cells > each have their own distinct borders. In the collapsed model,...
The CSS solution to this uses the `border-spacing` and `border-collapse` properties. Here's your `table` rule, updated: ``` table { width: 100%; border-spacing: 0; border-collapse: collapse; } ``` It used to be that margin and padding in tables were primarily controlled in the HTML with the `cellspacing...
31,632,806
I have a table that stretches across the entire page. I'm zebra striping using `nth-child` on the `tr`'s to set the `background` of the row. The problem is that it is only coloring the cells and not the entire row. You can see white space in between each cell of the colored rows. You can see an example [here](http:/...
2015/07/26
[ "https://Stackoverflow.com/questions/31632806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5156529/" ]
add [`border-collapse:collapse`](https://developer.mozilla.org/en-US/docs/Web/CSS/border-collapse) to `table` > > The border-collapse CSS property determines whether a table's borders > are separated or collapsed. In the separated model, adjacent cells > each have their own distinct borders. In the collapsed model,...
By default there is some spacing between the borders, to remove the spacing use ``` table { border-collapse: collapse; } ``` or ``` table { border-spacing: 0; } ``` the `border-collapse: collapse` will merge the borders of cells in to one border while `border-spacing: 0` will decrease the space between ...
31,632,806
I have a table that stretches across the entire page. I'm zebra striping using `nth-child` on the `tr`'s to set the `background` of the row. The problem is that it is only coloring the cells and not the entire row. You can see white space in between each cell of the colored rows. You can see an example [here](http:/...
2015/07/26
[ "https://Stackoverflow.com/questions/31632806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5156529/" ]
The CSS solution to this uses the `border-spacing` and `border-collapse` properties. Here's your `table` rule, updated: ``` table { width: 100%; border-spacing: 0; border-collapse: collapse; } ``` It used to be that margin and padding in tables were primarily controlled in the HTML with the `cellspacing...
By default there is some spacing between the borders, to remove the spacing use ``` table { border-collapse: collapse; } ``` or ``` table { border-spacing: 0; } ``` the `border-collapse: collapse` will merge the borders of cells in to one border while `border-spacing: 0` will decrease the space between ...
12,526,054
I have `UITabBarController` app which plays video and shows other information in other `UITabBar` tabs. In iOS 6 `UIView` rotation methods have been deprecated, and now I need to use `shouldAutoRotate` and `supportedInterfaceOrientations` methods. For video playing I use `MPMoviePlayerViewController`. How to rotate o...
2012/09/21
[ "https://Stackoverflow.com/questions/12526054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/902424/" ]
I had the same problem with my app. How the rotation in iOS 6 work is that. => when ever you are using UINavigationCOntroller the method in AppDelegate ``` - (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return } ``` decides whether to ro...
Try this, If TabBarController is RootViewController for window, Then Create Custom Class which inherits TabBarController say CustomTabBarController.h Add Below method in CustomTabBarController.h ``` -(NSUInteger)supportedInterfaceOrientations // Must return Orientation Mask ``` Finally Call Below in AppDelegate.m ...
12,526,054
I have `UITabBarController` app which plays video and shows other information in other `UITabBar` tabs. In iOS 6 `UIView` rotation methods have been deprecated, and now I need to use `shouldAutoRotate` and `supportedInterfaceOrientations` methods. For video playing I use `MPMoviePlayerViewController`. How to rotate o...
2012/09/21
[ "https://Stackoverflow.com/questions/12526054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/902424/" ]
From Apple's iOS 6 SDK Release Notes: > > Autorotation is changing in iOS 6. In iOS 6, the shouldAutorotateToInterfaceOrientation: method of UIViewController is deprecated. In its place, you should use the supportedInterfaceOrientationsForWindow: and shouldAutorotate methods. > > > More responsibility is moving to ...
Ough! A half of a day spent, and the problem solved! He he. As the documentation above says, this is really it! The core points are: > > More **responsibility is moving to the app and the app delegate**. > Now, iOS containers (such as UINavigationController) do not consult > their children to determine whether the...
12,526,054
I have `UITabBarController` app which plays video and shows other information in other `UITabBar` tabs. In iOS 6 `UIView` rotation methods have been deprecated, and now I need to use `shouldAutoRotate` and `supportedInterfaceOrientations` methods. For video playing I use `MPMoviePlayerViewController`. How to rotate o...
2012/09/21
[ "https://Stackoverflow.com/questions/12526054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/902424/" ]
Unfortunately you'll need to turn on all orientations in your plist and use supportedInterfaceOrientations on all the view controllers you don't want to rotate. (In your case everything but the video player.)
Try this, If TabBarController is RootViewController for window, Then Create Custom Class which inherits TabBarController say CustomTabBarController.h Add Below method in CustomTabBarController.h ``` -(NSUInteger)supportedInterfaceOrientations // Must return Orientation Mask ``` Finally Call Below in AppDelegate.m ...
12,526,054
I have `UITabBarController` app which plays video and shows other information in other `UITabBar` tabs. In iOS 6 `UIView` rotation methods have been deprecated, and now I need to use `shouldAutoRotate` and `supportedInterfaceOrientations` methods. For video playing I use `MPMoviePlayerViewController`. How to rotate o...
2012/09/21
[ "https://Stackoverflow.com/questions/12526054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/902424/" ]
You can also subclass UITabBarController to make it ask its children about the shouldAutorotate and supportedInterfaceOrientation like this: ``` @implementation MyTabBarController -(BOOL)shouldAutorotate { return [self.selectedViewController shouldAutorotate]; } -(NSUInteger)supportedInterfaceOrientations { ...
I found the easiest way to set this up is to use the "supported interface orientations" buttons which you can see if you look at Targets....Summary Tab (under iPhone/iPad Deployment info). Its basically a GUI to set the plist file
12,526,054
I have `UITabBarController` app which plays video and shows other information in other `UITabBar` tabs. In iOS 6 `UIView` rotation methods have been deprecated, and now I need to use `shouldAutoRotate` and `supportedInterfaceOrientations` methods. For video playing I use `MPMoviePlayerViewController`. How to rotate o...
2012/09/21
[ "https://Stackoverflow.com/questions/12526054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/902424/" ]
I had the same problem with my app. How the rotation in iOS 6 work is that. => when ever you are using UINavigationCOntroller the method in AppDelegate ``` - (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return } ``` decides whether to ro...
Unfortunately you'll need to turn on all orientations in your plist and use supportedInterfaceOrientations on all the view controllers you don't want to rotate. (In your case everything but the video player.)
12,526,054
I have `UITabBarController` app which plays video and shows other information in other `UITabBar` tabs. In iOS 6 `UIView` rotation methods have been deprecated, and now I need to use `shouldAutoRotate` and `supportedInterfaceOrientations` methods. For video playing I use `MPMoviePlayerViewController`. How to rotate o...
2012/09/21
[ "https://Stackoverflow.com/questions/12526054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/902424/" ]
Ough! A half of a day spent, and the problem solved! He he. As the documentation above says, this is really it! The core points are: > > More **responsibility is moving to the app and the app delegate**. > Now, iOS containers (such as UINavigationController) do not consult > their children to determine whether the...
Unfortunately you'll need to turn on all orientations in your plist and use supportedInterfaceOrientations on all the view controllers you don't want to rotate. (In your case everything but the video player.)
12,526,054
I have `UITabBarController` app which plays video and shows other information in other `UITabBar` tabs. In iOS 6 `UIView` rotation methods have been deprecated, and now I need to use `shouldAutoRotate` and `supportedInterfaceOrientations` methods. For video playing I use `MPMoviePlayerViewController`. How to rotate o...
2012/09/21
[ "https://Stackoverflow.com/questions/12526054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/902424/" ]
I had the same problem with my app. How the rotation in iOS 6 work is that. => when ever you are using UINavigationCOntroller the method in AppDelegate ``` - (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return } ``` decides whether to ro...
I found the easiest way to set this up is to use the "supported interface orientations" buttons which you can see if you look at Targets....Summary Tab (under iPhone/iPad Deployment info). Its basically a GUI to set the plist file
12,526,054
I have `UITabBarController` app which plays video and shows other information in other `UITabBar` tabs. In iOS 6 `UIView` rotation methods have been deprecated, and now I need to use `shouldAutoRotate` and `supportedInterfaceOrientations` methods. For video playing I use `MPMoviePlayerViewController`. How to rotate o...
2012/09/21
[ "https://Stackoverflow.com/questions/12526054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/902424/" ]
Try this, If TabBarController is RootViewController for window, Then Create Custom Class which inherits TabBarController say CustomTabBarController.h Add Below method in CustomTabBarController.h ``` -(NSUInteger)supportedInterfaceOrientations // Must return Orientation Mask ``` Finally Call Below in AppDelegate.m ...
I found the easiest way to set this up is to use the "supported interface orientations" buttons which you can see if you look at Targets....Summary Tab (under iPhone/iPad Deployment info). Its basically a GUI to set the plist file
12,526,054
I have `UITabBarController` app which plays video and shows other information in other `UITabBar` tabs. In iOS 6 `UIView` rotation methods have been deprecated, and now I need to use `shouldAutoRotate` and `supportedInterfaceOrientations` methods. For video playing I use `MPMoviePlayerViewController`. How to rotate o...
2012/09/21
[ "https://Stackoverflow.com/questions/12526054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/902424/" ]
From Apple's iOS 6 SDK Release Notes: > > Autorotation is changing in iOS 6. In iOS 6, the shouldAutorotateToInterfaceOrientation: method of UIViewController is deprecated. In its place, you should use the supportedInterfaceOrientationsForWindow: and shouldAutorotate methods. > > > More responsibility is moving to ...
Try this, If TabBarController is RootViewController for window, Then Create Custom Class which inherits TabBarController say CustomTabBarController.h Add Below method in CustomTabBarController.h ``` -(NSUInteger)supportedInterfaceOrientations // Must return Orientation Mask ``` Finally Call Below in AppDelegate.m ...
12,526,054
I have `UITabBarController` app which plays video and shows other information in other `UITabBar` tabs. In iOS 6 `UIView` rotation methods have been deprecated, and now I need to use `shouldAutoRotate` and `supportedInterfaceOrientations` methods. For video playing I use `MPMoviePlayerViewController`. How to rotate o...
2012/09/21
[ "https://Stackoverflow.com/questions/12526054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/902424/" ]
Ough! A half of a day spent, and the problem solved! He he. As the documentation above says, this is really it! The core points are: > > More **responsibility is moving to the app and the app delegate**. > Now, iOS containers (such as UINavigationController) do not consult > their children to determine whether the...
Try this, If TabBarController is RootViewController for window, Then Create Custom Class which inherits TabBarController say CustomTabBarController.h Add Below method in CustomTabBarController.h ``` -(NSUInteger)supportedInterfaceOrientations // Must return Orientation Mask ``` Finally Call Below in AppDelegate.m ...
70,507,192
I've a problem with ajax success redirect.This is the code. '/sendmsg' is the API url. on success I need the ajax function to redirect to a page say "sample.html" ``` const token = 'token'; const chatId = 'id'; $(document).ready(function () { $("#add_button").on('click', function (event) { execute(); ...
2021/12/28
[ "https://Stackoverflow.com/questions/70507192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17780935/" ]
With below changes, now I am able to return the user to the post after login. Login URL at each post remained same as below with `redirect_to`: ``` http://www......com/login/?redirect_to=http://www......com/post-name ``` In my custom login page template `login` I am capturing the `redirect_to` value as a variable: ...
Since you are trying to redirect the user, to your desired custom URL after login. Then you should insert your custom URL here:- ``` if ( isset( $user->roles ) && is_array( $user->roles ) ) { //check for admins if ( in_array( 'administrator', $user->roles ) ) { // redirect t...
70,507,192
I've a problem with ajax success redirect.This is the code. '/sendmsg' is the API url. on success I need the ajax function to redirect to a page say "sample.html" ``` const token = 'token'; const chatId = 'id'; $(document).ready(function () { $("#add_button").on('click', function (event) { execute(); ...
2021/12/28
[ "https://Stackoverflow.com/questions/70507192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17780935/" ]
`!$redirect_to_post === ""` will always return false ! can you try with this code? ``` function redirect_to_posts_after_login($redirect_to, $requested_redirect_to) { $redirect_to_post = $_GET['redirect_to']; if ($redirect_to_post !== "") { return $redirect_to_post; } else { return $request...
Since you are trying to redirect the user, to your desired custom URL after login. Then you should insert your custom URL here:- ``` if ( isset( $user->roles ) && is_array( $user->roles ) ) { //check for admins if ( in_array( 'administrator', $user->roles ) ) { // redirect t...
53,718,725
I have a Lighsail LAMP stack. I’ve uploaded my PHP file which is a simple contact us page. I’ve created a database in phpmyadmin. I’d like to know: What will be the database username? What will be the database password? Looking forward for your support.
2018/12/11
[ "https://Stackoverflow.com/questions/53718725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9883913/" ]
Try to add async to beforeEach: ``` beforeEach(async(() => { // <-- use async TestBed.configureTestingModule({ declarations: [AppComponent], }); fixture = TestBed.createComponent(AppComponent); component = fixture.componentInstance; fixture.detectChanges(); })); ```
You can try following things. ``` it('TEST', async(() => { fixture.whenStable().then(() => { fixture.detectChanges(); // you can write this const nextBtn = fixture.debugElement.nativeElement.querySelector('#create-btn'); expect(nextBtn.getAttribute('ng-reflect-disabled')).toBe('true'); ...
53,718,725
I have a Lighsail LAMP stack. I’ve uploaded my PHP file which is a simple contact us page. I’ve created a database in phpmyadmin. I’d like to know: What will be the database username? What will be the database password? Looking forward for your support.
2018/12/11
[ "https://Stackoverflow.com/questions/53718725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9883913/" ]
for angular 11 you can wrap beforeEach's callback into [waitForAsync](https://angular.io/api/core/testing/waitForAsync) if you want to test somesing like `async ngOnInit` ``` beforeEach( waitForAsync(() => { fixture = TestBed.createComponent(SomeFeatureComponent); component = fixture.componentInstance...
You can try following things. ``` it('TEST', async(() => { fixture.whenStable().then(() => { fixture.detectChanges(); // you can write this const nextBtn = fixture.debugElement.nativeElement.querySelector('#create-btn'); expect(nextBtn.getAttribute('ng-reflect-disabled')).toBe('true'); ...
53,718,725
I have a Lighsail LAMP stack. I’ve uploaded my PHP file which is a simple contact us page. I’ve created a database in phpmyadmin. I’d like to know: What will be the database username? What will be the database password? Looking forward for your support.
2018/12/11
[ "https://Stackoverflow.com/questions/53718725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9883913/" ]
Try to add async to beforeEach: ``` beforeEach(async(() => { // <-- use async TestBed.configureTestingModule({ declarations: [AppComponent], }); fixture = TestBed.createComponent(AppComponent); component = fixture.componentInstance; fixture.detectChanges(); })); ```
for angular 11 you can wrap beforeEach's callback into [waitForAsync](https://angular.io/api/core/testing/waitForAsync) if you want to test somesing like `async ngOnInit` ``` beforeEach( waitForAsync(() => { fixture = TestBed.createComponent(SomeFeatureComponent); component = fixture.componentInstance...
2,020,839
> > Show that $f$ is in $\mathscr R[0,1]$ (Riemann integrable) and find$\int\_{0}^{2} f$ > > > $f(x)=$ \begin{cases} 1 & 0 \leq x<1 \\ 3 & x=1 \\ -1 & 1<x \leq2 \end{cases} Here I let $P\_n = \{0,1- \frac{1}{n}, 1+ \frac{1}{n}, 2\}$ (the Partition in [0,2].) Im haveing trouble fiding $U(P,f)$ and $L(P,f)$. ...
2016/11/19
[ "https://math.stackexchange.com/questions/2020839", "https://math.stackexchange.com", "https://math.stackexchange.com/users/366048/" ]
A function $f$ is Riemann-Integrable $\iff$ the set of points of discontinuity of $f$ has measure zero. Points of discontinuity of $f=\{1\}$ which being finite has measure zero. **Alter:** Consider the partition $P=\{0< \frac{1}{n}< \frac{2}{n}\dots<\frac{n-2}{n}<\frac{n-1}{n}< 1+\frac{1}{n},< 1+\frac{2}{n}\dots <2...
Recall the definition of a lower and upper sum: $$ L(P,f) = \sum\_{i=0}^{n-1} (x\_{i+1}-x\_i) \displaystyle\inf\_{[x\_{i},x\_{i+1}]} f(x) $$ $$ U(P,f) = \sum\_{i=0}^{n-1} (x\_{i+1}-x\_i) \displaystyle\sup\_{[x\_{i},x\_{i+1}]} f(x) $$ So that $\Delta x\_i$ probably means $x\_{i+1}-x\_{i}$. Your partition is $\{0,1- \fr...
13,119,102
If I try to delete a char I get an access violation error. Heres my code: ``` int main() { char *myString = new char[32]; myString = "Hello"; cout << myString; cin.get(); delete [] myString; return 0; } ``` Ive also tried ``` delete myString ``` but im still get access violation errors
2012/10/29
[ "https://Stackoverflow.com/questions/13119102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1352609/" ]
After the line ``` myString = "Hello"; ``` the pointer `myString` no longer points to the array you've allocated, but to a string literal. The line ``` delete [] myString; ``` then attempts to delete the literal (which results in a crash). You can copy a string with `strcpy`, or better yet, use `std::string`. ...
You trying to delete memeory where "Hello" is allocated. You need to use strcpy to copy content instead of pointers.
13,119,102
If I try to delete a char I get an access violation error. Heres my code: ``` int main() { char *myString = new char[32]; myString = "Hello"; cout << myString; cin.get(); delete [] myString; return 0; } ``` Ive also tried ``` delete myString ``` but im still get access violation errors
2012/10/29
[ "https://Stackoverflow.com/questions/13119102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1352609/" ]
After the line ``` myString = "Hello"; ``` the pointer `myString` no longer points to the array you've allocated, but to a string literal. The line ``` delete [] myString; ``` then attempts to delete the literal (which results in a crash). You can copy a string with `strcpy`, or better yet, use `std::string`. ...
``` char *myString = new char[32]; myString = "Hello"; ``` This re-assigns the `myString` variable to something else (specifically, to the constant "Hello" string). Don't do that. If you really need a char pointer, use ``` strcpy(myString, "Hello"); ``` or even better ``` char *myString = strdup("Hello"); ``` a...
13,119,102
If I try to delete a char I get an access violation error. Heres my code: ``` int main() { char *myString = new char[32]; myString = "Hello"; cout << myString; cin.get(); delete [] myString; return 0; } ``` Ive also tried ``` delete myString ``` but im still get access violation errors
2012/10/29
[ "https://Stackoverflow.com/questions/13119102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1352609/" ]
After the line ``` myString = "Hello"; ``` the pointer `myString` no longer points to the array you've allocated, but to a string literal. The line ``` delete [] myString; ``` then attempts to delete the literal (which results in a crash). You can copy a string with `strcpy`, or better yet, use `std::string`. ...
You get the access violation because of the following line, your pointer no longer looks at the dynamic memory you allocated and is pointing to a literal "hello" instead which you can't delete.... ``` myString = "Hello"; ``` That Line also isn't going to do what you want, you need to use (Note that you don't need to...
13,119,102
If I try to delete a char I get an access violation error. Heres my code: ``` int main() { char *myString = new char[32]; myString = "Hello"; cout << myString; cin.get(); delete [] myString; return 0; } ``` Ive also tried ``` delete myString ``` but im still get access violation errors
2012/10/29
[ "https://Stackoverflow.com/questions/13119102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1352609/" ]
``` char *myString = new char[32]; myString = "Hello"; ``` This re-assigns the `myString` variable to something else (specifically, to the constant "Hello" string). Don't do that. If you really need a char pointer, use ``` strcpy(myString, "Hello"); ``` or even better ``` char *myString = strdup("Hello"); ``` a...
You trying to delete memeory where "Hello" is allocated. You need to use strcpy to copy content instead of pointers.
13,119,102
If I try to delete a char I get an access violation error. Heres my code: ``` int main() { char *myString = new char[32]; myString = "Hello"; cout << myString; cin.get(); delete [] myString; return 0; } ``` Ive also tried ``` delete myString ``` but im still get access violation errors
2012/10/29
[ "https://Stackoverflow.com/questions/13119102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1352609/" ]
``` char *myString = new char[32]; myString = "Hello"; ``` This re-assigns the `myString` variable to something else (specifically, to the constant "Hello" string). Don't do that. If you really need a char pointer, use ``` strcpy(myString, "Hello"); ``` or even better ``` char *myString = strdup("Hello"); ``` a...
You get the access violation because of the following line, your pointer no longer looks at the dynamic memory you allocated and is pointing to a literal "hello" instead which you can't delete.... ``` myString = "Hello"; ``` That Line also isn't going to do what you want, you need to use (Note that you don't need to...
39,619,111
In my Edit view I have a textbox that accepts `Date`'s. Using MVC, when I go to the Edit View, the fields are already filled in with that record's information which is fine. But, I want to set an event listener on one of the fields, specifically the field that accepts dates as stated above. When i go to the page, I ...
2016/09/21
[ "https://Stackoverflow.com/questions/39619111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5525311/" ]
**Problem** : Is after you apply the plugin the user has to just change the date via the calendar displayed on the UI, And **the plugin will programatically change the date, This will not trigger your change event**. **Solution** : **use the plugin built in event handler to catch the change event** and then execute y...
If the source is generated dynamically - events will not bind to elements on document ready. Try this. ``` $(document).on("change", "#DateEnteredPhase", function () { var dateString = $('#DateEnteredPhase').val(); alert(dateString); }); ```
36,815,219
I put together a small script that is supposed to search through files of a certain type in a directory accumulating unique word counts > 4 characters, but it's not working as expected. 1. It doesn't eliminate the same word regardless of case. 2. I'm not sure how to tally up the totals of each word obviously. 3. Last...
2016/04/23
[ "https://Stackoverflow.com/questions/36815219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1125006/" ]
First, convert to all-lowercase as the first step in your pipeline. ``` tr A-Z a-z <"$file" | tr -sc a-z '\012' | ... ``` Second, do the sorting and counting at the end of the whole thing instead of inside the loop: ``` ... tr A-Z a-z <"$file" | tr -sc a-z '\012' done < <(find ...) | sort | uniq -c | egrep "\w{4...
The following uses [Associative Arrays](http://mywiki.wooledge.org/BashGuide/Arrays#Associative_Arrays) ( Bash 4 ) to store the word as the key, and its occurrences as the value: ``` declare -A arr while read -r word; do arr[$word]=$(( ${arr[$word]} + 1 )) done < <(find . -maxdepth 1 -type f -name '*.c' -exec grep...
36,815,219
I put together a small script that is supposed to search through files of a certain type in a directory accumulating unique word counts > 4 characters, but it's not working as expected. 1. It doesn't eliminate the same word regardless of case. 2. I'm not sure how to tally up the totals of each word obviously. 3. Last...
2016/04/23
[ "https://Stackoverflow.com/questions/36815219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1125006/" ]
First, convert to all-lowercase as the first step in your pipeline. ``` tr A-Z a-z <"$file" | tr -sc a-z '\012' | ... ``` Second, do the sorting and counting at the end of the whole thing instead of inside the loop: ``` ... tr A-Z a-z <"$file" | tr -sc a-z '\012' done < <(find ...) | sort | uniq -c | egrep "\w{4...
All you need is: ``` awk -v RS='\\s' 'length()>3{cnt[tolower($0)]++} END{for (word in cnt) print cnt[word], word}' *.c ``` The above uses GNU awk for multi-char RS and `\s`, it's a simple tweak with other awks: ``` awk '{for (i=1;i<=NF;i++) if (length($i)>3) cnt[tolower($i)]++} END{for (word in cnt) print cnt[word]...
36,815,219
I put together a small script that is supposed to search through files of a certain type in a directory accumulating unique word counts > 4 characters, but it's not working as expected. 1. It doesn't eliminate the same word regardless of case. 2. I'm not sure how to tally up the totals of each word obviously. 3. Last...
2016/04/23
[ "https://Stackoverflow.com/questions/36815219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1125006/" ]
All you need is: ``` awk -v RS='\\s' 'length()>3{cnt[tolower($0)]++} END{for (word in cnt) print cnt[word], word}' *.c ``` The above uses GNU awk for multi-char RS and `\s`, it's a simple tweak with other awks: ``` awk '{for (i=1;i<=NF;i++) if (length($i)>3) cnt[tolower($i)]++} END{for (word in cnt) print cnt[word]...
The following uses [Associative Arrays](http://mywiki.wooledge.org/BashGuide/Arrays#Associative_Arrays) ( Bash 4 ) to store the word as the key, and its occurrences as the value: ``` declare -A arr while read -r word; do arr[$word]=$(( ${arr[$word]} + 1 )) done < <(find . -maxdepth 1 -type f -name '*.c' -exec grep...
1,414,645
Let $f,g:\mathbb{R}\rightarrow \mathbb{R}$ and $f(I)\cap g(J)\not=\phi$ for all nonempty open interval $I,J$. Consider $f\_1=\chi\_\mathbb{Q}$ and $g\_1=\chi\_\mathbb{Q^c}$, we know that $f\_1$ and $g\_1$ satisfy above condition. (some examples can be constructed from this.) Can we find other examples ? Can we find ...
2015/08/30
[ "https://math.stackexchange.com/questions/1414645", "https://math.stackexchange.com", "https://math.stackexchange.com/users/240011/" ]
We can find one $f$ that works for all $g.$ The idea is to construct $f:\mathbb {R}\to \mathbb {R}$ such that $f(I)=\mathbb {R}$ for every nonempty open interval $I.$ Such an $f$ then has the desired property. The construction makes use of Cantor sets. By a Cantor set I mean here a set of the form $a +bK,$ where $a \i...
I know of examples that are very similar to your example. I'm not sure how helpful these examples will be. Basically, two indicator functions on any dense subset of the reals will work. For example $f(x) = 1$ and $g(x)$ is the indicator function of the algebraic numbers. Also, you can do something like $h(x) = 3$ and ...
4,829,774
Javadoc is great for scanning all of source files and creating HTML pages to view it. I was wondering if there is a similar tool that would go through all of your Spring controllers and collect all of the methods that have been annotated with @RequestMapping and produce a single HTML page listing them. Sort of like a p...
2011/01/28
[ "https://Stackoverflow.com/questions/4829774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/158613/" ]
This is a very good question, I often miss (and implement) functionality like this. Use a Build Tool ---------------- What I'd do is run Maven (or ant) and execute a task after compilation that * reads all classes (perhaps with a configurable list of packages) * iterates over all methods of these classes * reads the...
There's nothing that I know of that would do that. I've retrieved controllers and mappings via the app context before to create navigation, but it was a lot of work for little gain IMO: ``` @Component public class SiteMap implements ApplicationContextAware, InitializingBean { private ApplicationContext context; p...
71,477,143
I'm using Visual Studio 2019, and tried this in two different computers. Can someone explain what is going on?
2022/03/15
[ "https://Stackoverflow.com/questions/71477143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8933996/" ]
The distance for the center is proportional to the scaling (in each axis). We may compute `newx` and `newy` as follows: * Subtract `x_original_center` and `y_original_center` from `oldx` and `oldy`. After subtraction, (0, 0) is the "new center" (applies "centered coordinate system"). * Scale the "zero centered" co...
I prefer map coordinates in the following way: ``` float x_ratio = resizeimage.cols / static_cast<float>(org.cols); float y_ratio = resizeimage.rows / static_cast<float>(org.rows); cv::Point newPoint(static_cast<int>(oldx * x_ratio), static_cast<int>(oldy * y_ratio)); ```
12,028,250
If I have a C++ function/method, for example: ``` getSound(Animal a){ a.printSound(); } ``` and then pass it a `Dog` object that extends the class `Animal` but overrides Animal's `printSound()` method, is there a way of using Dog's `printSound()` within `getSound()`? I have tried making `printSound()` in the `Ani...
2012/08/19
[ "https://Stackoverflow.com/questions/12028250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1610242/" ]
Making `printSound` virtual was correct. Change the signature of `getSound` to take a `Animal&` or `const Animal&`. By taking an `Animal` by value you are constructing a new `Animal` from your `Dog`, and that's just an `Animal`, not a `Dog`.
It is because of [object-slicing](http://en.wikipedia.org/wiki/Object_slicing), as you accept the argument by value. Accept it by reference as: ``` void getSound(Animal & a); //now reference ``` If `Animal::printSound()` doesn't change the state of the object, then make it `const` member function (if it isn't const...
12,028,250
If I have a C++ function/method, for example: ``` getSound(Animal a){ a.printSound(); } ``` and then pass it a `Dog` object that extends the class `Animal` but overrides Animal's `printSound()` method, is there a way of using Dog's `printSound()` within `getSound()`? I have tried making `printSound()` in the `Ani...
2012/08/19
[ "https://Stackoverflow.com/questions/12028250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1610242/" ]
Making `printSound` virtual was correct. Change the signature of `getSound` to take a `Animal&` or `const Animal&`. By taking an `Animal` by value you are constructing a new `Animal` from your `Dog`, and that's just an `Animal`, not a `Dog`.
When you call `getSound`, you are passing the `Animal` by value. This means that a copy of the `Dog` is made by calling the `Animal`'s copy constructor. The `Animal`'s copy constructor constructs an `Animal`, not a `Dog`. You probably want pass by reference: ``` getSound(Animal& a){ a.printSound(); } ```
12,028,250
If I have a C++ function/method, for example: ``` getSound(Animal a){ a.printSound(); } ``` and then pass it a `Dog` object that extends the class `Animal` but overrides Animal's `printSound()` method, is there a way of using Dog's `printSound()` within `getSound()`? I have tried making `printSound()` in the `Ani...
2012/08/19
[ "https://Stackoverflow.com/questions/12028250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1610242/" ]
Making `printSound` virtual was correct. Change the signature of `getSound` to take a `Animal&` or `const Animal&`. By taking an `Animal` by value you are constructing a new `Animal` from your `Dog`, and that's just an `Animal`, not a `Dog`.
You've basically done everything right, except for one thing. Either pass the Animal object by reference ``` getSound(Animal &a); ``` Or provide a pointer to the object in question. ``` getSound(Animal *a) { a->printSound(); //Mind the -> in this case. } ``` To call this function, you'd go about like this: ...
60,155,678
I would like to create a simple code snippet that fetches all messages from the DLQ and re-sends them to the original destination (AKA resend/retry) It can be done easily by the ActiveMQ UI (but for a single message at a time).
2020/02/10
[ "https://Stackoverflow.com/questions/60155678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1103894/" ]
There is no direct JMS API for re-sending a message from a DLQ to its original queue. In fact, the JMS API doesn't even discuss dead-letter queues. It's merely a convention used by most brokers to deal with messages that can't be consumed. You'd need to create an actual JMS consumer to receive the message from the DLQ...
After Justin's reply I've manually implemented the retry mechanism like so: ```java public void retryAllDlqMessages() throws JMSException { logger.warn("retryAllDlqMessages starting"); logger.warn("Creating a connection to {}", activemqUrl); ActiveMQConnectionFactory connectionFactory = new ...
60,155,678
I would like to create a simple code snippet that fetches all messages from the DLQ and re-sends them to the original destination (AKA resend/retry) It can be done easily by the ActiveMQ UI (but for a single message at a time).
2020/02/10
[ "https://Stackoverflow.com/questions/60155678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1103894/" ]
Retrying all messages on the DLQ is already implemented in activemq as an mbean. You can trigger the retry method with jmxterm/jolokia e.g Replaying all messages on queue ActiveMQ.DLQ with jolokia ``` curl -XGET --user admin:admin --header "Origin: http://localhost" http://localhost:8161/api/jolokia/exec/org.apache...
After Justin's reply I've manually implemented the retry mechanism like so: ```java public void retryAllDlqMessages() throws JMSException { logger.warn("retryAllDlqMessages starting"); logger.warn("Creating a connection to {}", activemqUrl); ActiveMQConnectionFactory connectionFactory = new ...
40,840,624
How can I create folder on the server-pc on a button click ``` protected void BtnCreateFolder_Click(object sender, EventArgs e) { Directory.CreateDirectory("C:\\NewFolder1"); } ``` This code create folder on my local-pc, how can i create folder on server-pc with server-pc ip
2016/11/28
[ "https://Stackoverflow.com/questions/40840624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6730399/" ]
As explained in [MSDN: Directory.CreateDirectory](https://msdn.microsoft.com/en-us/library/54a0at6s(v=vs.110).aspx): > > You can create a directory on a remote computer, on a share that you have write access to. UNC paths are supported; > > > Keyword here being "UNC paths", which take the following form: ``` \\...
``` string directoryPath = Server.MapPath(string.Format("~/{0}/", "NewFolder1")); if (!Directory.Exists(directoryPath)) Directory.CreateDirectory(directoryPath); ``` this will create your newfolder1 and also check whether there is an another folder with same name.
9,672,868
Here's a demo of what I have so far: <http://www.betafreshmedia.com/nathan/coffee.html> I know there are a lot of other questions like this, however, I cannot adapt their syntax to mine as everyone's is pretty different. Here's my jQuery: ``` $(".trigger").click(function() { $(this).find('ul.coffeetype').slideToggle(...
2012/03/12
[ "https://Stackoverflow.com/questions/9672868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1130589/" ]
``` $(document).ready(function() { $(".trigger").click(function() { var $el = $(this).find('ul.coffeetype'); var $opened = $('.toggledDown').not($el); $opened.toggleClass('toggledDown'); $opened.slideToggle(); $el.toggleClass('toggledDown'); $el.slideToggle(); });...
If my understanding is correct:- JS -- ``` $(".trigger").hover(function() { $(this).find('.coffeetype').slideToggle(); });​ ``` CSS --- ``` .coffeetype { display: none; }​ ``` Refer **[LIVE DEMO](http://jsfiddle.net/dVVwB/)**
9,672,868
Here's a demo of what I have so far: <http://www.betafreshmedia.com/nathan/coffee.html> I know there are a lot of other questions like this, however, I cannot adapt their syntax to mine as everyone's is pretty different. Here's my jQuery: ``` $(".trigger").click(function() { $(this).find('ul.coffeetype').slideToggle(...
2012/03/12
[ "https://Stackoverflow.com/questions/9672868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1130589/" ]
``` $(document).ready(function() { $(".trigger").click(function() { var $el = $(this).find('ul.coffeetype'); var $opened = $('.toggledDown').not($el); $opened.toggleClass('toggledDown'); $opened.slideToggle(); $el.toggleClass('toggledDown'); $el.slideToggle(); });...
Change your code to the following: ``` $(".trigger").click(function() { $('ul.coffeetype').slideUp(); $(this).find('ul.coffeetype').slideToggle(); });​ ``` This slides all open lists closed first.
47,195,118
My Jenkins version is 2.7.8, I have job like Email\_AAA Email\_BBB Email\_CCC etc i created a view and set the filter with following Regular Expression: ^Email.\*$ But nothing is returned I didn't find anything related to this in log. Any possible clues? Thanks. -Neo
2017/11/09
[ "https://Stackoverflow.com/questions/47195118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8426528/" ]
The -p according to documentation is for (Use a custom password prompt with optional escape sequences) zentyal used the /usr/bin/sudo -p sudo: just for purpose of testing ``` Readonly::Scalar our $SUDO_PATH => '/usr/bin/sudo -p sudo:'; # our declaration eases testing ``` Because if you change to ``` /usr/bin/sud...
This answer gives you an answer to both the `sudo` and `-p sudo:` in your command. `sudo` itself is a privilege command allowing users to execute commands, if allowed in the `sudoers` file, which generally is not allowed by normal users. The sudoers file can determine exactly which commands a user is allowed to run. ...
8,469,732
I'd like to know this for the first boot and for subsequent boots. I'm compiling my own kernel and want it to be as lean as possible. I want to build the .config file by hand (mainly as a learning experience), so I need to know everything that can be excluded. I know a possible solution is to look at my current distro...
2011/12/12
[ "https://Stackoverflow.com/questions/8469732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/977656/" ]
> > How does the Linux kernel know which drivers to load at boot? > > > The kernel generates events for devices on e.g. the PCI bus when they are plugged (either hot or cold; events are queued until userspace runs AFAIR). udev will receive these events and do modprobe calls which include the PID/VID (product/vendo...
Greg Kroah give an excellent example on how to find exactly which drivers you need for you kernel. Kindly Greg gives his book away for free online <http://files.kroah.com/lkn/> A quote from Greg's books ``` I'm especially proud of the chapter on how to figure out how to configure a custom kernel based on the hardwar...
6,658,128
I am learning Objective-C and have completed a simple program and got an unexpected result. This program is just a multiplication table test... User inputs the number of iterations(test questions), then inputs answers. That after program displays the number of right and wrong answers, percentage and accepted/failed res...
2011/07/12
[ "https://Stackoverflow.com/questions/6658128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/715999/" ]
You might want to implement some sort of rounding because 33.333....\*3 = 99.99999%. 3/10 is an infinite decimal therefore you need some sort of rounding to occur (maybe at the 3rd decimal place) so that the answer comes out correct. I would say `if (num*1000 % 10 >= 5) num += .01` or something along those lines multip...
100/3 is 33. Integer mathematics here.
6,658,128
I am learning Objective-C and have completed a simple program and got an unexpected result. This program is just a multiplication table test... User inputs the number of iterations(test questions), then inputs answers. That after program displays the number of right and wrong answers, percentage and accepted/failed res...
2011/07/12
[ "https://Stackoverflow.com/questions/6658128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/715999/" ]
This is a result of integer division. When you perform division between two integer types, the result is automatically rounded towards 0 to form an integer. So, integer division of `(100 / 3)` gives a result of 33, not 33.33.... When you multiply that by 3, you get 99. To fix this, you can force floating point division...
You might want to implement some sort of rounding because 33.333....\*3 = 99.99999%. 3/10 is an infinite decimal therefore you need some sort of rounding to occur (maybe at the 3rd decimal place) so that the answer comes out correct. I would say `if (num*1000 % 10 >= 5) num += .01` or something along those lines multip...
6,658,128
I am learning Objective-C and have completed a simple program and got an unexpected result. This program is just a multiplication table test... User inputs the number of iterations(test questions), then inputs answers. That after program displays the number of right and wrong answers, percentage and accepted/failed res...
2011/07/12
[ "https://Stackoverflow.com/questions/6658128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/715999/" ]
Ints are integers. They can't represent an arbitrary real number like 1/3. Even floating-point numbers, which can represent reals, won't have enough precision to represent an infinitely repeating decimal like 100/3. You'll either need to use an arbitrary-precision library, use a library that includes rationals as a dat...
100/3 is 33. Integer mathematics here.
6,658,128
I am learning Objective-C and have completed a simple program and got an unexpected result. This program is just a multiplication table test... User inputs the number of iterations(test questions), then inputs answers. That after program displays the number of right and wrong answers, percentage and accepted/failed res...
2011/07/12
[ "https://Stackoverflow.com/questions/6658128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/715999/" ]
This is a result of integer division. When you perform division between two integer types, the result is automatically rounded towards 0 to form an integer. So, integer division of `(100 / 3)` gives a result of 33, not 33.33.... When you multiply that by 3, you get 99. To fix this, you can force floating point division...
Ints are integers. They can't represent an arbitrary real number like 1/3. Even floating-point numbers, which can represent reals, won't have enough precision to represent an infinitely repeating decimal like 100/3. You'll either need to use an arbitrary-precision library, use a library that includes rationals as a dat...
6,658,128
I am learning Objective-C and have completed a simple program and got an unexpected result. This program is just a multiplication table test... User inputs the number of iterations(test questions), then inputs answers. That after program displays the number of right and wrong answers, percentage and accepted/failed res...
2011/07/12
[ "https://Stackoverflow.com/questions/6658128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/715999/" ]
This is a result of integer division. When you perform division between two integer types, the result is automatically rounded towards 0 to form an integer. So, integer division of `(100 / 3)` gives a result of 33, not 33.33.... When you multiply that by 3, you get 99. To fix this, you can force floating point division...
100/3 is 33. Integer mathematics here.
12,395,337
My website has a small menu in the upper right hand corner that says the user's First Name and Last Name. I put this piece into a partial view. Since this displays on every page, I obviously think to cache it so I don't have to get the user's information everytime a page loads. Should I store this in cache or session d...
2012/09/12
[ "https://Stackoverflow.com/questions/12395337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/372519/" ]
As per scenarion, you should definitely use cache. and as you said, you already have menu as partial view ``` [OutputCache(Duration = 3600)] public ActionResult mymenu() { return PartialView(); } ```
It is preferred to store user information in session , not in cache. Cache is mostly application level and Session is per user/session. You can store per user info in the cache, providing you provide a key (either by session or cookie) . This article might be useful :- [cache-session-viewstate-c#](http://www.codeproje...
12,395,337
My website has a small menu in the upper right hand corner that says the user's First Name and Last Name. I put this piece into a partial view. Since this displays on every page, I obviously think to cache it so I don't have to get the user's information everytime a page loads. Should I store this in cache or session d...
2012/09/12
[ "https://Stackoverflow.com/questions/12395337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/372519/" ]
As per scenarion, you should definitely use cache. and as you said, you already have menu as partial view ``` [OutputCache(Duration = 3600)] public ActionResult mymenu() { return PartialView(); } ```
If you are refering to the ASP.Net Cache, information stored in it is available to any .Net page running on the machine. I would think in your case the Session would be more appropriate.
12,395,337
My website has a small menu in the upper right hand corner that says the user's First Name and Last Name. I put this piece into a partial view. Since this displays on every page, I obviously think to cache it so I don't have to get the user's information everytime a page loads. Should I store this in cache or session d...
2012/09/12
[ "https://Stackoverflow.com/questions/12395337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/372519/" ]
As per scenarion, you should definitely use cache. and as you said, you already have menu as partial view ``` [OutputCache(Duration = 3600)] public ActionResult mymenu() { return PartialView(); } ```
I am not sure what authentication mechanism you are using but it may already be stored in: HttpContext.Current.User or System.Threading.Thread.CurrentPrincipal
12,395,337
My website has a small menu in the upper right hand corner that says the user's First Name and Last Name. I put this piece into a partial view. Since this displays on every page, I obviously think to cache it so I don't have to get the user's information everytime a page loads. Should I store this in cache or session d...
2012/09/12
[ "https://Stackoverflow.com/questions/12395337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/372519/" ]
As per scenarion, you should definitely use cache. and as you said, you already have menu as partial view ``` [OutputCache(Duration = 3600)] public ActionResult mymenu() { return PartialView(); } ```
I prefer to create a User object which I set all the handy parameters I need across my site. This object is stored in the session or database depending on the site
388,672
What is the difference between GNOME, KDE, Xfce and LXDE desktop environments?
2013/12/10
[ "https://askubuntu.com/questions/388672", "https://askubuntu.com", "https://askubuntu.com/users/125078/" ]
* Unity is a nice 3D desktop environment designed for good performance on recent hardware. Unity is a graphical shell for the GNOME desktop environment. In 17.10 and later the Ubuntu Desktop uses GNOME as the default desktop environment instead of Unity. * KDE is an alternative lighter weight desktop environment to Ubu...
these are all desktop environments, you can still launch the same applications but how you get there and what they look like is a bit different. With some desktop environments you can change the appereance a lot (like KDE) while others will hardly allow you to change anything. an other big difference is how much resou...
388,672
What is the difference between GNOME, KDE, Xfce and LXDE desktop environments?
2013/12/10
[ "https://askubuntu.com/questions/388672", "https://askubuntu.com", "https://askubuntu.com/users/125078/" ]
[Wikipedia](http://en.wikipedia.org/wiki/Comparison_of_X_Window_System_desktop_environments) has a comparison so you can look it up there. And [the arch wiki](https://wiki.archlinux.org/index.php/Desktop_Environment) has another too. Just read them through.
these are all desktop environments, you can still launch the same applications but how you get there and what they look like is a bit different. With some desktop environments you can change the appereance a lot (like KDE) while others will hardly allow you to change anything. an other big difference is how much resou...
28,861,194
I create a jquery which sent data to a php file and after query(If any data found at sql) php return data to jquery by json\_encode for append it. Jquery sent two type data to php file: **1st:** page id **2nd:** post ids (a jquery array sent them to php file) If I used `print_r($_REQUEST['CID']); exit;` on php fil...
2015/03/04
[ "https://Stackoverflow.com/questions/28861194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4453049/" ]
I can think of one way without a slash: ``` double c = a * Math.pow(b, -1); ``` You can also substitute a Unicode escape for the `/` character. ``` double c2 = a \u002f b; ``` You can also convert to `BigDecimal`s, use the `divide` method, and then convert the quotient back to a `double`. ``` double c3 = new Big...
`System.out.println("The result is : " + (a * Math.pow(b, -1)));`
28,861,194
I create a jquery which sent data to a php file and after query(If any data found at sql) php return data to jquery by json\_encode for append it. Jquery sent two type data to php file: **1st:** page id **2nd:** post ids (a jquery array sent them to php file) If I used `print_r($_REQUEST['CID']); exit;` on php fil...
2015/03/04
[ "https://Stackoverflow.com/questions/28861194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4453049/" ]
I can think of one way without a slash: ``` double c = a * Math.pow(b, -1); ``` You can also substitute a Unicode escape for the `/` character. ``` double c2 = a \u002f b; ``` You can also convert to `BigDecimal`s, use the `divide` method, and then convert the quotient back to a `double`. ``` double c3 = new Big...
You can use exponent and logarithm becasue exp(log(a)-log(b)) =a/b public class HelloWorld{ ``` public static void main(String []args){ System.out.println(Math.pow(10,Math.log10(a)-Math.log10(b))); } ``` } You need to add checks for a>0 and b>0 and make logic so it work for all a,b but this you can do yourse...
28,861,194
I create a jquery which sent data to a php file and after query(If any data found at sql) php return data to jquery by json\_encode for append it. Jquery sent two type data to php file: **1st:** page id **2nd:** post ids (a jquery array sent them to php file) If I used `print_r($_REQUEST['CID']); exit;` on php fil...
2015/03/04
[ "https://Stackoverflow.com/questions/28861194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4453049/" ]
I can think of one way without a slash: ``` double c = a * Math.pow(b, -1); ``` You can also substitute a Unicode escape for the `/` character. ``` double c2 = a \u002f b; ``` You can also convert to `BigDecimal`s, use the `divide` method, and then convert the quotient back to a `double`. ``` double c3 = new Big...
``` public class Num { public static void main(String[] args) { double num, den, res; num = 10; den = 2; res = Math.pow(Math.E, (Math.log(num)-Math.log(den))); System.out.println(res); } } ```
28,861,194
I create a jquery which sent data to a php file and after query(If any data found at sql) php return data to jquery by json\_encode for append it. Jquery sent two type data to php file: **1st:** page id **2nd:** post ids (a jquery array sent them to php file) If I used `print_r($_REQUEST['CID']); exit;` on php fil...
2015/03/04
[ "https://Stackoverflow.com/questions/28861194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4453049/" ]
You can use exponent and logarithm becasue exp(log(a)-log(b)) =a/b public class HelloWorld{ ``` public static void main(String []args){ System.out.println(Math.pow(10,Math.log10(a)-Math.log10(b))); } ``` } You need to add checks for a>0 and b>0 and make logic so it work for all a,b but this you can do yourse...
`System.out.println("The result is : " + (a * Math.pow(b, -1)));`
28,861,194
I create a jquery which sent data to a php file and after query(If any data found at sql) php return data to jquery by json\_encode for append it. Jquery sent two type data to php file: **1st:** page id **2nd:** post ids (a jquery array sent them to php file) If I used `print_r($_REQUEST['CID']); exit;` on php fil...
2015/03/04
[ "https://Stackoverflow.com/questions/28861194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4453049/" ]
You can use exponent and logarithm becasue exp(log(a)-log(b)) =a/b public class HelloWorld{ ``` public static void main(String []args){ System.out.println(Math.pow(10,Math.log10(a)-Math.log10(b))); } ``` } You need to add checks for a>0 and b>0 and make logic so it work for all a,b but this you can do yourse...
``` public class Num { public static void main(String[] args) { double num, den, res; num = 10; den = 2; res = Math.pow(Math.E, (Math.log(num)-Math.log(den))); System.out.println(res); } } ```
55,598,155
I am quite new to Swift programming, but I am having trouble setting UILabel text in my UITableView class for individual UITableViewCell instances. I have created a custom subclass of UITableViewCell called `PizzaTableViewCell` and a custom UITableView class called `PizzaListTableViewController`. I am trying to popula...
2019/04/09
[ "https://Stackoverflow.com/questions/55598155", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11314191/" ]
I think i found your Problem, let me explain What you are doing here is you have a custom `UITableViewCell` defined in the `Storyboard` in a Controller named "Root View Controller" which is not your `PizzaListTableViewController` to put it simply And as you said you have absolutely no issue regarding the `IBOutlets...
Try this ``` cell.name?.text = ... cell.amount?.text = ... cell.miscellaneousText?.text = ... cell.pizzaImageView?.image = ... ``` If it still does not work then make sure your cell and your outlets are not null when setting its value. Hope it helps !
55,598,155
I am quite new to Swift programming, but I am having trouble setting UILabel text in my UITableView class for individual UITableViewCell instances. I have created a custom subclass of UITableViewCell called `PizzaTableViewCell` and a custom UITableView class called `PizzaListTableViewController`. I am trying to popula...
2019/04/09
[ "https://Stackoverflow.com/questions/55598155", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11314191/" ]
I think i found your Problem, let me explain What you are doing here is you have a custom `UITableViewCell` defined in the `Storyboard` in a Controller named "Root View Controller" which is not your `PizzaListTableViewController` to put it simply And as you said you have absolutely no issue regarding the `IBOutlets...
[![enter image description here](https://i.stack.imgur.com/YydJt.png)](https://i.stack.imgur.com/YydJt.png) There is something definitely strange going on with your setup. If you try to name the IBOutlets with the same name as the UITableViewCell default property it'll throw an error. The fact that you were able to se...
55,598,155
I am quite new to Swift programming, but I am having trouble setting UILabel text in my UITableView class for individual UITableViewCell instances. I have created a custom subclass of UITableViewCell called `PizzaTableViewCell` and a custom UITableView class called `PizzaListTableViewController`. I am trying to popula...
2019/04/09
[ "https://Stackoverflow.com/questions/55598155", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11314191/" ]
I think i found your Problem, let me explain What you are doing here is you have a custom `UITableViewCell` defined in the `Storyboard` in a Controller named "Root View Controller" which is not your `PizzaListTableViewController` to put it simply And as you said you have absolutely no issue regarding the `IBOutlets...
[![](https://i.stack.imgur.com/RGppb.png)](https://i.stack.imgur.com/RGppb.png) Make sure your Table View Controller class is set in the storyboard. [![](https://i.stack.imgur.com/qTIZs.png)](https://i.stack.imgur.com/qTIZs.png) Make sure your Table View Cell class is set in the storyboard. [![enter image descripti...
2,174,866
if i've got string functions i use a lot, should i put them in a helper class or a library class? functions like: truncate string if longer than 30 characters, return a random string, make all lower cases and so on. these are functions that i probably don't need to create an object for. it's better to use them as stat...
2010/02/01
[ "https://Stackoverflow.com/questions/2174866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/206446/" ]
Helpers are the classes that help something already there for example there can be a helper for: **array string url etc** A library is something that can be any solution; it could be created for the first time by you and no one else has created. Because you are dealing with a string (something already there...
I assume you are using CodeIgniter. Since you already write that you don't need to instantiate an object and will use it in it's static methods, then making it into helper will be make sense than making it into library. In CI, helpers is also managed, once loaded, second attempt to load it will be omitted. You can op...
2,174,866
if i've got string functions i use a lot, should i put them in a helper class or a library class? functions like: truncate string if longer than 30 characters, return a random string, make all lower cases and so on. these are functions that i probably don't need to create an object for. it's better to use them as stat...
2010/02/01
[ "https://Stackoverflow.com/questions/2174866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/206446/" ]
Helpers are the classes that help something already there for example there can be a helper for: **array string url etc** A library is something that can be any solution; it could be created for the first time by you and no one else has created. Because you are dealing with a string (something already there...
> > if i've got string functions i use a lot, should i put them in a helper class or a library class? > > > If they are functions, why do you want to stick them in a class? PHP allows for free floating functions.
2,174,866
if i've got string functions i use a lot, should i put them in a helper class or a library class? functions like: truncate string if longer than 30 characters, return a random string, make all lower cases and so on. these are functions that i probably don't need to create an object for. it's better to use them as stat...
2010/02/01
[ "https://Stackoverflow.com/questions/2174866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/206446/" ]
Helpers are the classes that help something already there for example there can be a helper for: **array string url etc** A library is something that can be any solution; it could be created for the first time by you and no one else has created. Because you are dealing with a string (something already there...
Helper is collection of user-defined or pre-defined functions, no need to instantiate as well as libraries are classes needs to instantiate to use them. Library might contain user-defined and pre-defined functions/methods too. Function defined in library (class) is known as method!
2,174,866
if i've got string functions i use a lot, should i put them in a helper class or a library class? functions like: truncate string if longer than 30 characters, return a random string, make all lower cases and so on. these are functions that i probably don't need to create an object for. it's better to use them as stat...
2010/02/01
[ "https://Stackoverflow.com/questions/2174866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/206446/" ]
Helpers are the classes that help something already there for example there can be a helper for: **array string url etc** A library is something that can be any solution; it could be created for the first time by you and no one else has created. Because you are dealing with a string (something already there...
Besides the [manual](http://ellislab.com/codeigniter/user-guide/index.html) that explains these all quite well… libraries: Utility classes where object state is important (payment gateways, authentication, etc.) helpers: Collections of related functions (not classes) that do repetitive tasks (strings, arrays, etc.) ...
2,174,866
if i've got string functions i use a lot, should i put them in a helper class or a library class? functions like: truncate string if longer than 30 characters, return a random string, make all lower cases and so on. these are functions that i probably don't need to create an object for. it's better to use them as stat...
2010/02/01
[ "https://Stackoverflow.com/questions/2174866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/206446/" ]
I assume you are using CodeIgniter. Since you already write that you don't need to instantiate an object and will use it in it's static methods, then making it into helper will be make sense than making it into library. In CI, helpers is also managed, once loaded, second attempt to load it will be omitted. You can op...
> > if i've got string functions i use a lot, should i put them in a helper class or a library class? > > > If they are functions, why do you want to stick them in a class? PHP allows for free floating functions.
2,174,866
if i've got string functions i use a lot, should i put them in a helper class or a library class? functions like: truncate string if longer than 30 characters, return a random string, make all lower cases and so on. these are functions that i probably don't need to create an object for. it's better to use them as stat...
2010/02/01
[ "https://Stackoverflow.com/questions/2174866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/206446/" ]
Besides the [manual](http://ellislab.com/codeigniter/user-guide/index.html) that explains these all quite well… libraries: Utility classes where object state is important (payment gateways, authentication, etc.) helpers: Collections of related functions (not classes) that do repetitive tasks (strings, arrays, etc.) ...
I assume you are using CodeIgniter. Since you already write that you don't need to instantiate an object and will use it in it's static methods, then making it into helper will be make sense than making it into library. In CI, helpers is also managed, once loaded, second attempt to load it will be omitted. You can op...
2,174,866
if i've got string functions i use a lot, should i put them in a helper class or a library class? functions like: truncate string if longer than 30 characters, return a random string, make all lower cases and so on. these are functions that i probably don't need to create an object for. it's better to use them as stat...
2010/02/01
[ "https://Stackoverflow.com/questions/2174866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/206446/" ]
Helper is collection of user-defined or pre-defined functions, no need to instantiate as well as libraries are classes needs to instantiate to use them. Library might contain user-defined and pre-defined functions/methods too. Function defined in library (class) is known as method!
> > if i've got string functions i use a lot, should i put them in a helper class or a library class? > > > If they are functions, why do you want to stick them in a class? PHP allows for free floating functions.
2,174,866
if i've got string functions i use a lot, should i put them in a helper class or a library class? functions like: truncate string if longer than 30 characters, return a random string, make all lower cases and so on. these are functions that i probably don't need to create an object for. it's better to use them as stat...
2010/02/01
[ "https://Stackoverflow.com/questions/2174866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/206446/" ]
Besides the [manual](http://ellislab.com/codeigniter/user-guide/index.html) that explains these all quite well… libraries: Utility classes where object state is important (payment gateways, authentication, etc.) helpers: Collections of related functions (not classes) that do repetitive tasks (strings, arrays, etc.) ...
> > if i've got string functions i use a lot, should i put them in a helper class or a library class? > > > If they are functions, why do you want to stick them in a class? PHP allows for free floating functions.
2,174,866
if i've got string functions i use a lot, should i put them in a helper class or a library class? functions like: truncate string if longer than 30 characters, return a random string, make all lower cases and so on. these are functions that i probably don't need to create an object for. it's better to use them as stat...
2010/02/01
[ "https://Stackoverflow.com/questions/2174866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/206446/" ]
Besides the [manual](http://ellislab.com/codeigniter/user-guide/index.html) that explains these all quite well… libraries: Utility classes where object state is important (payment gateways, authentication, etc.) helpers: Collections of related functions (not classes) that do repetitive tasks (strings, arrays, etc.) ...
Helper is collection of user-defined or pre-defined functions, no need to instantiate as well as libraries are classes needs to instantiate to use them. Library might contain user-defined and pre-defined functions/methods too. Function defined in library (class) is known as method!
29,940,663
I'm looking for the following regex: * The match can be empty. * If it is not empty, it must contain at least 2 characters which are English letters or digits. * The regex must allow spaces between words. This is what I come up with: ``` ^[a-zA-Z0-9]{2,}$ ``` It works fine, but it does not except spaces between w...
2015/04/29
[ "https://Stackoverflow.com/questions/29940663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3707896/" ]
Here, you can use this regex to make sure we match all kind of spaces (even a hard space), and make sure we allow an empty string match: ``` (?i)^(?:[a-z0-9]{2}[a-z0-9\p{Zs}]*|)$ ``` C#: ``` var rg11x = new Regex(@"(?i)^(?:[a-z0-9]{2}[a-z0-9\p{Zs}]*|)$"); var tst = rg11x.IsMatch(""); // true var tst1...
You can use `^[a-zA-Z\d]{2}[a-zA-Z\d\s]*?$` Here is also an useful site for learning and testing regex patterns. <http://regex101.com/>
30,576,966
First i insert a date into a textbox, from a SQL Server. The user can edit the date when needed. When the 'Save' button is pressed, i need to check if the date in the textbox is valid for SQL. When i check the date format as 'yyyy-mm-dd' and the date is valid everything is okay. But when i install my application on...
2015/06/01
[ "https://Stackoverflow.com/questions/30576966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2452125/" ]
It seems that you are confusing SQL Management Studio with underlying Database. Based on this qualified guess, the answer is simple: C# implements `DateTime` object compatible with all version of SQL Databases. If data is stored as string in DB, then you should use `DateTime.TryParse()` method to find out if it's a val...
Your approch seems to be wrong. If, in c#, you read a Date from the database in a correct way, you get a DateTime object, not a formatted string. For sql use for example sqldatareader.getDateTime()
57,931,379
I have a Rails project with a "Product Variant" form. The Product variant model is called `Variant`, and on the `Variant` form users should be able to select one choice for each option available. For instance a T-Shirt might have an "Option" called "Size" with the "Choices" small, medium, or large, and another "Option"...
2019/09/13
[ "https://Stackoverflow.com/questions/57931379", "https://Stackoverflow.com", "https://Stackoverflow.com/users/168286/" ]
It's analogous to a uniqueness constraint, but Rails's built-in [`validates_uniqueness_of`](https://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#method-i-validates_uniqueness_of) can't handle this: the validation required is on each Selection object, but it's by option, and the `selections` ta...
Something like this should work: ```rb def one_choice_per_option errors.add(:choice, "can't be more then one per selection") if selections.any { |selection| selection.choices.count > 1 } end ``` Alternatively, I suspect you could also just have selections `has_one :choice` and then your life might be simpler. ...
12,403,990
i have a small problem. I have register two events, but only the last was alwas called, can someone help me ``` <!-- Events --> <events> <checkout_type_onepage_save_order_after> <observers> <save_after> <type>singleton</type> <class>XXX_testr_Model_Observer_OrderObserver</class> <m...
2012/09/13
[ "https://Stackoverflow.com/questions/12403990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1668234/" ]
If you want to replace jQuery's fadeIn and fadeOut functions with jQuery Transit, you could do something like this: ``` $.fn.fadeOut = function(speed, callback) { var transitionSpeed = typeof (speed) == "undefined" ? 1000 : speed; $(this).transition({opacity: 0 }, transitionSpeed, callback); }; $.fn.fade...
Take a look at [this](https://github.com/louisremi/jquery.transition.js/) plugin. It might help you.
7,113,950
I'm new to shorthand conditional statements and I can't for the life of me work out how to do it, here's the simple code I have: ``` <?php function evolve_nav($vals) { echo '<'.$vals['type'] !== '' ? ''.$vals['type'].'' : 'darn''>'; } ?> ``` Does anyone know why this doesn't return anything and re...
2011/08/18
[ "https://Stackoverflow.com/questions/7113950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/633424/" ]
You just forgot some brackets: ``` function evolve_nav($vals) { echo '<'.(!empty($vals['type']) ? $vals['type'] : 'darn').'>'; } evolve_nav(array('type' => 'foobar')); evolve_nav(array('not' => 'showing')); ```
``` echo '<' . ($vals['type'] !== '' ? $vals['type'] : 'darn') .'>'; ```
7,113,950
I'm new to shorthand conditional statements and I can't for the life of me work out how to do it, here's the simple code I have: ``` <?php function evolve_nav($vals) { echo '<'.$vals['type'] !== '' ? ''.$vals['type'].'' : 'darn''>'; } ?> ``` Does anyone know why this doesn't return anything and re...
2011/08/18
[ "https://Stackoverflow.com/questions/7113950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/633424/" ]
You just forgot some brackets: ``` function evolve_nav($vals) { echo '<'.(!empty($vals['type']) ? $vals['type'] : 'darn').'>'; } evolve_nav(array('type' => 'foobar')); evolve_nav(array('not' => 'showing')); ```
* `''.$vals['type'].''` is superfluous, make it `$vals['type']` * `'darn''>'` those are two string literals without any operator (or anything) between them -> syntax error. In this case I'd rather not use string concatenation (i.e. using the dot-operator like `'xyz' . $a` ) but "pass" multiple parameters to echo. ``...
7,113,950
I'm new to shorthand conditional statements and I can't for the life of me work out how to do it, here's the simple code I have: ``` <?php function evolve_nav($vals) { echo '<'.$vals['type'] !== '' ? ''.$vals['type'].'' : 'darn''>'; } ?> ``` Does anyone know why this doesn't return anything and re...
2011/08/18
[ "https://Stackoverflow.com/questions/7113950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/633424/" ]
You just forgot some brackets: ``` function evolve_nav($vals) { echo '<'.(!empty($vals['type']) ? $vals['type'] : 'darn').'>'; } evolve_nav(array('type' => 'foobar')); evolve_nav(array('not' => 'showing')); ```
``` $descriptiveVariableName = $vals['type']!=='' ? $vals['type'] : 'darn'; // View code echo "<$descriptiveVariableName>"; ```
7,113,950
I'm new to shorthand conditional statements and I can't for the life of me work out how to do it, here's the simple code I have: ``` <?php function evolve_nav($vals) { echo '<'.$vals['type'] !== '' ? ''.$vals['type'].'' : 'darn''>'; } ?> ``` Does anyone know why this doesn't return anything and re...
2011/08/18
[ "https://Stackoverflow.com/questions/7113950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/633424/" ]
``` echo '<' . ($vals['type'] !== '' ? $vals['type'] : 'darn') .'>'; ```
* `''.$vals['type'].''` is superfluous, make it `$vals['type']` * `'darn''>'` those are two string literals without any operator (or anything) between them -> syntax error. In this case I'd rather not use string concatenation (i.e. using the dot-operator like `'xyz' . $a` ) but "pass" multiple parameters to echo. ``...
7,113,950
I'm new to shorthand conditional statements and I can't for the life of me work out how to do it, here's the simple code I have: ``` <?php function evolve_nav($vals) { echo '<'.$vals['type'] !== '' ? ''.$vals['type'].'' : 'darn''>'; } ?> ``` Does anyone know why this doesn't return anything and re...
2011/08/18
[ "https://Stackoverflow.com/questions/7113950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/633424/" ]
``` echo '<' . ($vals['type'] !== '' ? $vals['type'] : 'darn') .'>'; ```
``` $descriptiveVariableName = $vals['type']!=='' ? $vals['type'] : 'darn'; // View code echo "<$descriptiveVariableName>"; ```
5,905,024
I have a view called 'sub\_nav' and it currently holds a multidimentional array of the links for each section. This view looks at the controller name to get the current section and then loops through the appropriate array set and outputs the links. that works works but it feels like maybe I should create a controller...
2011/05/05
[ "https://Stackoverflow.com/questions/5905024", "https://Stackoverflow.com", "https://Stackoverflow.com/users/739215/" ]
If the content is a **static** array, I would put it in either: * **A view file.** Controllers aren't the only place views can be loaded, there's nothing wrong with calling `$this->load->view()` from within another view file (your template). Just store the array *and* the view logic there. * **A config file.** May sou...
Depending where the data for the navigation comes from, I might give it a model of its own (if it comes from a database for example). As for the logic for choosing navigation to display, I would put that logic in a common base controller, either running it on all page loads or placing code for it in a method on the bas...
70,992,183
I currently have a dataframe of customers, contracts, and contract dates like this ex ``` Cust Contract Start End A 123 10/1/2021 11/3/2021 B 987 7/4/2022 8/12/2022 ``` For each row, I want to generate a variable that tells me if it was active during a set r...
2022/02/04
[ "https://Stackoverflow.com/questions/70992183", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17996183/" ]
You are not allocating any character memory for `s` to refer to, so `s.size()` is 0 and thus `[0]` is out of bounds, and writing anything to it is [**undefined behavior**](https://en.cppreference.com/w/cpp/language/ub) 1. 1: in C++11 and later, you can safely write `'\0'` to `s[s.size()]`, but you are not doing that h...
This assignment ``` if(a[1]==' '){s[0]=a[1]; ``` invokes undefined behavior because the string `s` is empty and you may not use the subscript operator for an empty string to assign a value. Instead you could write for example ``` if(a[1]==' '){s += a[1]; ``` Pay attention to that in this case the string s will c...
70,992,183
I currently have a dataframe of customers, contracts, and contract dates like this ex ``` Cust Contract Start End A 123 10/1/2021 11/3/2021 B 987 7/4/2022 8/12/2022 ``` For each row, I want to generate a variable that tells me if it was active during a set r...
2022/02/04
[ "https://Stackoverflow.com/questions/70992183", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17996183/" ]
This assignment ``` if(a[1]==' '){s[0]=a[1]; ``` invokes undefined behavior because the string `s` is empty and you may not use the subscript operator for an empty string to assign a value. Instead you could write for example ``` if(a[1]==' '){s += a[1]; ``` Pay attention to that in this case the string s will c...
My guess is that this is a naive attempt to parse the string. Is this what you are looking for? ``` #include <string> #include <iostream> using namespace std; int main() { string a = "1 23"; string s; if (a[1] == ' ') { s = a.substr(2); cout << s; } return 0; } ```