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
5,289,766
i am developing with vb2005, using system.net.mail to send mail using google configuration. a full sample of my code was [posted here](https://stackoverflow.com/questions/5284514/system-net-mail-is-too-slow) earlier ``` With smtp .Host = "smtp.google.com" .Port = 465 .UseDe...
2011/03/13
[ "https://Stackoverflow.com/questions/5289766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/362461/" ]
If you are using **TWO STEP VERIFICATION** for gmail, then disable it first and then try again with this code ``` Dim myLogin As New NetworkCredential("username@gmail.com", "password") Dim msg As New MailMessage("username@gmail.com", "to@somedomain.com", "subjectLine", "emailBodyText") msg.IsBodyHtml = True Try ...
The Port number is 587. And also, try this order as per [this solution](https://stackoverflow.com/questions/704636/sending-email-through-gmail-smtp-server-with-c/3797154#3797154) ``` With smtp .UseDefaultCredentials = False .Credentials = New System.Net.NetworkCredential("myusername@gmail.com", "m...
5,289,766
i am developing with vb2005, using system.net.mail to send mail using google configuration. a full sample of my code was [posted here](https://stackoverflow.com/questions/5284514/system-net-mail-is-too-slow) earlier ``` With smtp .Host = "smtp.google.com" .Port = 465 .UseDe...
2011/03/13
[ "https://Stackoverflow.com/questions/5289766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/362461/" ]
Try ``` Dim myLogin As New NetworkCredential("username@gmail.com", "password") Dim msg As New MailMessage("username@gmail.com", "to@somedomain.com", "subjectLine", "emailBodyText") msg.IsBodyHtml = True Try Dim client As New SmtpClient("smtp.gmail.com", 587) client.EnableSsl = True client.UseDefaultCrede...
The port was right in the OP, but the host was wrong ``` With smtp .Port = 465 '465 for ssl .EnableSsl = True .UseDefaultCredentials = False .Credentials = New System.Net.NetworkCredential("myusername@gmail.com", "yourpassword") .Host = "smtp.gmail.com" End With ``` An...
5,289,766
i am developing with vb2005, using system.net.mail to send mail using google configuration. a full sample of my code was [posted here](https://stackoverflow.com/questions/5284514/system-net-mail-is-too-slow) earlier ``` With smtp .Host = "smtp.google.com" .Port = 465 .UseDe...
2011/03/13
[ "https://Stackoverflow.com/questions/5289766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/362461/" ]
The port was right in the OP, but the host was wrong ``` With smtp .Port = 465 '465 for ssl .EnableSsl = True .UseDefaultCredentials = False .Credentials = New System.Net.NetworkCredential("myusername@gmail.com", "yourpassword") .Host = "smtp.gmail.com" End With ``` An...
If you are using **TWO STEP VERIFICATION** for gmail, then disable it first and then try again with this code ``` Dim myLogin As New NetworkCredential("username@gmail.com", "password") Dim msg As New MailMessage("username@gmail.com", "to@somedomain.com", "subjectLine", "emailBodyText") msg.IsBodyHtml = True Try ...
5,289,766
i am developing with vb2005, using system.net.mail to send mail using google configuration. a full sample of my code was [posted here](https://stackoverflow.com/questions/5284514/system-net-mail-is-too-slow) earlier ``` With smtp .Host = "smtp.google.com" .Port = 465 .UseDe...
2011/03/13
[ "https://Stackoverflow.com/questions/5289766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/362461/" ]
Try ``` Dim myLogin As New NetworkCredential("username@gmail.com", "password") Dim msg As New MailMessage("username@gmail.com", "to@somedomain.com", "subjectLine", "emailBodyText") msg.IsBodyHtml = True Try Dim client As New SmtpClient("smtp.gmail.com", 587) client.EnableSsl = True client.UseDefaultCrede...
If you are using **TWO STEP VERIFICATION** for gmail, then disable it first and then try again with this code ``` Dim myLogin As New NetworkCredential("username@gmail.com", "password") Dim msg As New MailMessage("username@gmail.com", "to@somedomain.com", "subjectLine", "emailBodyText") msg.IsBodyHtml = True Try ...
53,796,166
This question is in reference to the popular [project-layout](https://github.com/golang-standards/project-layout). Is this simply a way to lay out the code, but the actual compilation of a binary will be in the ``` /cmd/app1/ /cmd/app2/ ``` So if I have a website, it would still be considered a cmd application that...
2018/12/15
[ "https://Stackoverflow.com/questions/53796166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39677/" ]
You can just ``` go build ./cmd/app/ ``` For example I have this module ``` ├── cmd │   ├── cli │   │   └── main.go │   └── web │   └── main.go ├── go.mod └── service └── service.go ``` go.mod is just ``` module example ``` service.go: ``` package service import "fmt" func DoSomething() { fmt.P...
If you want to build all of your apps inside a folder you can do like this : ``` go install ./... ``` this will build all your apps in bin folder inside GOPATH then you can run whatever app you like. But if you want to build and run a specific app you can go to that folder and simply run. ``` go build ``` As ...
3,988,664
I am having trouble filtering data out a relational table. The query is part of a join, but I am stuck on a basic part. I need to remove all the results with a certain id if the condition is found. query similar to: select \* from colors where color != 'red' group by id > > > ``` > id color > 1 red > 1 blue ...
2010/10/21
[ "https://Stackoverflow.com/questions/3988664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/346735/" ]
As far as I can tell if the object you're trying to dump implements `IEnumerable` then LINQPad always wants to dump it as an IEnumerable list. Getting rid of the interface correctly shows the `Hello` and `digits` properties in the dumped info. Going from [this link](http://www.linqpad.net/HowLINQPadWorks.aspx) it appe...
Use a Serializer? Json.NET will do all of this for you in a json format. Newtonsoft.Json.JsonConvert.SerializeObject(t, Newtonsoft.Json.Formatting.Indented) if you don't want json, then pick a serializer you do want, or you'll just have to do what a serializer would do, use reflection to iterate the properties on th...
3,988,664
I am having trouble filtering data out a relational table. The query is part of a join, but I am stuck on a basic part. I need to remove all the results with a certain id if the condition is found. query similar to: select \* from colors where color != 'red' group by id > > > ``` > id color > 1 red > 1 blue ...
2010/10/21
[ "https://Stackoverflow.com/questions/3988664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/346735/" ]
You could write a **DumpPayload** extension method as follows: ``` void Main() { var t = new test(); t.DumpPayload(); } public static class Extensions { public static void DumpPayload (this IEnumerable o) { if (o == null) { o.Dump(); return; } va...
As far as I can tell if the object you're trying to dump implements `IEnumerable` then LINQPad always wants to dump it as an IEnumerable list. Getting rid of the interface correctly shows the `Hello` and `digits` properties in the dumped info. Going from [this link](http://www.linqpad.net/HowLINQPadWorks.aspx) it appe...
3,988,664
I am having trouble filtering data out a relational table. The query is part of a join, but I am stuck on a basic part. I need to remove all the results with a certain id if the condition is found. query similar to: select \* from colors where color != 'red' group by id > > > ``` > id color > 1 red > 1 blue ...
2010/10/21
[ "https://Stackoverflow.com/questions/3988664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/346735/" ]
You could write a **DumpPayload** extension method as follows: ``` void Main() { var t = new test(); t.DumpPayload(); } public static class Extensions { public static void DumpPayload (this IEnumerable o) { if (o == null) { o.Dump(); return; } va...
Use a Serializer? Json.NET will do all of this for you in a json format. Newtonsoft.Json.JsonConvert.SerializeObject(t, Newtonsoft.Json.Formatting.Indented) if you don't want json, then pick a serializer you do want, or you'll just have to do what a serializer would do, use reflection to iterate the properties on th...
5,057,700
I need a huge favor from you. I have to run several times a PHP script, but I have no knowledge of programming in bash. The script should work like this: Within a cycle DoWhile -> * Execute PHP script directory / crawler.php, * I read the contents of the directory / array.txt * If the content is equal to 0 then I g...
2011/02/20
[ "https://Stackoverflow.com/questions/5057700", "https://Stackoverflow.com", "https://Stackoverflow.com/users/499786/" ]
Something like ``` php directory/crawler.php while [[ "$(cat directory/array.txt)" -ne "0" ]]; do php directory/crawler.php done ``` presuming that the directory/array.txt file only contains a 0 when execution should terminate.
``` #!/bin/bash file=directory/array.txt >>"$file" # create the file if it doesn't exist until [[ "$(<"$file")" == "0" ]] do php directory/crawler.php done ```
61,384,886
This is a [cross-post from TeX](https://tex.stackexchange.com/questions/539793/string-replacement-in-bibtool), but it did not get any answers there. And since I assume the problem has more to do with my understanding of regular expressions (or better, lack thereof) than with LaTeX itself, StackOverflow may have been th...
2020/04/23
[ "https://Stackoverflow.com/questions/61384886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3757393/" ]
I am not sure to grasp your question but this give me your requested output from your example: ``` import re reg_exp = re.compile("([0-9+\-.,]+)") string = 'gg-21.534wgtr..eu678+ithn' res = reg_exp.findall(string) print(''.join(res)) ```
I am no regex master but my first solution would be > > [^\d+-\.] > > >
61,384,886
This is a [cross-post from TeX](https://tex.stackexchange.com/questions/539793/string-replacement-in-bibtool), but it did not get any answers there. And since I assume the problem has more to do with my understanding of regular expressions (or better, lack thereof) than with LaTeX itself, StackOverflow may have been th...
2020/04/23
[ "https://Stackoverflow.com/questions/61384886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3757393/" ]
You can achive this with python re Explanation: `\d+` (any digits) `|` (or) `\.+` (any `.` of any length) `|` (or) `\+` (any single `+` >> add a `+` to mke it any length `\++`) `|` (or) `\-` (any single `-` >> add a `+` for any length `\--`) ``` import pandas as pd import re pattern = r'\d+|\.+|\+|\-' df = p...
I am no regex master but my first solution would be > > [^\d+-\.] > > >
61,384,886
This is a [cross-post from TeX](https://tex.stackexchange.com/questions/539793/string-replacement-in-bibtool), but it did not get any answers there. And since I assume the problem has more to do with my understanding of regular expressions (or better, lack thereof) than with LaTeX itself, StackOverflow may have been th...
2020/04/23
[ "https://Stackoverflow.com/questions/61384886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3757393/" ]
You should use ``` df['dummy'] = df['dummy'].astype(str).str.replace(r'[^\d.+-]+', '') ``` See the [regex demo](https://regex101.com/r/2cAPFW/1). The pandas method is `Series.str.replace` to find and replace matches with another string (empty one, since you are removing matches). The pattern you need is `[^\d.+-]+...
I am no regex master but my first solution would be > > [^\d+-\.] > > >
61,384,886
This is a [cross-post from TeX](https://tex.stackexchange.com/questions/539793/string-replacement-in-bibtool), but it did not get any answers there. And since I assume the problem has more to do with my understanding of regular expressions (or better, lack thereof) than with LaTeX itself, StackOverflow may have been th...
2020/04/23
[ "https://Stackoverflow.com/questions/61384886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3757393/" ]
You should use ``` df['dummy'] = df['dummy'].astype(str).str.replace(r'[^\d.+-]+', '') ``` See the [regex demo](https://regex101.com/r/2cAPFW/1). The pandas method is `Series.str.replace` to find and replace matches with another string (empty one, since you are removing matches). The pattern you need is `[^\d.+-]+...
I am not sure to grasp your question but this give me your requested output from your example: ``` import re reg_exp = re.compile("([0-9+\-.,]+)") string = 'gg-21.534wgtr..eu678+ithn' res = reg_exp.findall(string) print(''.join(res)) ```
61,384,886
This is a [cross-post from TeX](https://tex.stackexchange.com/questions/539793/string-replacement-in-bibtool), but it did not get any answers there. And since I assume the problem has more to do with my understanding of regular expressions (or better, lack thereof) than with LaTeX itself, StackOverflow may have been th...
2020/04/23
[ "https://Stackoverflow.com/questions/61384886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3757393/" ]
You should use ``` df['dummy'] = df['dummy'].astype(str).str.replace(r'[^\d.+-]+', '') ``` See the [regex demo](https://regex101.com/r/2cAPFW/1). The pandas method is `Series.str.replace` to find and replace matches with another string (empty one, since you are removing matches). The pattern you need is `[^\d.+-]+...
You can achive this with python re Explanation: `\d+` (any digits) `|` (or) `\.+` (any `.` of any length) `|` (or) `\+` (any single `+` >> add a `+` to mke it any length `\++`) `|` (or) `\-` (any single `-` >> add a `+` for any length `\--`) ``` import pandas as pd import re pattern = r'\d+|\.+|\+|\-' df = p...
22,693,112
When I put SMARTY variable between `{literal}{$txt_more}{/literal}` in Jquery then in source code it display right text (více without quotes) but in console it show this error: ReferenceError: v\u00EDce is not defined - this error I thought is because it is not in quotes but when I put it into quotes `{literal}'{$txt...
2014/03/27
[ "https://Stackoverflow.com/questions/22693112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3342042/" ]
Wrong quoting, should be: ``` $('.show_text').text("{/literal}{$txt_more}{literal}"); ```
If you're using Smarty 3, you don't need {literal} anymore, just make sure that there is always a space after any { in your code If using smarty 2, you don't need to be so specific with literal, remember that the problem is only when there is a "{". Your code will look much cleaner with one of this solutions: ``` {/l...
15,022,364
I'm sharing templates between client and server and would like to output the raw template inside a script tag which is possible with verbatim. <http://twig.sensiolabs.org/doc/tags/verbatim.html> However it would be nicer if this could be applied as a filter to the include but it doesn't seem possible? I'm new to twi...
2013/02/22
[ "https://Stackoverflow.com/questions/15022364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/95992/" ]
I ran into the same problem, and this page came up in my search results. In the time since this question was answered, the Twig developers added this functionality into the library. I figured I should add some details for future searchers. The functionality to include raw text (aka for client-side templates using the...
I was looking for something like this too because I'm using Twig.js for some client-side templating along with Symfony. I was trying to share templates between the server-side and client-side code, so I needed content to be parsed in some cases and treated as verbatim in others, which proved to be a bit tricky. I coul...
65,066,708
I'm getting an error when trying to install the [pyobjc](https://pypi.org/project/pyobjc/) library in a virtual environment on Big Sur. The installation errors out claiming that it "*Cannot determine SDK version*." I've done some digging, and it looks like this error is triggered by an exception in [this flow](https://...
2020/11/30
[ "https://Stackoverflow.com/questions/65066708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4505026/" ]
I believe the issue should be resolved by now. So running `pip install pyobjc` should be working again as expected (tested for pyobjc-**7.0.1** and python**3.9.0**). If not, you can set the SDK temporarily for the current session and build it from scratch with: ```sh SDKROOT=/Library/Developer/CommandLineTools/SDKs/M...
I also ran into this, managed to solve it by removing the symlink and all SDKs other than 11.0 from `/Library/Developer/CommandLineTools/SDKs`. Not entirely sure what this does for system stability or other software, but the `pip install pyobjc` did actually finish. I do not claim to be an expert on MacOS development,...
65,066,708
I'm getting an error when trying to install the [pyobjc](https://pypi.org/project/pyobjc/) library in a virtual environment on Big Sur. The installation errors out claiming that it "*Cannot determine SDK version*." I've done some digging, and it looks like this error is triggered by an exception in [this flow](https://...
2020/11/30
[ "https://Stackoverflow.com/questions/65066708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4505026/" ]
I believe the issue should be resolved by now. So running `pip install pyobjc` should be working again as expected (tested for pyobjc-**7.0.1** and python**3.9.0**). If not, you can set the SDK temporarily for the current session and build it from scratch with: ```sh SDKROOT=/Library/Developer/CommandLineTools/SDKs/M...
PyObjC should install using binary wheels (without compiling). Please file an issue in GitHub when it doesn't, and include information about your Python installation (such as how Python was installed).
15,659,047
Perhaps I've spent too much time in .NET, but it seems odd that I cannot easily pass the current Record of an ADO RecordSet to another method. ``` Private Sub ProcessData(data As ADODB.Recordset) While (Not data.EOF) ProcessRecord ([data.CurrentRecord]) ' <-- There is no CurrentRecord property. da...
2013/03/27
[ "https://Stackoverflow.com/questions/15659047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1036274/" ]
Personally, I would pass the entire recordset in to the ProcessRecord subroutine. Recordsets are always passed by reference so there is no overhead (performance or memory consumption) passing a recordset around. Just make sure you don't move to the next record in the ProcessRecord subroutine.
Unfortunately no.. you cant extract a single Record from a Recordset.. as G. Mastros said there is no additional overhead passing the whole recordset by reference and work with the current record so you might as well do it like that
15,659,047
Perhaps I've spent too much time in .NET, but it seems odd that I cannot easily pass the current Record of an ADO RecordSet to another method. ``` Private Sub ProcessData(data As ADODB.Recordset) While (Not data.EOF) ProcessRecord ([data.CurrentRecord]) ' <-- There is no CurrentRecord property. da...
2013/03/27
[ "https://Stackoverflow.com/questions/15659047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1036274/" ]
Personally, I would pass the entire recordset in to the ProcessRecord subroutine. Recordsets are always passed by reference so there is no overhead (performance or memory consumption) passing a recordset around. Just make sure you don't move to the next record in the ProcessRecord subroutine.
you can use the GetRows() method to load the data into an array and then let ProcessRecord work only with the array, but that 'disconnects' the method from the dataset and this may not be what you intend. The GetRows() method takes optional arguments to specify how many rows to get, where to start and the fields to ge...
15,659,047
Perhaps I've spent too much time in .NET, but it seems odd that I cannot easily pass the current Record of an ADO RecordSet to another method. ``` Private Sub ProcessData(data As ADODB.Recordset) While (Not data.EOF) ProcessRecord ([data.CurrentRecord]) ' <-- There is no CurrentRecord property. da...
2013/03/27
[ "https://Stackoverflow.com/questions/15659047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1036274/" ]
you can use the GetRows() method to load the data into an array and then let ProcessRecord work only with the array, but that 'disconnects' the method from the dataset and this may not be what you intend. The GetRows() method takes optional arguments to specify how many rows to get, where to start and the fields to ge...
Unfortunately no.. you cant extract a single Record from a Recordset.. as G. Mastros said there is no additional overhead passing the whole recordset by reference and work with the current record so you might as well do it like that
25,477,114
I run a dedicated server for an alpha/early access game called Space Engineers, occasionally they patch and break things and i am trying to create a powershell script to trouble shoot problems that may occur. I am ok with powershell, never messed with XML. The first step is disabling all objects in the game so that th...
2014/08/24
[ "https://Stackoverflow.com/questions/25477114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3973649/" ]
To be able to use `xsi` prefix in your XPath you need to register prefix-to-namespace URI mapping to `XmlNamespaceManager`, then pass the `XmlNamespaceManager` to `SelectNodes()` method : ``` ..... $ns = New-Object System.Xml.XmlNamespaceManager($myXML.NameTable) $ns.AddNamespace("xsi", "http://www.w3.org/2001/XMLSche...
If you are planning to do more XML modification you might find it more useful to use native XML technologies. So although it doesn't solve the problem like you tried to I'd like to offer you a solution using [BaseX](http://basex.org) (full disclosure: I am a member of the project team). Personally, I find it much simpl...
49,725,951
im working with laravel And i have bootstrap modal i want to become required the fields. i tried this one `required` in my input tag and textarea and its not working . i tried to validate in the fields in controller but it wont work i know there something wrong in what im doing. im just beginner in laravel. help me out...
2018/04/09
[ "https://Stackoverflow.com/questions/49725951", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can pass [manual validators](https://laravel.com/docs/5.6/validation#manually-creating-validators) in your **`sendnewmessage`** function, Please check the below code. ``` public function sendnewmessage(Request $request){ $validator = \Validator::make($request->all(), [ 'recipient' => 'required', ...
Here is what you want... ``` $this->validate($request, [ 'recipient' => 'required', 'newmessage' => 'required', ]); ``` [Here is validate document for laravel](https://laravel.com/docs/5.6/validation) And to show error messages in js you can get erros and store it in a variable ``` let $errors = response....
47,523,560
File upload not working with Material-UI/Button click. ``` <Button dense containerElement="label" label="label"> <input style={{display: 'none'}} type="file" /> </Button> ```
2017/11/28
[ "https://Stackoverflow.com/questions/47523560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6194909/" ]
With [`itertools.groupby()`](https://docs.python.org/3/library/itertools.html#itertools.groupby) and a bit of effort. ``` >>> [[b[1] for b in r] for p,r in itertools.groupby(zip(list1, list2), operator.itemgetter(0))] [[1, 3], [5, 7], [9]] ``` Use `itertools.izip()` instead of `zip()` if you're running 2.x.
You could also just use a dictionary: ``` from collections import defaultdict list1 = ["a","a","b","b","c"] list2 = [1, 3, 5, 7, 9] d = defaultdict(list) for k, v in zip(list1, list2): d[k].append(v) >>> print([lst for lst in sorted(d.values())]) [[1, 3], [5, 7], [9]] ```
40,804,436
I have an output like below: ```js output = { "New Classroom": [{ "Name": "Apple", "Age": "6", "Percentage": "24.00%" }, { "Name": "Orange", "Age": "5", "Percentage": "9.88%" }, { "Name": "Green", "Age": "2", "Percentage": "27.27%" }, { "Name": "Grey", "Age": "6", ...
2016/11/25
[ "https://Stackoverflow.com/questions/40804436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7177811/" ]
You can loop through the top-level property names in the object you receive, detect any with spaces, and remove the spaces. (You don't need to, they're perfectly valid property names, but you *can* if you want.) ```js var output = { "New Classroom": [{"Name": "Apple","Age": "6","Percentage": "24.00%"},{"Name": "Orange...
Loop in each keys of the `json`, then parse. try regexp ```js var word = "New Classroom" word = word.replace(/\s/g, ''); console.log(word) ```
40,804,436
I have an output like below: ```js output = { "New Classroom": [{ "Name": "Apple", "Age": "6", "Percentage": "24.00%" }, { "Name": "Orange", "Age": "5", "Percentage": "9.88%" }, { "Name": "Green", "Age": "2", "Percentage": "27.27%" }, { "Name": "Grey", "Age": "6", ...
2016/11/25
[ "https://Stackoverflow.com/questions/40804436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7177811/" ]
* Use `Object.keys` to get all keys of the object * Use `String#replace` to replace character from `String` ```js var obj = { "New Classroom": [{ "Name": "Apple", "Age": "6", "Percentage": "24.00%" }, { "Name": "Orange", "Age": "5", "Percentage": "9.88%" }, { "Name": "Green"...
Loop in each keys of the `json`, then parse. try regexp ```js var word = "New Classroom" word = word.replace(/\s/g, ''); console.log(word) ```
72,940,613
I am new to using bash. Now I am about to read a value, but the output of the console is too long and I just want to shorten it to the specific value. ``` netstat -m 24270/3315/27585 mbufs in use (current/cache/total) 4142/1724/5866/1000000 mbuf clusters in use (current/cache/total/max) 40/1478 mbuf+clusters out of p...
2022/07/11
[ "https://Stackoverflow.com/questions/72940613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19520516/" ]
Use `awk` for this: ``` mbuf=$(netstat -m | awk -F'/' 'NR == 2 { print $3; exit }') ``` `-F'/'` makes `/` the field separator. `NR == 2` matches the second line of the file. `print $3` prints the third field, which contains `5866`, then `exit` exits the script.
``` $ netstat -m | awk -F/ '/mbuf clusters in use/{print $3}' 5866 ```
72,940,613
I am new to using bash. Now I am about to read a value, but the output of the console is too long and I just want to shorten it to the specific value. ``` netstat -m 24270/3315/27585 mbufs in use (current/cache/total) 4142/1724/5866/1000000 mbuf clusters in use (current/cache/total/max) 40/1478 mbuf+clusters out of p...
2022/07/11
[ "https://Stackoverflow.com/questions/72940613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19520516/" ]
Use `awk` for this: ``` mbuf=$(netstat -m | awk -F'/' 'NR == 2 { print $3; exit }') ``` `-F'/'` makes `/` the field separator. `NR == 2` matches the second line of the file. `print $3` prints the third field, which contains `5866`, then `exit` exits the script.
> > > ``` > mbuf=$( netstat -m | > > gawk '$_=$--NF' RS='^$' FS='/[^/]+mbuf[^/]*clusters in use.*$|[/\n]+|$' ) > > ``` > > or > > > ``` > mawk -F/ '$!NF=$((NF*=/mbuf[^/]*clusters in use/)^_+NR)' > > ``` > > ``` 5866 ```
72,940,613
I am new to using bash. Now I am about to read a value, but the output of the console is too long and I just want to shorten it to the specific value. ``` netstat -m 24270/3315/27585 mbufs in use (current/cache/total) 4142/1724/5866/1000000 mbuf clusters in use (current/cache/total/max) 40/1478 mbuf+clusters out of p...
2022/07/11
[ "https://Stackoverflow.com/questions/72940613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19520516/" ]
What about this: ``` mbuf=$(netstat -m | grep "mbuf clusters in use" | awk -F/ '{print $3}') ``` The difference with the answer from [Barmar](https://stackoverflow.com/users/1491895/barmar) is that I'm looking for the line, containing "mbuf clusters in use" instead of assuming it's the second one.
``` $ netstat -m | awk -F/ '/mbuf clusters in use/{print $3}' 5866 ```
72,940,613
I am new to using bash. Now I am about to read a value, but the output of the console is too long and I just want to shorten it to the specific value. ``` netstat -m 24270/3315/27585 mbufs in use (current/cache/total) 4142/1724/5866/1000000 mbuf clusters in use (current/cache/total/max) 40/1478 mbuf+clusters out of p...
2022/07/11
[ "https://Stackoverflow.com/questions/72940613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19520516/" ]
What about this: ``` mbuf=$(netstat -m | grep "mbuf clusters in use" | awk -F/ '{print $3}') ``` The difference with the answer from [Barmar](https://stackoverflow.com/users/1491895/barmar) is that I'm looking for the line, containing "mbuf clusters in use" instead of assuming it's the second one.
> > > ``` > mbuf=$( netstat -m | > > gawk '$_=$--NF' RS='^$' FS='/[^/]+mbuf[^/]*clusters in use.*$|[/\n]+|$' ) > > ``` > > or > > > ``` > mawk -F/ '$!NF=$((NF*=/mbuf[^/]*clusters in use/)^_+NR)' > > ``` > > ``` 5866 ```
72,940,613
I am new to using bash. Now I am about to read a value, but the output of the console is too long and I just want to shorten it to the specific value. ``` netstat -m 24270/3315/27585 mbufs in use (current/cache/total) 4142/1724/5866/1000000 mbuf clusters in use (current/cache/total/max) 40/1478 mbuf+clusters out of p...
2022/07/11
[ "https://Stackoverflow.com/questions/72940613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19520516/" ]
``` $ netstat -m | awk -F/ '/mbuf clusters in use/{print $3}' 5866 ```
> > > ``` > mbuf=$( netstat -m | > > gawk '$_=$--NF' RS='^$' FS='/[^/]+mbuf[^/]*clusters in use.*$|[/\n]+|$' ) > > ``` > > or > > > ``` > mawk -F/ '$!NF=$((NF*=/mbuf[^/]*clusters in use/)^_+NR)' > > ``` > > ``` 5866 ```
40,913,506
I have a situation where I have a table with two dates lke startdate and enddate and a procedure in which there is a variable @offset. I need to write a tsql code for set the offset value as x when the current date falls in between the start date and enddate from the table. So I have to check the current date is in be...
2016/12/01
[ "https://Stackoverflow.com/questions/40913506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6495984/" ]
SqlPackage come with SMSS or SQL Data Tools. i see no other alternative than installing one of these two binaries to deploy dacpac, it is also possible from most computer running visual studio, because sql data tools is part of the defaults VS install. <https://msdn.microsoft.com/en-us/library/mt204009.aspx>
Usually you install [SSDT](https://msdn.microsoft.com/en-us/library/mt204009.aspx) to do this. I'm not sure if theres a portable version of SSDT somewhere that doesn't require an install if thats what you actually require.
40,913,506
I have a situation where I have a table with two dates lke startdate and enddate and a procedure in which there is a variable @offset. I need to write a tsql code for set the offset value as x when the current date falls in between the start date and enddate from the table. So I have to check the current date is in be...
2016/12/01
[ "https://Stackoverflow.com/questions/40913506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6495984/" ]
You can download any of these nuget packages (depending on desired version and platform). There you will find any missing DLLs. <https://www.nuget.org/packages?q=microsoft.sqlserver.dac+microsoft.sqlserver.dacfx> (Or you could write your own C#/Powershell application, using `Microsoft.SqlServer.Dac.DacServices` dir...
Usually you install [SSDT](https://msdn.microsoft.com/en-us/library/mt204009.aspx) to do this. I'm not sure if theres a portable version of SSDT somewhere that doesn't require an install if thats what you actually require.
40,913,506
I have a situation where I have a table with two dates lke startdate and enddate and a procedure in which there is a variable @offset. I need to write a tsql code for set the offset value as x when the current date falls in between the start date and enddate from the table. So I have to check the current date is in be...
2016/12/01
[ "https://Stackoverflow.com/questions/40913506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6495984/" ]
This seemed to be the "smallest" package I could install and still get the tool (sqlpackage.exe) that works. Microsoft® SQL Server® Data-Tier Application Framework (June 30 2016) <https://www.microsoft.com/en-us/download/confirmation.aspx?id=53013> the above installed it to the below directory when I install it (tod...
Usually you install [SSDT](https://msdn.microsoft.com/en-us/library/mt204009.aspx) to do this. I'm not sure if theres a portable version of SSDT somewhere that doesn't require an install if thats what you actually require.
40,913,506
I have a situation where I have a table with two dates lke startdate and enddate and a procedure in which there is a variable @offset. I need to write a tsql code for set the offset value as x when the current date falls in between the start date and enddate from the table. So I have to check the current date is in be...
2016/12/01
[ "https://Stackoverflow.com/questions/40913506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6495984/" ]
Since Aug 2018 your best bet is to download the "Windows .NET Core .zip file" from <https://learn.microsoft.com/en-us/sql/tools/sqlpackage-download?view=sql-server-2017#get-sqlpackage-net-core-for-windows>
Usually you install [SSDT](https://msdn.microsoft.com/en-us/library/mt204009.aspx) to do this. I'm not sure if theres a portable version of SSDT somewhere that doesn't require an install if thats what you actually require.
12,779,105
i got the vba code to display msgbox by checking one value. If Range("AH4").Value Then MsgBox "tablespace greater than 95" but i want to check a whole column of about 50 values and i want a looping code that traverses through the whole column and displays a msgbox if any of the value is greater than 95. A B C D 1 Tab...
2012/10/08
[ "https://Stackoverflow.com/questions/12779105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1728174/" ]
You don't need to loop for this. Try ``` Sub TestRange() Dim rng As Range Set rng = [F1:F10] ' <-- adjust to your requirements If Application.WorksheetFunction.Max(rng) > 95 Then MsgBox "tablespace greater than 95" End If End Sub ```
what about using a `for each` loop .... ``` Sub CheckInColumn() Dim TestCell As Range For Each TestCell In [E1].EntireColumn.Cells ' break on first find If TestCell > 95 Then MsgBox "Co-coo" Exit For End If Next TestCell End Sub ``` Instead of [E1] you could u...
19,832,957
I would like to do something like this in angularJS: ``` <div ng-class="{ 'hover-accordion': angular.element(this).children().length >= 3 }"> <div ng-if="showA">...</div> <div ng-if="showB">...</div> <div ng-if="showC">...</div> <div ng-if="showD">...</div> <div ng-if="showE">...</div> </div> ``` ...
2013/11/07
[ "https://Stackoverflow.com/questions/19832957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/289246/" ]
Mostly templates display a model (data from server). Use this model to alter the view. I wouldn't rely on the underlying DOM to manipulate the view. Sure you can but this wouldn't be the angular way. So instead of checking the length of children of a dom element, check the length of the model data that is rendered by t...
The children are made by PHP (or other server side code) ? Calculate and add the class with PHP. But if children are made with angular model, juste use the length of the model. Right ?
35,819,316
I have a `UITableView` and a `UITableViewController` that I use in multiple screens in my application. I recently spoke to the product team at my organization, and they have requested that for one of these screens, I prepend about 15 cells which look and function **very differently**. After googling around, it seems ...
2016/03/05
[ "https://Stackoverflow.com/questions/35819316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/937841/" ]
I've had to do something similar a couple of different times and here's what I was left with: 1. Add special cases based on section. Surprisingly, I found this to be the easiest to read and maintain. Just use static and clear variable names instead of `if (section == 0)`. 2. Create a special cell for row 0 that contai...
@Fennelouski, thank you so much for you tips, I actually ended up going with your unrecommended option #4: > > Put both table views in a container view > > > The primary reason I went in this direction is because in the past, when attempting to put scrollviews inside of other scrollviews, I found unexpected beha...
22,058,981
I need to know what is the difference between these two commands which do almost same thing if we execute this command.
2014/02/27
[ "https://Stackoverflow.com/questions/22058981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2772026/" ]
Maven doesn't assign any special meaning to `release-build`. However, projects can use properties (`-Dproperty-name=value` or just `-Dproperty-name`) to activate profiles that change the way the project is built ([Maven - activate profile based on project property](https://stackoverflow.com/questions/18889554/maven-act...
You can do this much more simpler automatically [to activate a profile in case of a release](http://maven.apache.org/maven-release/maven-release-plugin/examples/perform-release.html) simply via the maven-release-plugin which already supports that out-of-the-box like this: ``` <plugin> <artifactId>maven-release-p...
78,949
When my students ask questions and participate in discussion, class is more thoughtful, more fun, and more effective. I encourage their participation by checking in with them regularly, and making sure that they have time to speak and that they get a respectful hearing. Still, perhaps half of them never say a word. It ...
2016/10/28
[ "https://academia.stackexchange.com/questions/78949", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/14140/" ]
Is "speaking in class" or "communicating about the topic in groups" part of your learning goals for your students? If yes, then you should first communicate this to your students and then think about how to include participation in the grading rubric based on the learning goals you set. However, if you only want stude...
You want to grade people, in part, on their participation. If a person isn't speaking in class, whether it's because they're shy or because they have nothing to say, they're not participating. If part of the assessment of a class involves an oral presentation, and a student refuses to present because they're shy then ...
78,949
When my students ask questions and participate in discussion, class is more thoughtful, more fun, and more effective. I encourage their participation by checking in with them regularly, and making sure that they have time to speak and that they get a respectful hearing. Still, perhaps half of them never say a word. It ...
2016/10/28
[ "https://academia.stackexchange.com/questions/78949", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/14140/" ]
You want to grade people, in part, on their participation. If a person isn't speaking in class, whether it's because they're shy or because they have nothing to say, they're not participating. If part of the assessment of a class involves an oral presentation, and a student refuses to present because they're shy then ...
Provide the students with low-stakes or low-pressure opportunities to participate! Award points for people who send you interesting questions or links by email. Or, if you want, for those who come to your office hours, or talk to you after class. Another option is to do some activities in class and say they're not grad...
78,949
When my students ask questions and participate in discussion, class is more thoughtful, more fun, and more effective. I encourage their participation by checking in with them regularly, and making sure that they have time to speak and that they get a respectful hearing. Still, perhaps half of them never say a word. It ...
2016/10/28
[ "https://academia.stackexchange.com/questions/78949", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/14140/" ]
You want to grade people, in part, on their participation. If a person isn't speaking in class, whether it's because they're shy or because they have nothing to say, they're not participating. If part of the assessment of a class involves an oral presentation, and a student refuses to present because they're shy then ...
What you can do is tell those students that notoriously always answer (in my experience there always are some) to give some others a chance as well. If the few that always contribute also have the best contributions, you should tell them to just wait a little bit for the others to speak up and still hear them out after...
78,949
When my students ask questions and participate in discussion, class is more thoughtful, more fun, and more effective. I encourage their participation by checking in with them regularly, and making sure that they have time to speak and that they get a respectful hearing. Still, perhaps half of them never say a word. It ...
2016/10/28
[ "https://academia.stackexchange.com/questions/78949", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/14140/" ]
Is "speaking in class" or "communicating about the topic in groups" part of your learning goals for your students? If yes, then you should first communicate this to your students and then think about how to include participation in the grading rubric based on the learning goals you set. However, if you only want stude...
Provide the students with low-stakes or low-pressure opportunities to participate! Award points for people who send you interesting questions or links by email. Or, if you want, for those who come to your office hours, or talk to you after class. Another option is to do some activities in class and say they're not grad...
78,949
When my students ask questions and participate in discussion, class is more thoughtful, more fun, and more effective. I encourage their participation by checking in with them regularly, and making sure that they have time to speak and that they get a respectful hearing. Still, perhaps half of them never say a word. It ...
2016/10/28
[ "https://academia.stackexchange.com/questions/78949", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/14140/" ]
Is "speaking in class" or "communicating about the topic in groups" part of your learning goals for your students? If yes, then you should first communicate this to your students and then think about how to include participation in the grading rubric based on the learning goals you set. However, if you only want stude...
What you can do is tell those students that notoriously always answer (in my experience there always are some) to give some others a chance as well. If the few that always contribute also have the best contributions, you should tell them to just wait a little bit for the others to speak up and still hear them out after...
78,949
When my students ask questions and participate in discussion, class is more thoughtful, more fun, and more effective. I encourage their participation by checking in with them regularly, and making sure that they have time to speak and that they get a respectful hearing. Still, perhaps half of them never say a word. It ...
2016/10/28
[ "https://academia.stackexchange.com/questions/78949", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/14140/" ]
Is "speaking in class" or "communicating about the topic in groups" part of your learning goals for your students? If yes, then you should first communicate this to your students and then think about how to include participation in the grading rubric based on the learning goals you set. However, if you only want stude...
> > When my students ask questions and participate in discussion, class is more thoughtful, more fun, and more effective. > > > Here is some food for thought for you. Your assumption is that participation in class discussions can be encouraged by bestowing a grade benefit on those who participate actively. Do we...
78,949
When my students ask questions and participate in discussion, class is more thoughtful, more fun, and more effective. I encourage their participation by checking in with them regularly, and making sure that they have time to speak and that they get a respectful hearing. Still, perhaps half of them never say a word. It ...
2016/10/28
[ "https://academia.stackexchange.com/questions/78949", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/14140/" ]
Provide the students with low-stakes or low-pressure opportunities to participate! Award points for people who send you interesting questions or links by email. Or, if you want, for those who come to your office hours, or talk to you after class. Another option is to do some activities in class and say they're not grad...
What you can do is tell those students that notoriously always answer (in my experience there always are some) to give some others a chance as well. If the few that always contribute also have the best contributions, you should tell them to just wait a little bit for the others to speak up and still hear them out after...
78,949
When my students ask questions and participate in discussion, class is more thoughtful, more fun, and more effective. I encourage their participation by checking in with them regularly, and making sure that they have time to speak and that they get a respectful hearing. Still, perhaps half of them never say a word. It ...
2016/10/28
[ "https://academia.stackexchange.com/questions/78949", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/14140/" ]
> > When my students ask questions and participate in discussion, class is more thoughtful, more fun, and more effective. > > > Here is some food for thought for you. Your assumption is that participation in class discussions can be encouraged by bestowing a grade benefit on those who participate actively. Do we...
Provide the students with low-stakes or low-pressure opportunities to participate! Award points for people who send you interesting questions or links by email. Or, if you want, for those who come to your office hours, or talk to you after class. Another option is to do some activities in class and say they're not grad...
78,949
When my students ask questions and participate in discussion, class is more thoughtful, more fun, and more effective. I encourage their participation by checking in with them regularly, and making sure that they have time to speak and that they get a respectful hearing. Still, perhaps half of them never say a word. It ...
2016/10/28
[ "https://academia.stackexchange.com/questions/78949", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/14140/" ]
> > When my students ask questions and participate in discussion, class is more thoughtful, more fun, and more effective. > > > Here is some food for thought for you. Your assumption is that participation in class discussions can be encouraged by bestowing a grade benefit on those who participate actively. Do we...
What you can do is tell those students that notoriously always answer (in my experience there always are some) to give some others a chance as well. If the few that always contribute also have the best contributions, you should tell them to just wait a little bit for the others to speak up and still hear them out after...
21,858,008
My `.bak` file is the other the local server. I tried too many different script but unable to successes. I tried syntax is ``` RESTORE FILELISTONLY FROM DISK='D:\ERPNewtesting-12022014.bak' ``` Get the Logicalname from above query and use in below query ``` RESTORE DATABASE Test FROM DISK='ERPNewtesting-12022014...
2014/02/18
[ "https://Stackoverflow.com/questions/21858008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2456646/" ]
It sounds like you have backed up a db on one server, and you want to restore it to another server. Is this correct? Your backup file `D:\ERPNewtesting-12022014.bak` is on server A, right? It needs to be accessible to the account running the SQL Server service on server B. A few quick options come to mind: 1. Create ...
You're only specifying a "relative" path for the `.bak` file here: ``` RESTORE DATABASE Test FROM DISK='ERPNewtesting-12022014.bak' ``` and quite obviously, from the error message, the file isn't there where this points to. > > *Cannot open backup device 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.MSSQLSE...
21,858,008
My `.bak` file is the other the local server. I tried too many different script but unable to successes. I tried syntax is ``` RESTORE FILELISTONLY FROM DISK='D:\ERPNewtesting-12022014.bak' ``` Get the Logicalname from above query and use in below query ``` RESTORE DATABASE Test FROM DISK='ERPNewtesting-12022014...
2014/02/18
[ "https://Stackoverflow.com/questions/21858008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2456646/" ]
You're only specifying a "relative" path for the `.bak` file here: ``` RESTORE DATABASE Test FROM DISK='ERPNewtesting-12022014.bak' ``` and quite obviously, from the error message, the file isn't there where this points to. > > *Cannot open backup device 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.MSSQLSE...
Its mainly due to the rights issue :- Follow below 2 steps and it will resolve :- 1. Let the Server take backup on default directory and copy the file in your desired folder. I did that. 2. Give same kind of permissions to your desired folder as Backup directory has. OR U can add the service account into local admi...
21,858,008
My `.bak` file is the other the local server. I tried too many different script but unable to successes. I tried syntax is ``` RESTORE FILELISTONLY FROM DISK='D:\ERPNewtesting-12022014.bak' ``` Get the Logicalname from above query and use in below query ``` RESTORE DATABASE Test FROM DISK='ERPNewtesting-12022014...
2014/02/18
[ "https://Stackoverflow.com/questions/21858008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2456646/" ]
FYI: From SqlServer management studio there's an option to restore a database from the UI. It allows you to browse to find the source bak file. The browse window opened is on the **database server machine** NOT the machine where you are running management studio.
You're only specifying a "relative" path for the `.bak` file here: ``` RESTORE DATABASE Test FROM DISK='ERPNewtesting-12022014.bak' ``` and quite obviously, from the error message, the file isn't there where this points to. > > *Cannot open backup device 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.MSSQLSE...
21,858,008
My `.bak` file is the other the local server. I tried too many different script but unable to successes. I tried syntax is ``` RESTORE FILELISTONLY FROM DISK='D:\ERPNewtesting-12022014.bak' ``` Get the Logicalname from above query and use in below query ``` RESTORE DATABASE Test FROM DISK='ERPNewtesting-12022014...
2014/02/18
[ "https://Stackoverflow.com/questions/21858008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2456646/" ]
It sounds like you have backed up a db on one server, and you want to restore it to another server. Is this correct? Your backup file `D:\ERPNewtesting-12022014.bak` is on server A, right? It needs to be accessible to the account running the SQL Server service on server B. A few quick options come to mind: 1. Create ...
Its mainly due to the rights issue :- Follow below 2 steps and it will resolve :- 1. Let the Server take backup on default directory and copy the file in your desired folder. I did that. 2. Give same kind of permissions to your desired folder as Backup directory has. OR U can add the service account into local admi...
21,858,008
My `.bak` file is the other the local server. I tried too many different script but unable to successes. I tried syntax is ``` RESTORE FILELISTONLY FROM DISK='D:\ERPNewtesting-12022014.bak' ``` Get the Logicalname from above query and use in below query ``` RESTORE DATABASE Test FROM DISK='ERPNewtesting-12022014...
2014/02/18
[ "https://Stackoverflow.com/questions/21858008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2456646/" ]
FYI: From SqlServer management studio there's an option to restore a database from the UI. It allows you to browse to find the source bak file. The browse window opened is on the **database server machine** NOT the machine where you are running management studio.
Its mainly due to the rights issue :- Follow below 2 steps and it will resolve :- 1. Let the Server take backup on default directory and copy the file in your desired folder. I did that. 2. Give same kind of permissions to your desired folder as Backup directory has. OR U can add the service account into local admi...
9,163,714
I have an application which encrypt XML data using rijndaelmanaged algorithm to encrypt the data. My task is to convert C# code to C++ so that application doesn't depends upon .net framework. Kindly tell me about any library which have rijndaelmanaged algorithm and other cryptography techniques like passwordDeriveByte ...
2012/02/06
[ "https://Stackoverflow.com/questions/9163714", "https://Stackoverflow.com", "https://Stackoverflow.com/users/67381/" ]
Here's one public-domain Rijndael algorithm that (according to the docs) will also compile as C++: [Rijndael C/C++ Algorithm](http://www.efgh.com/software/rijndael.htm). Obviously if it compiles for both languages it probably won't conform to C++ best practices, but it will work. Here's another one that was written in...
This site contains an implementation of the Rijndael encryption algorithm: <http://www.efgh.com/software/rijndael.htm> Also, here is a CodeProject article related to the topic: <http://www.codeproject.com/Articles/1380/A-C-Implementation-of-the-Rijndael-Encryption-Decr>
9,163,714
I have an application which encrypt XML data using rijndaelmanaged algorithm to encrypt the data. My task is to convert C# code to C++ so that application doesn't depends upon .net framework. Kindly tell me about any library which have rijndaelmanaged algorithm and other cryptography techniques like passwordDeriveByte ...
2012/02/06
[ "https://Stackoverflow.com/questions/9163714", "https://Stackoverflow.com", "https://Stackoverflow.com/users/67381/" ]
Here's one public-domain Rijndael algorithm that (according to the docs) will also compile as C++: [Rijndael C/C++ Algorithm](http://www.efgh.com/software/rijndael.htm). Obviously if it compiles for both languages it probably won't conform to C++ best practices, but it will work. Here's another one that was written in...
You might want to take a look at [Crypto++](http://www.cryptopp.com/) which is a portable C++ cryptography library which implements amongst others AES (Rijndael)
19,774
I'm working on a game with a 2D view in a 3D world. It's a kind of shoot'em up. I've a spaceship at the center of the screen and i want that ennemies appear at the borders of my window. Now i don't know how to determine positions of the borders of the window. For example, my camera is at (0,0,0) and looking forward (...
2011/11/15
[ "https://gamedev.stackexchange.com/questions/19774", "https://gamedev.stackexchange.com", "https://gamedev.stackexchange.com/users/10373/" ]
*Disclaimer:* This solution really is simplified for your particular problem, because your camera is looking straight down the Z axis of the world's coordinate system. Also, the center point at 50 units away is already given as (0, 0, 50). If your camera's viewing direction was an arbitrary vector, there would be more ...
Conisdering you translate your "camera" by writing something like: gltranslatef(1, 3, 0). Make values such as posX and posY, and whenever you translate your camera, add to those values. Then when you add your enemy set it's X value to posX and it's Y value to posY for the enemy to appear where it would if the camera wa...
19,774
I'm working on a game with a 2D view in a 3D world. It's a kind of shoot'em up. I've a spaceship at the center of the screen and i want that ennemies appear at the borders of my window. Now i don't know how to determine positions of the borders of the window. For example, my camera is at (0,0,0) and looking forward (...
2011/11/15
[ "https://gamedev.stackexchange.com/questions/19774", "https://gamedev.stackexchange.com", "https://gamedev.stackexchange.com/users/10373/" ]
This is a more general solution ------------------------------- To start you will need some data. The Camera's position represented by **P** (this is a point) The normalized viewing vector represented by **v** The Camera's up vector represented by **up** The Camera's right vector represented by **w** (this is the ...
Conisdering you translate your "camera" by writing something like: gltranslatef(1, 3, 0). Make values such as posX and posY, and whenever you translate your camera, add to those values. Then when you add your enemy set it's X value to posX and it's Y value to posY for the enemy to appear where it would if the camera wa...
11,222,850
I am not following how to initialize a class constructor which accepts the names of DropDowns in an array as below: ``` public FillDropDowns(DropDownList[] DropDownNameArray) { PopulateDropDown(DropDownNameArray); } ``` I have a class named FillDropDowns with a method PopulateDropDown. From my Web Form, I want ...
2012/06/27
[ "https://Stackoverflow.com/questions/11222850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/194328/" ]
``` DropDownList[] parameter = new DropDownList[1]; // create an array of DropDownList parameter[0] = DropDownList1; // add DropDownList1 to the array (the reference to the drop down list you want include) var yourClass = new FillDropDowns(parameter); // make a new instance of the class by passing the array via the ...
Change your function to take a dropdown list. As per your comments this is what you want. ``` public FillDropDowns(DropDownList DropDownID) { PopulateDropDown(DropDownID); } ```
9,993,840
I have a website where I cache a lot of info. I am seeing conflicting information around storing stuff in the asp.net cache. For example lets say I have this data structure: ``` Dictionary<string, List<Car>> mydictionary; ``` I could store the whole thing with a string key as "MyDictionary" and then drill down onc...
2012/04/03
[ "https://Stackoverflow.com/questions/9993840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]
As you say, there are two opposing opinions on this. What it really boils down to is that cache entries should probably be stored at the most granular level as they are needed. By that, i mean, if you use every entry in your Dictionary every time it's used, then store it at the dictionary level. If you only use one ...
By far, the second way is better. Think of having to consider many objects. Every time you have to get 1 value, you will only need to get it, instead of grabing the entyre dictionary and, from that, get what you want. This, not saing about the algorithms used in the cache to prioritise the most used items (MRU if I s...
9,993,840
I have a website where I cache a lot of info. I am seeing conflicting information around storing stuff in the asp.net cache. For example lets say I have this data structure: ``` Dictionary<string, List<Car>> mydictionary; ``` I could store the whole thing with a string key as "MyDictionary" and then drill down onc...
2012/04/03
[ "https://Stackoverflow.com/questions/9993840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]
*Adding an additional answer here as I feel the existing one capture the 'what' but not enough of the 'why'.* The reason it's best to store individual entries separately in the cache have little to do with perf. Instead, it has to do with allowing the system to perform proper memory management. There is a lot of logi...
By far, the second way is better. Think of having to consider many objects. Every time you have to get 1 value, you will only need to get it, instead of grabing the entyre dictionary and, from that, get what you want. This, not saing about the algorithms used in the cache to prioritise the most used items (MRU if I s...
9,993,840
I have a website where I cache a lot of info. I am seeing conflicting information around storing stuff in the asp.net cache. For example lets say I have this data structure: ``` Dictionary<string, List<Car>> mydictionary; ``` I could store the whole thing with a string key as "MyDictionary" and then drill down onc...
2012/04/03
[ "https://Stackoverflow.com/questions/9993840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]
*Adding an additional answer here as I feel the existing one capture the 'what' but not enough of the 'why'.* The reason it's best to store individual entries separately in the cache have little to do with perf. Instead, it has to do with allowing the system to perform proper memory management. There is a lot of logi...
As you say, there are two opposing opinions on this. What it really boils down to is that cache entries should probably be stored at the most granular level as they are needed. By that, i mean, if you use every entry in your Dictionary every time it's used, then store it at the dictionary level. If you only use one ...
5,345,921
If given a directory path in the form of a std::string, how can I get a dirent struct pointing to that directory? I could start by getting a DIR\* to the needed directory using opendir(). Then I could use readdir() on my DIR\*, but that tries to return entries *within* the DIR\*, not the DIR\* itself. So what is the ...
2011/03/17
[ "https://Stackoverflow.com/questions/5345921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/135820/" ]
If you want the directory entry *for the directory itself* within its *parent*, do this: 1. `stat(path)`. Record `st_dev` and `st_ino`. 2. `stat(path + "/..")`. If this `st_dev` is not equal to the `st_dev` you got for `path`, `path` is a mount point, and the rest of what I'm about to say will not work. 3. `opendir(pa...
Repeat `readdir()` until you reach the `dirent` named `.`, which is the directory itself. To see this from the shell, type `ls -al`.
13,835,724
I am trying to include a navigation controller within the third tab of my tabbarcontroller. I have had some feedback but am only able to get about this far. The code below doesn't produce any errors, but does not seem to work as the app just quits out. Does anyone have any input on what I might be doing wrong? ``` UIV...
2012/12/12
[ "https://Stackoverflow.com/questions/13835724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/810984/" ]
First off, the reason you were having problems printing dots was that Tcl was buffering its output, waiting for a new line. That's often a useful behavior (often enough that it's the default) but it isn't wanted in this case so you turn it off with: ``` fconfigure stdout -buffering none ``` (The other buffering opti...
The standard output stream is initially line buffered, so you won't see new output until you write a newline character, call [flush](http://www.tcl.tk/man/tcl8.5/TclCmd/flush.htm) or close it (which is automatically done when your script exits). You could turn this buffering off with... ``` fconfigure stdout -bufferin...
6,910,378
I apparently have a `redis-server` instance running because when I try to start a new server by entering `redis-server`, I'm greeted with the following: ``` Opening port: bind: Address already in use ``` I can't figure out how to stop this server and start a new one. Is there any command I can append to `redis-serv...
2011/08/02
[ "https://Stackoverflow.com/questions/6910378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/403965/" ]
For OSX, I created the following aliases for starting and stopping `redis` (installed with Homebrew): ``` alias redstart='redis-server /usr/local/etc/redis/6379.conf' alias redstop='redis-cli -h 127.0.0.1 -p 6379 shutdown' ``` This has worked great for local development! Homebrew now has `homebrew-services` that ca...
Redis has configuration parameter `pidfile` (e.g. /etc/redis.conf - check [redis source code](https://github.com/antirez/redis/blob/unstable/redis.conf#L227)), for example: ``` # If a pid file is specified, Redis writes it where specified at startup # and removes it at exit. # # When the server runs non daemonized, no...
6,910,378
I apparently have a `redis-server` instance running because when I try to start a new server by entering `redis-server`, I'm greeted with the following: ``` Opening port: bind: Address already in use ``` I can't figure out how to stop this server and start a new one. Is there any command I can append to `redis-serv...
2011/08/02
[ "https://Stackoverflow.com/questions/6910378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/403965/" ]
A cleaner, more reliable way is to go into redis-cli and then type `shutdown` In redis-cli, type `help @server` and you will see this near the bottom of the list: > > SHUTDOWN - summary: Synchronously save the dataset to disk and then > shut down the server since: 0.07 > > > And if you have a redis-server insta...
To stop redis server ``` sudo service redis-server stop ``` and check the status of it using ``` sudo service redis-server status ```
6,910,378
I apparently have a `redis-server` instance running because when I try to start a new server by entering `redis-server`, I'm greeted with the following: ``` Opening port: bind: Address already in use ``` I can't figure out how to stop this server and start a new one. Is there any command I can append to `redis-serv...
2011/08/02
[ "https://Stackoverflow.com/questions/6910378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/403965/" ]
I would suggest to disable Redis-server, which prevents auto start while computer restarts and very useful to use docker like tools etc. Step 1: Stop the redis-server ```sh sudo service redis-server stop ``` Step 2: Disable the redis-server ```sh sudo systemctl disable redis-server ``` if you need redis, you can...
One thing to check if the redis commands are not working for you is if your redis-server.pid is actually being created. You specify the location of where this file is in ``` /etc/systemd/system/redis.service ``` and it should have a section that looks something like this: ``` [Service] Type=forking User=redis Gr...
6,910,378
I apparently have a `redis-server` instance running because when I try to start a new server by entering `redis-server`, I'm greeted with the following: ``` Opening port: bind: Address already in use ``` I can't figure out how to stop this server and start a new one. Is there any command I can append to `redis-serv...
2011/08/02
[ "https://Stackoverflow.com/questions/6910378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/403965/" ]
Either connect to node instance and use [shutdown](http://redis.io/commands/shutdown) command or if you are on ubuntu you can try to restart redis server through init.d: ``` /etc/init.d/redis-server restart ``` or stop/start it: ``` /etc/init.d/redis-server stop /etc/init.d/redis-server start ``` On Mac ``` redi...
The service name of redis is `redis-server`, so you can disable and stop redis with this command: ``` sudo systemctl disable redis-server sudo systemctl stop redis-server ```
6,910,378
I apparently have a `redis-server` instance running because when I try to start a new server by entering `redis-server`, I'm greeted with the following: ``` Opening port: bind: Address already in use ``` I can't figure out how to stop this server and start a new one. Is there any command I can append to `redis-serv...
2011/08/02
[ "https://Stackoverflow.com/questions/6910378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/403965/" ]
Either connect to node instance and use [shutdown](http://redis.io/commands/shutdown) command or if you are on ubuntu you can try to restart redis server through init.d: ``` /etc/init.d/redis-server restart ``` or stop/start it: ``` /etc/init.d/redis-server stop /etc/init.d/redis-server start ``` On Mac ``` redi...
A cleaner, more reliable way is to go into redis-cli and then type `shutdown` In redis-cli, type `help @server` and you will see this near the bottom of the list: > > SHUTDOWN - summary: Synchronously save the dataset to disk and then > shut down the server since: 0.07 > > > And if you have a redis-server insta...
6,910,378
I apparently have a `redis-server` instance running because when I try to start a new server by entering `redis-server`, I'm greeted with the following: ``` Opening port: bind: Address already in use ``` I can't figure out how to stop this server and start a new one. Is there any command I can append to `redis-serv...
2011/08/02
[ "https://Stackoverflow.com/questions/6910378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/403965/" ]
If you know on what port it would be running(by default it would be 6379), you can use below command to get the pid of the process using that port and then can execute kill command for the same pid. ``` sudo lsof -i : <port> | awk '{print $2}' ``` the above command will give you pid. kill `<pid>`; This would shutd...
To gracefully shutdown specific instances with passwords and not resorting to brute-force `kill` commands, use: `redis-cli -p <port> -a <pass> shutdown` ``` root@machine:~# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 105 0.1 0.0 60552 10772 ? Ssl 23:27 0:02 ...
6,910,378
I apparently have a `redis-server` instance running because when I try to start a new server by entering `redis-server`, I'm greeted with the following: ``` Opening port: bind: Address already in use ``` I can't figure out how to stop this server and start a new one. Is there any command I can append to `redis-serv...
2011/08/02
[ "https://Stackoverflow.com/questions/6910378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/403965/" ]
Type `SHUTDOWN` in the CLI or if your don't care about your data in memory, you may also type `SHUTDOWN NOSAVE` to force shutdown the server.
To gracefully shutdown specific instances with passwords and not resorting to brute-force `kill` commands, use: `redis-cli -p <port> -a <pass> shutdown` ``` root@machine:~# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 105 0.1 0.0 60552 10772 ? Ssl 23:27 0:02 ...
6,910,378
I apparently have a `redis-server` instance running because when I try to start a new server by entering `redis-server`, I'm greeted with the following: ``` Opening port: bind: Address already in use ``` I can't figure out how to stop this server and start a new one. Is there any command I can append to `redis-serv...
2011/08/02
[ "https://Stackoverflow.com/questions/6910378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/403965/" ]
Try `killall redis-server`. You may also use `ps aux` to find the name and pid of your server, and then kill it with `kill -9 here_pid_number`.
Redis has configuration parameter `pidfile` (e.g. /etc/redis.conf - check [redis source code](https://github.com/antirez/redis/blob/unstable/redis.conf#L227)), for example: ``` # If a pid file is specified, Redis writes it where specified at startup # and removes it at exit. # # When the server runs non daemonized, no...
6,910,378
I apparently have a `redis-server` instance running because when I try to start a new server by entering `redis-server`, I'm greeted with the following: ``` Opening port: bind: Address already in use ``` I can't figure out how to stop this server and start a new one. Is there any command I can append to `redis-serv...
2011/08/02
[ "https://Stackoverflow.com/questions/6910378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/403965/" ]
Another way could be: ``` ps -ef | grep -i 'redis-server' kill -9 PID owned by redis ``` Works on \*NIX & OSX
If Redis is installed via snap: ``` sudo snap stop redis.server ```
6,910,378
I apparently have a `redis-server` instance running because when I try to start a new server by entering `redis-server`, I'm greeted with the following: ``` Opening port: bind: Address already in use ``` I can't figure out how to stop this server and start a new one. Is there any command I can append to `redis-serv...
2011/08/02
[ "https://Stackoverflow.com/questions/6910378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/403965/" ]
To stop redis server ``` sudo service redis-server stop ``` and check the status of it using ``` sudo service redis-server status ```
The commands below works for me on **Ubuntu Server** ``` $ service /etc/init.d/redis_6379 stop $ service /etc/init.d/redis_6379 start $ service /etc/init.d/redis_6379 restart ```
762,113
I need a command that can be run from the command line to create a folder for each file (based on the file-name) in a directory and then move the file into the newly created folders. Example : **Starting Folder:** ``` Dog.jpg Cat.jpg ``` The following command works great at creating a folder for each filename in t...
2014/05/31
[ "https://superuser.com/questions/762113", "https://superuser.com", "https://superuser.com/users/328294/" ]
The second command would be ``` for %i in (*) do move "%i" "%~ni" ``` EDIT: Added "" for the %i, based on and31415's comment. tnx.
Just execute these commands in series: For creating the folders for each file: ``` for %i in (*) do mkdir "%~ni" ``` For moving each file to its folder: ``` for %i in (*) do move "%i" "%~ni" ```
762,113
I need a command that can be run from the command line to create a folder for each file (based on the file-name) in a directory and then move the file into the newly created folders. Example : **Starting Folder:** ``` Dog.jpg Cat.jpg ``` The following command works great at creating a folder for each filename in t...
2014/05/31
[ "https://superuser.com/questions/762113", "https://superuser.com", "https://superuser.com/users/328294/" ]
The second command would be ``` for %i in (*) do move "%i" "%~ni" ``` EDIT: Added "" for the %i, based on and31415's comment. tnx.
This will do it if you have some folders like: example years\Filename.mp4 ``` 1901\Filename.mp4 1902\Filename.mp4 1903\Filename.mp4 ``` it will list all the folder 1st level files; lists all \*.mp4 and \*.mkv will create the 2 level folders with the filename and will move all the same name files in the 1st level fo...
762,113
I need a command that can be run from the command line to create a folder for each file (based on the file-name) in a directory and then move the file into the newly created folders. Example : **Starting Folder:** ``` Dog.jpg Cat.jpg ``` The following command works great at creating a folder for each filename in t...
2014/05/31
[ "https://superuser.com/questions/762113", "https://superuser.com", "https://superuser.com/users/328294/" ]
Just execute these commands in series: For creating the folders for each file: ``` for %i in (*) do mkdir "%~ni" ``` For moving each file to its folder: ``` for %i in (*) do move "%i" "%~ni" ```
This will do it if you have some folders like: example years\Filename.mp4 ``` 1901\Filename.mp4 1902\Filename.mp4 1903\Filename.mp4 ``` it will list all the folder 1st level files; lists all \*.mp4 and \*.mkv will create the 2 level folders with the filename and will move all the same name files in the 1st level fo...
2,548,664
I can't believe I'm still confused about this but, any way, lets finally nail it: I have a class that overrides OnPaint to do some drawing. To speed things up, I create the pens, brushes etc before hand, in the constructor, so that OnPaint does not need to keep creating and disposing them. Now, I make sure that I alw...
2010/03/30
[ "https://Stackoverflow.com/questions/2548664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/120399/" ]
You really need to look up the documentation for the brushes, pens etc. If they aren't using unmanaged resources, you may not have to call Dispose. But the using/Dispose pattern is sometimes "misused". As an example, consider the ASP.NET MVC framework. Here you can write something like: ``` using(Html.BeginForm(...)...
Although you asked about pens and brushes, Font is a class with some odd quirks. In particular, if one creates a font for the purpose of setting a control's Font property, one remains responsible for disposing of that font--ownership does not transfer to the control--but that responsibility can be carried out by dispos...
2,548,664
I can't believe I'm still confused about this but, any way, lets finally nail it: I have a class that overrides OnPaint to do some drawing. To speed things up, I create the pens, brushes etc before hand, in the constructor, so that OnPaint does not need to keep creating and disposing them. Now, I make sure that I alw...
2010/03/30
[ "https://Stackoverflow.com/questions/2548664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/120399/" ]
It is *not* correct. You need to dispose objects that implement `IDisposable`. That is why they implement `IDisposable` - to specify the fact that they wrap (directly or indirectly) unmanaged resources. In this case, the unmanaged resource is a GDI handle, and if you fail to dispose them when you are actually done wit...
No, `Pen`s and `Brush`es are **not** fully managed objects. They contain a handle to an unmanaged resource, i.e. the corresponding GDI object in the underlying graphics system. (Not certain about the exact terminology here...) If you don't dispose them, the handles will not be released until the objects are finalised...
2,548,664
I can't believe I'm still confused about this but, any way, lets finally nail it: I have a class that overrides OnPaint to do some drawing. To speed things up, I create the pens, brushes etc before hand, in the constructor, so that OnPaint does not need to keep creating and disposing them. Now, I make sure that I alw...
2010/03/30
[ "https://Stackoverflow.com/questions/2548664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/120399/" ]
I wrote a GDI+ diagramming component which used lots of pens and brushes. I created them and disposed them in the block of code that was doing the drawing and performance was never an issue. Better that then having a long lived handle hanging around in the OS IMHO.
You really need to look up the documentation for the brushes, pens etc. If they aren't using unmanaged resources, you may not have to call Dispose. But the using/Dispose pattern is sometimes "misused". As an example, consider the ASP.NET MVC framework. Here you can write something like: ``` using(Html.BeginForm(...)...
2,548,664
I can't believe I'm still confused about this but, any way, lets finally nail it: I have a class that overrides OnPaint to do some drawing. To speed things up, I create the pens, brushes etc before hand, in the constructor, so that OnPaint does not need to keep creating and disposing them. Now, I make sure that I alw...
2010/03/30
[ "https://Stackoverflow.com/questions/2548664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/120399/" ]
You need to dispose them. Managed object manage their *memory* by themselves. But memory isn't the only resource that an object uses. `Dispose()` is intended to release the other resources.
Others have alluded to "using" blocks for GDI objects - here's a code example: ``` using( var bm = new Bitmap() ) using( var brush = new Brush() ) { // code that uses the GDI objects goes here ... } // objects are automatically disposed here, even if there's an exception ``` Note that you can have as many "u...
2,548,664
I can't believe I'm still confused about this but, any way, lets finally nail it: I have a class that overrides OnPaint to do some drawing. To speed things up, I create the pens, brushes etc before hand, in the constructor, so that OnPaint does not need to keep creating and disposing them. Now, I make sure that I alw...
2010/03/30
[ "https://Stackoverflow.com/questions/2548664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/120399/" ]
There is a marked irony in your approach. By pre-creating the pens/brushes, you are exactly *creating* the problem that Dispose() is trying to solve. Those GDI objects will be around longer, just like they would be when you don't call Dispose(). It is actually worse, they'll be around at least until the form is closed....
Have you profiled this to see if Creating & Disposing these objects really is a problem? I don't think it is. You make things a lot easier for yourself and certainly less error prone by just following the create-in-a-using-block pattern. If you do want to create them once, then also implement IDisposable on your own...
2,548,664
I can't believe I'm still confused about this but, any way, lets finally nail it: I have a class that overrides OnPaint to do some drawing. To speed things up, I create the pens, brushes etc before hand, in the constructor, so that OnPaint does not need to keep creating and disposing them. Now, I make sure that I alw...
2010/03/30
[ "https://Stackoverflow.com/questions/2548664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/120399/" ]
Have you profiled this to see if Creating & Disposing these objects really is a problem? I don't think it is. You make things a lot easier for yourself and certainly less error prone by just following the create-in-a-using-block pattern. If you do want to create them once, then also implement IDisposable on your own...
No, `Pen`s and `Brush`es are **not** fully managed objects. They contain a handle to an unmanaged resource, i.e. the corresponding GDI object in the underlying graphics system. (Not certain about the exact terminology here...) If you don't dispose them, the handles will not be released until the objects are finalised...
2,548,664
I can't believe I'm still confused about this but, any way, lets finally nail it: I have a class that overrides OnPaint to do some drawing. To speed things up, I create the pens, brushes etc before hand, in the constructor, so that OnPaint does not need to keep creating and disposing them. Now, I make sure that I alw...
2010/03/30
[ "https://Stackoverflow.com/questions/2548664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/120399/" ]
I wrote a GDI+ diagramming component which used lots of pens and brushes. I created them and disposed them in the block of code that was doing the drawing and performance was never an issue. Better that then having a long lived handle hanging around in the OS IMHO.
No, IDisposable is for managed objects that use unmanaged resources. As a rule, you should always dispose of them when finished.
2,548,664
I can't believe I'm still confused about this but, any way, lets finally nail it: I have a class that overrides OnPaint to do some drawing. To speed things up, I create the pens, brushes etc before hand, in the constructor, so that OnPaint does not need to keep creating and disposing them. Now, I make sure that I alw...
2010/03/30
[ "https://Stackoverflow.com/questions/2548664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/120399/" ]
No, `Pen`s and `Brush`es are **not** fully managed objects. They contain a handle to an unmanaged resource, i.e. the corresponding GDI object in the underlying graphics system. (Not certain about the exact terminology here...) If you don't dispose them, the handles will not be released until the objects are finalised...
Although you asked about pens and brushes, Font is a class with some odd quirks. In particular, if one creates a font for the purpose of setting a control's Font property, one remains responsible for disposing of that font--ownership does not transfer to the control--but that responsibility can be carried out by dispos...
2,548,664
I can't believe I'm still confused about this but, any way, lets finally nail it: I have a class that overrides OnPaint to do some drawing. To speed things up, I create the pens, brushes etc before hand, in the constructor, so that OnPaint does not need to keep creating and disposing them. Now, I make sure that I alw...
2010/03/30
[ "https://Stackoverflow.com/questions/2548664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/120399/" ]
Have you profiled this to see if Creating & Disposing these objects really is a problem? I don't think it is. You make things a lot easier for yourself and certainly less error prone by just following the create-in-a-using-block pattern. If you do want to create them once, then also implement IDisposable on your own...
Although you asked about pens and brushes, Font is a class with some odd quirks. In particular, if one creates a font for the purpose of setting a control's Font property, one remains responsible for disposing of that font--ownership does not transfer to the control--but that responsibility can be carried out by dispos...
2,548,664
I can't believe I'm still confused about this but, any way, lets finally nail it: I have a class that overrides OnPaint to do some drawing. To speed things up, I create the pens, brushes etc before hand, in the constructor, so that OnPaint does not need to keep creating and disposing them. Now, I make sure that I alw...
2010/03/30
[ "https://Stackoverflow.com/questions/2548664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/120399/" ]
Have you profiled this to see if Creating & Disposing these objects really is a problem? I don't think it is. You make things a lot easier for yourself and certainly less error prone by just following the create-in-a-using-block pattern. If you do want to create them once, then also implement IDisposable on your own...
You really need to look up the documentation for the brushes, pens etc. If they aren't using unmanaged resources, you may not have to call Dispose. But the using/Dispose pattern is sometimes "misused". As an example, consider the ASP.NET MVC framework. Here you can write something like: ``` using(Html.BeginForm(...)...
35,050,073
Lets assume I'm working with Python although it's not really relevant. I have a big array and I want to find whether element x is in the array. However, when one of the threads finds the element, I want that all other threads will stop, there is no point for them to continue running. I want to continue with main pr...
2016/01/27
[ "https://Stackoverflow.com/questions/35050073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2615853/" ]
fileFilter function has access to request object (req). This object is also available in your router. Therefore in fileFitler you can add property with validation error or validation error list (you can upload many files, and some of them could pass). And in router you check if property with errors exists. in filter:...
You can pass the error as the first parameter. ``` multer({ fileFilter: function (req, file, cb) { if (path.extname(file.originalname) !== '.pdf') { return cb(new Error('Only pdfs are allowed')) } cb(null, true) } }) ```
35,050,073
Lets assume I'm working with Python although it's not really relevant. I have a big array and I want to find whether element x is in the array. However, when one of the threads finds the element, I want that all other threads will stop, there is no point for them to continue running. I want to continue with main pr...
2016/01/27
[ "https://Stackoverflow.com/questions/35050073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2615853/" ]
fileFilter function has access to request object (req). This object is also available in your router. Therefore in fileFitler you can add property with validation error or validation error list (you can upload many files, and some of them could pass). And in router you check if property with errors exists. in filter:...
Change the `fileFilter` and pass an error to the `cb` function: ``` function fileFilter(req, file, cb){ if(file.mimetype !== 'image/png'){ return cb(new Error('Something went wrong'), false); } cb(null, true); }; ```
35,050,073
Lets assume I'm working with Python although it's not really relevant. I have a big array and I want to find whether element x is in the array. However, when one of the threads finds the element, I want that all other threads will stop, there is no point for them to continue running. I want to continue with main pr...
2016/01/27
[ "https://Stackoverflow.com/questions/35050073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2615853/" ]
fileFilter function has access to request object (req). This object is also available in your router. Therefore in fileFitler you can add property with validation error or validation error list (you can upload many files, and some of them could pass). And in router you check if property with errors exists. in filter:...
fileFilter callback should be: ``` fileFilter: async (req, file, cb) => { if (file.mimetype != 'image/png') { cb(new Error('goes wrong on the mimetype!'), false); } cb(null, true); } ``` Error handling in request: * access multer error using `MulterError` ``` const multer = require("multer"); ...
35,050,073
Lets assume I'm working with Python although it's not really relevant. I have a big array and I want to find whether element x is in the array. However, when one of the threads finds the element, I want that all other threads will stop, there is no point for them to continue running. I want to continue with main pr...
2016/01/27
[ "https://Stackoverflow.com/questions/35050073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2615853/" ]
You can pass the error as the first parameter. ``` multer({ fileFilter: function (req, file, cb) { if (path.extname(file.originalname) !== '.pdf') { return cb(new Error('Only pdfs are allowed')) } cb(null, true) } }) ```
fileFilter callback should be: ``` fileFilter: async (req, file, cb) => { if (file.mimetype != 'image/png') { cb(new Error('goes wrong on the mimetype!'), false); } cb(null, true); } ``` Error handling in request: * access multer error using `MulterError` ``` const multer = require("multer"); ...
35,050,073
Lets assume I'm working with Python although it's not really relevant. I have a big array and I want to find whether element x is in the array. However, when one of the threads finds the element, I want that all other threads will stop, there is no point for them to continue running. I want to continue with main pr...
2016/01/27
[ "https://Stackoverflow.com/questions/35050073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2615853/" ]
Change the `fileFilter` and pass an error to the `cb` function: ``` function fileFilter(req, file, cb){ if(file.mimetype !== 'image/png'){ return cb(new Error('Something went wrong'), false); } cb(null, true); }; ```
fileFilter callback should be: ``` fileFilter: async (req, file, cb) => { if (file.mimetype != 'image/png') { cb(new Error('goes wrong on the mimetype!'), false); } cb(null, true); } ``` Error handling in request: * access multer error using `MulterError` ``` const multer = require("multer"); ...
7,850,332
I have a column of data in SQL that is currently in the datetime format. It can be changed if needed. I need to show just the time of day, to the 10th of a second, with either AM or PM attached also. I do not want the date to be shown in this instance. So instead of '1900-01-01 11:45:59.800' as an example, i need '11...
2011/10/21
[ "https://Stackoverflow.com/questions/7850332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/789896/" ]
As in my comment, I'd advise you to not do this. SQL Server is a place for data, and converting the data for display purposes is often a blurring of the lines that can come back to haunt you. (One example; what if you need that time as a Time somewhere else in the future. Are you going to convert it back from a string...
Rename your table field, `Time` is a reserved word and it will be a pain to maintain. Make sure you are using the new `datetime2` data type if you want millisecond accuracy. To format the time part use: ``` SELECT CONVERT(TIME, [Time]) FROM [Your Table] ``` If you only want a three digits after the period you can u...
7,850,332
I have a column of data in SQL that is currently in the datetime format. It can be changed if needed. I need to show just the time of day, to the 10th of a second, with either AM or PM attached also. I do not want the date to be shown in this instance. So instead of '1900-01-01 11:45:59.800' as an example, i need '11...
2011/10/21
[ "https://Stackoverflow.com/questions/7850332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/789896/" ]
As in my comment, I'd advise you to not do this. SQL Server is a place for data, and converting the data for display purposes is often a blurring of the lines that can come back to haunt you. (One example; what if you need that time as a Time somewhere else in the future. Are you going to convert it back from a string...
I think this will work if you want to get in HH:MM format ``` SELECT RIGHT(CONVERT(VARCHAR(26), GETDATE(), 117), 14) ``` You can also refer to this page for more formats <http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36271.1570/html/blocks/X41864.htm>
7,850,332
I have a column of data in SQL that is currently in the datetime format. It can be changed if needed. I need to show just the time of day, to the 10th of a second, with either AM or PM attached also. I do not want the date to be shown in this instance. So instead of '1900-01-01 11:45:59.800' as an example, i need '11...
2011/10/21
[ "https://Stackoverflow.com/questions/7850332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/789896/" ]
Rename your table field, `Time` is a reserved word and it will be a pain to maintain. Make sure you are using the new `datetime2` data type if you want millisecond accuracy. To format the time part use: ``` SELECT CONVERT(TIME, [Time]) FROM [Your Table] ``` If you only want a three digits after the period you can u...
I think this will work if you want to get in HH:MM format ``` SELECT RIGHT(CONVERT(VARCHAR(26), GETDATE(), 117), 14) ``` You can also refer to this page for more formats <http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36271.1570/html/blocks/X41864.htm>
8,717
***EDIT*** I'm attempting to create a box with a different background color. However, I've tried this and the box looks unpolished. So I would like to add a line that seperates the two background colors. In other words, the point where the special background color begins and the original document background ends shoul...
2011/01/11
[ "https://tex.stackexchange.com/questions/8717", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/1733/" ]
A `\multicolumn` overwrites the **right** line setting of its cell(s) defined by the tabular header, except of the **first** cell, there it overwrites the right **and** left line setting. ``` \begin{tabular}{|l||c|c|c|c|c|c||r|}\hline \multicolumn{1}{|c||}{} & \multicolumn{3}{c|}{Model 1} & \multicolumn{3}{c||}{Model...
One way to solve your problem is to change some of your code as the following lines. ``` \multicolumn{1}{|c||}{} & \multicolumn{3}{c|}{Model 1} & \multicolumn{3}{c||}{Model 2} & \\ ``` and ``` \multicolumn{1}{c||}{(c)} & \multicolumn{1}{r|}{diff}\\\hline ```
8,717
***EDIT*** I'm attempting to create a box with a different background color. However, I've tried this and the box looks unpolished. So I would like to add a line that seperates the two background colors. In other words, the point where the special background color begins and the original document background ends shoul...
2011/01/11
[ "https://tex.stackexchange.com/questions/8717", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/1733/" ]
This is not an answer to your question (others did that). However, I think you can make a better looking table by following the advice in the booktabs package. ``` \documentclass{article} \usepackage{booktabs} \begin{document} \begin{tabular}{lccccccc} \toprule &\multicolumn{3}{c}{Model 1}&\multicolumn{3}{c}{Model 2}&...
One way to solve your problem is to change some of your code as the following lines. ``` \multicolumn{1}{|c||}{} & \multicolumn{3}{c|}{Model 1} & \multicolumn{3}{c||}{Model 2} & \\ ``` and ``` \multicolumn{1}{c||}{(c)} & \multicolumn{1}{r|}{diff}\\\hline ```
7,742,556
In my database, the times are stored as "datetimes" (I don't know if this is the issue or not- I tried both datetime and timestamp). The structure looks like: ``` ID | START_DATE | END_DATE 1 | 2011-10-10 08:15:00 | 2011-10-10 12:00:00 2 | 2011-10-11 09:00:00 | 2011-10-11 14:30:00 3 | 2011-10-12 08:45:00 |...
2011/10/12
[ "https://Stackoverflow.com/questions/7742556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/971230/" ]
You cannot sum datetime values - you need to convert to seconds first .... ``` SELECT SUm(time_to_sec(TIMEDIFF(end_date, start_date))) AS timesum FROM schedules ```
You need to convert your `TIMEDIFF` to seconds using the `TIME_TO_SEC` function to correctly get the sum in terms of seconds: ``` $times = mysql_query("SELECT SUM(TIME_TO_SEC(TIMEDIFF(end_date, start_date))) AS timesum FROM schedules") ``` Without explicitly converting to seconds with `TIME_TO_SEC` the `SUM...
104,609
Products Preparation Tool does not progress past the "Configuring Application Server Role, Web Server (IIS) Role" stage. After days searching for a fix and finding nothing that will work I am wondering if banging my head should stop and I should install SP2010 instead. I am installing SP2013 on a VMware instance of W...
2014/06/23
[ "https://sharepoint.stackexchange.com/questions/104609", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/29930/" ]
I tried a lot of solutions that I read about online but the only thing that solved my problem was this one. `Go to the file C:\windows\System32\ServerManager.exe`, copy it and rename the copy to `ServerManagerCMD.exe`. Run the Preparation tool again and the problem is gone. That simple!
this is known issue, as mentioned in this [KB article](http://support.microsoft.com/kb/2765260). they mentioned two method to fix the issue. **Method 1:** Install the hotfix that is described in Microsoft Knowledge Base (KB) article 2771431. For more information about hotfix 2771431, click the following article numb...
63,700,826
SQL Query taking too much time to execute. Working fine at UAT. I need to compare data of two tables and want to get difference. Below mention is my query. ``` Select * from tblBrandDetailUsers tbdu inner join tblBrands tbs on tbs.BrandId = tbdu.BrandId left join tblBrandDetails tbd on tbd.CategoryId = tbdu.CategoryI...
2020/09/02
[ "https://Stackoverflow.com/questions/63700826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14207128/" ]
a number of things you need to check: 1. number of rows for each table. the more rows you have the slower it gets. Do you have the same size of data with UAT? 2. `SELECT *` : avoid the `*` and only retrieve columns you need. 3. `ISNULL` function on left side of the `WHERE` predicate will scan the index because it is [...
Every advises in comment looks right. The difference between UAT and Prod should be the volume of data. Your issue should come of lack or inefficient indices. You should add compound index on ``` tblBrandDetails.CategoryId,tblBrandDetails.BrandId, tblBrandDetails.CityId ``` and on ``` tblBrandDetailUsers.CategoryId...
63,700,826
SQL Query taking too much time to execute. Working fine at UAT. I need to compare data of two tables and want to get difference. Below mention is my query. ``` Select * from tblBrandDetailUsers tbdu inner join tblBrands tbs on tbs.BrandId = tbdu.BrandId left join tblBrandDetails tbd on tbd.CategoryId = tbdu.CategoryI...
2020/09/02
[ "https://Stackoverflow.com/questions/63700826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14207128/" ]
a number of things you need to check: 1. number of rows for each table. the more rows you have the slower it gets. Do you have the same size of data with UAT? 2. `SELECT *` : avoid the `*` and only retrieve columns you need. 3. `ISNULL` function on left side of the `WHERE` predicate will scan the index because it is [...
Rewrite your query like this : ``` Select *--> AVOID "*" put all the necessary columns from tblBrandDetailUsers AS tbdu inner join tblBrands AS tbs on tbs.BrandId = tbdu.BrandId left join tblBrandDetails AS tbd on tbd.CategoryId = tbdu.CategoryId and tbd.BrandId = ...