qid
int64
10
74.7M
question
stringlengths
15
26.2k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
27
28.1k
response_k
stringlengths
23
26.8k
21,734,677
I have a code like this: ```js <select id='chapter'> <option onclick="return my_function('1')" value='1'>1</option> <option onclick="return my_function('2')" value='2'>2</option> <option onclick="return my_function('3')" value='3'>1</option> </select> ``` When user click on select it ...
2014/02/12
[ "https://Stackoverflow.com/questions/21734677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1489083/" ]
Here is a standard SQL way of doing this: ``` delete from t where Id1 > Id2 and exists (select 1 from t t2 where t2.Id1 = t.Id2 and t2.Id2 = t.Id1 and t2.Name1 = t.Name2 and t2.Name2 = t.Name1 and ...
You could use an `INNER JOIN` to pair up any rows with transposed `Id1` and `Id2` values, filter down to those that are actually duplicates, select all but one of the duplicate rows, and then send the results to a `DELETE`. ``` DELETE T1 FROM [TableName] T1 -- Pair up the duplicate rows INNER JOIN [TableName] T2 O...
10,552,446
I am adding the following codes to add a footer with a button to perform an action. i am not able to re-size the button to the size of the cell. The change in the CGRectMake(0, 0, 300,44) value is not affecting the change of the footer appears can any one help me. I am using a table having more session. i don't want a ...
2012/05/11
[ "https://Stackoverflow.com/questions/10552446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1063216/" ]
You Don't need to add a button to uitableview , instead add it to the footer of the tableview for which you will have to pass a view to the delegate method of tableview :- ``` - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section ``` You may read this [tutorial](http://blog.blackwh...
use this way for footer of tableview ``` self.tableView.tableFooterView = myCustomFooterView ``` and for footer view of whole table,use ``` - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section ``` and read more about it here <http://developer.apple.com/library/ios/#documentati...
885,906
I have a switch `D-Link DGS-1210` with 52 ports. There is a device connected to the switch that shall be updated. The update requires a TFTP transfer between my PC and the device. Unfortunately the switch drops the UDP packet to port 69 that should initiate the transfer. All other UDP packets go through. I have monito...
2015/03/05
[ "https://superuser.com/questions/885906", "https://superuser.com", "https://superuser.com/users/45542/" ]
If you'd like to consider alternatives, [Dropbox supports differential file sync](https://www.dropbox.com/en/help/8) on their desktop and web clients. Alternatively, if you are so inclined, you could achieve this yourself by using [xdelta](http://xdelta.org/). `xdelta` creates binary diff files. You could upload the h...
As of [2012](https://superuser.com/questions/652483/cloud-backup-for-large-truecrypt-container), Google Drive apparently still did not support differential file sync. If that's still the case, Google would sync the entire 15 GB file every time it changes. It sounds like you're using Outlook to back up your Google Apps...
3,227,870
By "common script startup sequence", what I mean is that in the majority of pages on my site, the first order of business is to consult 3 specific files (via `include()`), which centrally define constants, certain functions used in many scripts, and a class or two, as well as providing the database credentials. I don't...
2010/07/12
[ "https://Stackoverflow.com/questions/3227870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340819/" ]
Use [`APC`](http://php.net/manual/en/book.apc.php) and your worries go away. The [**opcode**](http://en.wikipedia.org/wiki/Opcode) of your files will be **cached in the RAM** and everything will go **super fast**. :) [Facebook does this](http://www.scribd.com/doc/88689/ApcFacebook) so it'll definitely help you to **sca...
Or if you by any chance using Windows as OS, you can use [WinCache](http://www.iis.net/download/wincacheforphp). <http://php.net/manual/en/book.wincache.php>
37,377,310
I have a node mongo app. Now I want to show audit trail for some specific crud events which are happening in the application. What would be the best approach for solving this problem ? I have considered of creating a new collection and service which would be called in each method in node app for logging the operation...
2016/05/22
[ "https://Stackoverflow.com/questions/37377310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4646909/" ]
It's better to use a different schema having all the logs that you want to store for particular actions. ``` // schema var schema = new Schema({ actionType: {type: String, require: true}, userId: { type: Schema.Types.ObjectId, required: true }, userType: { type: String, required: true }, message: { typ...
you can add a middleware to you app which adds a [bunyan](https://github.com/trentm/node-bunyan) child logger to each request with some unique id (probably `uuid`) here is some sample code to attach a logger to each request with unique id, whenever you will print something using this logger, this uuid will also be pri...
32,304,067
I've been through the introductory tutorial for Django successfully using SQLite as per the instructions. However, for my real project I want to use MySQL, so I deleted the tutorial project files and started with a fresh setup. The trouble is that when I run "python manage.py migrate" I get the following MySQL error: ...
2015/08/31
[ "https://Stackoverflow.com/questions/32304067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/859023/" ]
As I said in my comment above, I found the page which had instructed me on how to install drivers. It is this one: <https://www.pythonanywhere.com/wiki/UsingMySQL> However, this Wiki page is a little dated now and it instructed me to install the MySQL connector version 2.0.1. The current version is now 2.0.4. The old...
i have try this,and works... ``` DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'database', 'USER': 'vocabulator', 'PASSWORD': '<password>', 'HOST': 'mysql.server', } } ```
44,271,263
I'm creating a layout for a newsletter. Usually this has to be pretty static but I'm using the Mailchimp guideline to achieve some responsiveness. It works well but the problem is that I would like the second image to come before the text (the problem is very obvious in the example link, it's hard to explain). Basicall...
2017/05/30
[ "https://Stackoverflow.com/questions/44271263", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6738021/" ]
What you need my son is direction in life. You can apply the css property `direction` to swap the order of the table cells. `Direction` can be applied to text or inline-block elements. You can apply it different ways. ``` <row dir="rtl"> <td dir="rtl"> .main-content {direction: rtl; /* Right to Left */} ``` This ...
This is what you are after. I have taken one table of yours and given an example of how column swapping can be done. You will need to keep both the elements together for it to work. The method used here is called hybrid. Both columns are created using div's which is encased in a td ``` <td valign="top" bgcolor="#FFFF...
52,473,299
I'm trying add this transaction named `placeOrder` i want to add a `Customer` participant before creating `Order` asset and map its relationship with the `Order` asset while processing this transaction. But I'm getting customer not defined error. Can anybody help? Thanks. My models ``` namespace org.isn.customer pa...
2018/09/24
[ "https://Stackoverflow.com/questions/52473299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10341923/" ]
* Go to "->About This Mac". * Click on "System Report" and select "USB". * Find your phone and the "Serial Number" field is what you are after. * Copy this value and paste it into the developer portal when you register a new device; you will need to insert a - after the 8th digit. You can also get the "identifier" fr...
1.Connect iPhone to Mac 2.Go to About This Mac 3.Click on "System Report" and select "USB" from left panel. 4.Find your iphone and look for the "Serial Number" field. This is what you need. 5.Copy this "Serial Number" and register the device in the developer portal. Make sure developer portal recognizes the device ...
18,824,598
I have a form in Struts 1.2 where I have text boxes (text box created using struts html tag) . I have retrieved the values for this text box from data base and then put in session attribute (`session.setAttribute("UserInfo",userinfoobj)`) now I wants to get values from session attribute and set this value as value of t...
2013/09/16
[ "https://Stackoverflow.com/questions/18824598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2572688/" ]
You didn't provide full information, but this is the most likely scenario: By the time the store has loaded, `items` is no longer an array of configuration options, because the container has already processed them. Instead, you need to call `me.add()`, since items is now a MixedCollection and the configuration process...
You could try it like this: ``` var items = []; var arrayVals = []; var self = this; me.getUserCompanyLogStore().load({ callback: function (records, operation, success) { success: { Ext.Array.each(records, function (record, index, array) { arrayVals.push(record.get("company")); }); Ext....
24,848,332
I want to have a dictionary of events, so far I have ``` private Dictionary<T, event Action> dictionaryOfEvents; ``` is it possible to do something like this?
2014/07/20
[ "https://Stackoverflow.com/questions/24848332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/313586/" ]
You can't have dictionary of events, though you can have dictionary of delegates. ``` private Dictionary<int, YourDelegate> delegates = new Dictionary<int, YourDelegate>(); ``` where `YourDelegate` can be any delegate type.
You can't directly define a dictionary of event types but you can define the event inside a class instead. ``` private Dictionary<string, MyEventManager> dictionaryOfEvents; dictionaryOfEvents["key1"].CallMyEvent(); ``` Example implementation of MyEventManager Class : ``` public class MyEventManager { public e...
8,559,904
Is it possible to display complex HTML content inside TextView ? My HTML is going to have images and video tags. Is that possible or to use WebView component or there is some simpoler solution ?
2011/12/19
[ "https://Stackoverflow.com/questions/8559904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/486578/" ]
If you want to use **HTML tags for TextViews, you have to use android.text.Html class, fromHtml()**.. From **Mark Murphy's** Technical Stuff... **HTML Tags Supported By TextView** More importantly, it means that you cannot rely on what it will support from release to release. ``` * <a href="..."> * <b> * <big> * <...
The best way is to use `WebView` for complex `HTML` content, use `HTML` content in `TextView` only to give your text view a custom style
38,892,806
I have problem. I created a web page with upload files, I have database (MySQL) with correctly URL to file (file path) (in database is only url to the file, file is in folder on the server). And now I trying write/search php script to download this file what was uploaded. All at web works well, but this download script...
2016/08/11
[ "https://Stackoverflow.com/questions/38892806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6704007/" ]
Simple solution: In file *app.module.ts* - ### Example 1 ``` import {FormsModule} from "@angular/forms"; // Add in imports imports: [ BrowserModule, FormsModule ], ``` ### Example 2 If you want to use [(ngModel)] then you have to import FormsModule in *app.module.ts*: ``` import { FormsModule } from "@angula...
Sometimes you get this error when you try to use a component from a module, which is not shared, in a different module. For example, you have 2 modules with module1.componentA.component.ts and module2.componentC.component.ts and you try to use the selector from module1.componentA.component.ts in a template inside modu...
42,440,860
I have a User-Role Many-To-Many-Relationship in my MySQL database. Therefore I have a mapping-table which connects the IDs of both tables. The **mapping-table** looks like that: ``` ID of User | ID of Role ---------- | ---------- 1 | 1 1 | 2 2 | 1 2 | 3 ``` **user-table:** ``` Fi...
2017/02/24
[ "https://Stackoverflow.com/questions/42440860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7593672/" ]
It's true that this question has many possible answers. This is probably the most lame one, but it works quite ok actually: 1. Add an additional column; 2. Then put random value in this column; 3. Sort by this column - that's exactly what you want! 4. Delete the additional column, so the trick is no visible! 5. Voila!...
This is my solution: First I have created a function to generate random numbers between a and b without repeated values: jlqmoreno@gmail.com Julio Jesus Luna Moreno ``` Option Base 1 Public Function u(a As Variant, b As Variant) As Variant Application.Volatile Dim k%, p As Double, flag As Boolean, x() As Variant ...
23,317
I am still very new to learning guitar (specifically, Classical fingerstyle). While this is the first time I am doing this "seriously", I HAVE tried to learn guitar before, just very badly (and usually with crappy instruments that have been handed down and mistreated by family). I am currently using a tuner app on my p...
2014/09/04
[ "https://music.stackexchange.com/questions/23317", "https://music.stackexchange.com", "https://music.stackexchange.com/users/12067/" ]
Plucking a string increases its tension momentarily. This tension drops rapidly as the vibration dies out. This causes the pitch to drop slightly as the string vibrates. It's an inherent limitation of plucked string instruments but it's OK, it's part of the sound we know and love. Also, unlike the ideal mathematical m...
The fact you have picked up on this shows you have a good ear, here are some tips to make your guitar ring like an angel :) **Make sure you have a good tuner that is accurate**, (doesn't have to be expensive). Read plenty of reviews on it don't just go buy one. **Always tune turning up**, if you overshoot go back and...
2,677,313
I guess this is simple, but i couldnot figure it out. i have a dropdown list with values ``` America Asia Europe ``` I need to the display the ddl as Select Type and when i click the dropdownlist to see the values in it, it should display the three values, but i should not use Select Type as a list item and it sho...
2010/04/20
[ "https://Stackoverflow.com/questions/2677313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/305196/" ]
Windows Forms? If you populate your combobox like this: ``` this.comboBox1.Items.Add("Select..."); this.comboBox1.Items.Add("America"); this.comboBox1.Items.Add("Asia"); this.comboBox1.Items.Add("Yurrup"); ``` Then, attach a DropDown event, to remove the first option on first drop ...
I would add the ListItem to the list with its text set to "Select Type" and its value set to an empty string. In the code behind when you're handling the list, you would programmatically handle the possibility of an empty string selected value. So given ``` ddl.Items.Add(new ListItem("Select Type", string.Empty)); dd...
65,557
Is there a technical reason why Android phones general lag a lot behind the stable released version of Android? This applies to both new phones, for example a recent trip to the phone shop everything was 4.0 to 4.2.1, KitKat could not be seen. And also old phones, my girlfriend's iPhone 4 had an OTA update to the lat...
2014/03/16
[ "https://android.stackexchange.com/questions/65557", "https://android.stackexchange.com", "https://android.stackexchange.com/users/56268/" ]
This is a 2-part question. Part 1 asks why Android phones do not get the newest update right away, and has been answered adequately by the other answers. Part 2 asks why older phones often never get the newest update, and has not been answered yet. As LeBeau says, there are other corporate stakeholders besides Google....
In addition to the incredibly long HTC infographic in [Mpeti's answer](https://android.stackexchange.com/a/65587/156), other manufacturers have come out and said why their updates lag behind official Google releases, and why they don't release updates for older models: **Sony Mobile**: [Ice Cream Sandwich – from sourc...
21,697,949
``` Exception in thread "JavaFX Application Thread" java.lang.NullPointerException at com.sun.javafx.scene.control.skin.NestedTableColum nHeader.dispose(NestedTableColumnHeader.java:323) at com.sun.javafx.scene.control.skin.NestedTableColum nHeader.updateTableColumnHeaders(NestedTableColumn Header.java:265) at com.sun....
2014/02/11
[ "https://Stackoverflow.com/questions/21697949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3082679/" ]
I had misunderstood the problem and have changed the solution to fix it: ``` $(".dropdown-menu > li > a").click( function (e) { e.preventDefault(); $(this).parent().parent().prev().text($(this).text()); }) ``` You could use one of the button classes or even the button html tag to address the change but by usin...
Try this instead **HTML**: ``` <div class="btn-group"> <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"> Content <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu"> <li><a href=# onclick=javascript:xxxx>Speed 1</a></li> <li><a href=#>Spee...
753,964
I currently RDP to my home PC using a secure SSH tunnel. It works well but I would like to try to set up a VPN. My understanding is that if I connect to the VPN from a remote PC, all the traffic of that PC will go through my home network (including Internet). Is that correct? If it is the case, is there a way to limit...
2014/05/15
[ "https://superuser.com/questions/753964", "https://superuser.com", "https://superuser.com/users/59672/" ]
If you know in advance the commands you need to run, you can just do ``` cp file1 file2; cp file3 file4 ``` If you have already started the first command, and you are in the same shell, you can hit `Ctrl`+`Z`, then [`bg`](http://www.gnu.org/software/bash/manual/html_node/Job-Control-Builtins.html#index-bg) to put th...
``` cp largefile1 somedestination ``` ...time...passes... ``` wait $(pidof cp) cp largefile2 someplace ``` The bash builtin wait, will pause until the job/process specified (or all jobs if unspecified) has completed before continuing.
27,498,681
i have to read from the following format. ``` 1 12 23 34 ``` So, All inputs are separated by a line. I have tried the following ``` br = new Scanner(System.in); num = Integer.parseInt(br.next()); while(br.hasNextInt()) { num = br.nextInt() ; System.out.println(num); } ``` But it ...
2014/12/16
[ "https://Stackoverflow.com/questions/27498681", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2694184/" ]
Try ``br = new Scanner(System.in);` while (true) { int num = Integer.parseInt(br.nextLine()); System.out.println(num); }`
``` br = new BufferedReader(new InputStreamReader(System.in)); int ch; while ((ch = br.read()) != -1) { if (ch == 10) { System.out.println(); } } ```
14,425,063
I'm trying to make a gridview because thats better for more devices. I already tried to add my buttons in the interface builder (as ImageViews because I've added them as ImageButtons the size wasn't good) and the result of that is in this screen: <http://i.imgur.com/pTJnKOv.png> Can anyone help me by making this in a ...
2013/01/20
[ "https://Stackoverflow.com/questions/14425063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1923618/" ]
Since you are trying to use a **2X2 Grid** and have only 4 elements, use **`android:numColumns="2"`** as an attribute of your GridView. Additionally, there is this excellent [tutorial on GridViews](http://www.mkyong.com/android/android-gridview-example/)! Code snippet to implement only Images in your Grid : ``` pub...
To get fixed sizes you can add android:layout\_height="" android:layout\_width="" example : android:layout\_height="100dp" android:layout\_width="200dp" in your button tags
9,780,792
I have a `ListView` with `fastScrollAlwaysVisible` and `fastScrollEnabled` both set to `true`. After implementing `SectionIndexer` to my `Adapter` and an `AlphabetIndexer`, my `fast scroll thumb` will disappear while I scroll, then reappear once I reach the top or bottom of the list. I'm pretty clueless about why this ...
2012/03/20
[ "https://Stackoverflow.com/questions/9780792", "https://Stackoverflow.com", "https://Stackoverflow.com/users/420015/" ]
I had similar issue with fast scroller's thumb icon. I was investigating Android source code and found a commit which introduced this problem and other (ArrayIndexOutOfBoundsException). I built even Android system without this commit and it worked then. I submitted the issue in June: <https://code.google.com/p/android...
Do you have both `fastScrollEnabled` and [`fastScrollAlwaysVisible`](http://developer.android.com/reference/android/widget/AbsListView.html#setFastScrollAlwaysVisible%28boolean%29) set to `true`? There is no `fastScrollAlwaysEnabled` attribute of a `ListView`, so I'm thinking maybe you just have `fastScrollEnabled` set...
147,175
In Book V of *The Return of the King,* in "The Black Gate Opens," as the Captains approach the Gate, Tolkien makes this statement (phrase in question bolded by me): > > North amid their noisome pits lay the first of the great heaps and hills of slag and broken rock and blasted earth, the vomit of **the maggot-folk of...
2016/12/12
[ "https://scifi.stackexchange.com/questions/147175", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/31437/" ]
Probably orcs ------------- "Maggots" suggest creatures that are small, which would rule out Trolls and the large Uruks of Mordor. The closest I can come to a quote that answers your question is when Frodo and Sam approach the Black Gate. > > Across the mouth of the pass, from cliff to cliff, the Dark Lord had buil...
I would say maggot-folk of Mordor are Uruk-hai. As written on [LOTR wiki](http://lotr.wikia.com/wiki/Uruk-hai) > > The Uruks first appeared about the year TA 2475, when they conquered > Ithilien and destroyed the city of Osgiliath. The Uruks in the service > of Barad-dûr, **the folk of Mordor**, used the symbol of ...
28,878,724
I am developing a python module. My module needs getting data from database various times. I am writing a data-layer class with sole motive of writing all the functions which hits DB at same place and calling these data-layer class methods from different method of my module. I tried below code: ``` class datalayer: ...
2015/03/05
[ "https://Stackoverflow.com/questions/28878724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1678247/" ]
datalayer.py ``` datalayerInstance = datalayer(); def get_datalayerinstance(): return datalayerInstance ``` example.py ``` import datalayer datalayerInstance = get_datalayerinstance(); ```
What you want is a singleton. To do this you could override `__new__` so that everytime you have a new `datalayer` object created, it uses the same cursor. ``` class datalayer(object): _cur = None; #Cursor which would be used by all methods def __new__(cls, *args, **kwargs): if not cls._cur: ...
346,445
I've been banging my head against for wall for a while with this one. I want to SSH into a set of machines and check whether they are available (accepting connections and not being used). I have created a small script, tssh, which does just that: ``` #!/bin/bash host=$1 timeout=${2:-1} ssh -qo "ConnectTimeout $time...
2008/12/06
[ "https://Stackoverflow.com/questions/346445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
In the construct ``` something | while read x; do ssh ... done ``` the standard input as seen by the while loop is the output of `something`. The default behavior of `ssh` is to read standard input. This allows you to do things like ``` cat id_rsa.pub | ssh new_box "cat - >> ~/.ssh/authorized_keys" ``` No...
Most of the answers are specific to ssh. Other commands also hijack stdin and do not have a -n option. This should address any other commands. This should also work for ssh. ``` while read x; do # Make sure command does not hijack stdin echo "" | command $x done < /path/to/some/file ```
606,726
I.e., if I flipped five non-absolute values, then averaged them, then got the absolute value as the result, and I did that infinite times, what would be the average value of the result? What mathematical method would I use to calculate this? I've only taken up to precalculus and I anticipate that calculating this woul...
2023/02/26
[ "https://stats.stackexchange.com/questions/606726", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/380919/" ]
There are 32 different equally probable outcomes of 5 throws, of which two have absolute value of sum of throws equal to 5, 10 have 3, and 20 have 1, so total sum of all these cases is $5\times2 + 3\times10 + 1\times20 = 60$. To get average, we need to devide 60 by number of total cases which is 32. $\frac{60}{32} = \f...
I get zero by two methods, a Mathematica simulation, and a counting argument. Mathematica simulation: ``` results = {}; results2={}; Module[{n = 10000000, outer, inner}, AbsoluteTiming[ For[k = 1, k <= 5, ++k, sum1 = 0; For[outer = 1, outer <= n, ++outer, sum2 = 0; For[inner = 1, inner <= 5, ++inner, ...
11,373,083
How can I change my C# code below to list all possible permutations without repetitions? For example: The result of 2 dice rolls would produce 1,1,2 so that means 2,1,1 should not appear. Below is my code: ``` string[] Permutate(int input) { string[] dice; int numberOfDice = input; const int ...
2012/07/07
[ "https://Stackoverflow.com/questions/11373083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1417178/" ]
I have written a class to handle common functions for working with the binomial coefficient, which is the type of problem that your problem falls under. It performs the following tasks: 1. Outputs all the K-indexes in a nice format for any N choose K to a file. The K-indexes can be substituted with more descriptive st...
Here is generic c# version using recursion (basically the recursive method takes number of dices or number of times the dice has been tossed) and returns all the combinations strings ( for ex, for '3' as per the question - there will be 56 such combinations). ``` public string[] GetDiceCombinations(int noOfDicesOrnoOf...
33,871
If I recall correctly, karma is constituted of two parts - action and intention. Which means if one wishes to "gain" positive karma, one would have to conduct a positive action AND do so with a positive mind. With that being said, if I were to help an old lady to cross the street for the sole purpose of obtaining good ...
2019/07/05
[ "https://buddhism.stackexchange.com/questions/33871", "https://buddhism.stackexchange.com", "https://buddhism.stackexchange.com/users/15203/" ]
This is a triple win in term of accumulating and strengthening the effectiveness of the karmic action: 1. Being nice 2. Knowing being nice has consequences 3. Acting knowing there are consequences When doing good, believing in Karma and knowing there are consequences, reinforce the good results.
Karma is how this world behaves. As an example in general how world behave is ; if we change the state of a weight (put a stone from the ground on the table) to a more unstable position (being on the table is more unstable than being on the ground) what would happen? Once its got a chance it comes to a stable position ...
65,429,426
I'm trying to take the content of the `<p>` tag then change it to a number and multiply it by 2000 then returning it to the `<p>` (this works after I press a select tag that changes the currency from USD to LBP by multiplying the number with 2000) ps: it's a project for my class : **HTML:** ``` <div class="card"> ...
2020/12/23
[ "https://Stackoverflow.com/questions/65429426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14879696/" ]
First get the distinct combinations of `order_no` and `invoice_total` and then aggregate: ``` SELECT SUM(invoice_total) AS invoicetotal FROM ( SELECT DISTINCT order_no, invoice_total FROM p_orders WHERE plain_date='2020-12-23' AND o_status='Delivered' ) t ```
Your data is poorly structured; you really should have another table where order\_no is the primary key and keep invoice\_total in that. As is, you could have different invoice\_total values for the same order\_no; you need to decide which to use in that case. If you wanted to use the maximum, you would do: ``` SELECT...
101,230
I’m using a MacBook Pro and I broke it a while back. So, the keyboard doesn’t work on the laptop. I hooked up a keyboard to the USB port so I can still use it. I’m using a Dell keyboard. Last night I wanted to listen to music without the brightness of the screen. So without thinking I turned the brightness off. Now I ...
2013/09/08
[ "https://apple.stackexchange.com/questions/101230", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/56687/" ]
key: "**scroll lock**" to decrease brightness key: "**pause**" to increase brightness
You can also use Apple Script - if you can ssh into your mac, you can then, in the ssh session, type the following: ``` osascript -e 'tell application "System Events" key code 113 end tell' ``` Please note, that you actually need to press Enter at the end of each line. Also, be careful with the quote characters - t...
58,181,578
Consider the following column vector: ``` vec <- rbind(c(0.5),c(0.6)) ``` I want to convert it into the following 4x4 diagonal matrix: ``` 0.5 0 0 0 0 0.6 0 0 0 0 0.5 0 0 0 0 0.6 ``` I know I can do it by the following code: ``` dia <- diag(c(vec,vec)) ``` But what if I want to co...
2019/10/01
[ "https://Stackoverflow.com/questions/58181578", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12073743/" ]
Here is one other way using recycling: ``` diag(c(vec), length(vec)*2) ```
I think your approach is already good enough, here is another way by initialising the matrix and using `rep` to fill diagonals. ``` n <- 4 mat <- matrix(0, ncol = n, nrow = n) diag(mat) <- rep(vec, n/2) mat # [,1] [,2] [,3] [,4] #[1,] 0.5 0.0 0.0 0.0 #[2,] 0.0 0.6 0.0 0.0 #[3,] 0.0 0.0 0.5 0.0 #[4,] ...
256,274
I'm a C noob and I'm learning about concurrency using C. I came across an exercise in a [book](https://rads.stackoverflow.com/amzn/click/com/B00EKZ123U) asking me to find the approximate value of Pi using the Monte Carlo technique with OpenMP. I came up with the following: ``` #include <stdio.h> #include <stdlib.h> #i...
2021/02/20
[ "https://codereview.stackexchange.com/questions/256274", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/168876/" ]
This code has a serious problem due to (at least the typical implementation of) `rand()`. `rand()` normally has a (hidden) seed value, and each call to `rand()` modifies the seed. At least in most implementations, that means `rand` always forces serialization. That means, calling `rand()` (a couple of times) in your in...
I think you're over-complicating this. You can let OpenMP divide the work between the threads for you, using `#pragma openmp parallel for`. You can use a reduction for `in_circle` instead of a critical section - that allows OpenMP to sum into a per-thread variable, and add them all at the end, reducing contention for ...
1,776,944
I would like to create an interface for manipulating invoices in a transaction-like manner. The database consists of an invoices table, which holds billing information, and an invoice\_lines table, which holds line items for the invoices. The website is a set of scripts which allow the addition, modification, and remo...
2009/11/21
[ "https://Stackoverflow.com/questions/1776944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2581/" ]
you don't want to have long running transactions, because that'll limit concurrency. <http://en.wikipedia.org/wiki/Command_pattern>
The translation on the web for this type of processing is the use of session data or data stored in the page itself. Typically what is done is that after each web page is completed the data is stored in the session (or in the page itself) and at the point in which all of the pages have been completed (via data entry) a...
6,475,815
**UPDATE** It seems to have magically corrected itself because now it works, but I emphasize that it wasn't a cache issue because even I was able to update with new images but they always appeared "below" rather than "next to"... I don't understand...but suddenly it worked now. if you check [www.dodomainer.com](http:/...
2011/06/25
[ "https://Stackoverflow.com/questions/6475815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/577455/" ]
There is no problem to be fixed here. Your code should work in all browsers. I checked in IE, FF, Opera (all latest though). All good. There are just 2 child divs with float:left.
Michael, i feel like you may have an overflow issue here regarding your padding and the various methods browsers compute the box model. Header A has a width of 400 but an image within of 400+the padding. Remove the padding or resize it's container to actually contain it. Other option is to set overflow to hidden
71,893,079
I've been following a tutorial on youtube for flutter. <https://www.youtube.com/watch?v=Zv5T2C1oKus>. I'm new to flutter and dart btw. I don't understand this error message. > > lib/main.dart:91:36: Error: The value 'null' can't be assigned to the > parameter type 'Offset' because 'Offset' is not nullable. > > > * ...
2022/04/16
[ "https://Stackoverflow.com/questions/71893079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14872021/" ]
In the video you linked, there is a check whether `points[x]` is `null`, so I assume the elements of `points` should be nullable. You can achieve this with ``` List<Offset?> points = []; ``` (instead of `List<Offset> points = [];`). The added questionmark makes it possible for elements of the list to be either a ins...
The points is non-nullable list. So this time, it can be solved with to remove **points.add(null);** inside onPanEnd. (Or add non-null Offset.)
68,987,980
I've written a problem for an algorithm problem. I'm new to C++, and I'm getting the following error message when I try to run my code: "array initializer must be an initializer list". Here's the code itself: ``` #include <iostream> #include <algorithm> #include <array> using namespace std; int main(){ int n; ...
2021/08/30
[ "https://Stackoverflow.com/questions/68987980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15306169/" ]
> > > ``` > cin>>n; > int a[n][2]; > > ``` > > The size of an array variable must be compile time constant. `n` is not compile time constant. The program is ill-formed. > > What alternative do I have? > > > If you want a runtime size array, then you must create the array in dynamic storage. Simplest approac...
If you want to create an array, the size must be **constant number** or you should use **vector** instead. In addition, compiler says you have to assign your array to 0 with curly brackets like that: ``` int a[5][2]={{0}}; int b[5]={0}; ```
440,533
I read that all you need to start an induction motor is to apply the AC voltage, and with time the slippage decreases. How does this happen magnetically? If a rotor, connected to a moderate sized mass, is stationary at t=0, and you apply a quickly rotating magnetic field, then the stator will spend half of its AC cycl...
2019/05/26
[ "https://electronics.stackexchange.com/questions/440533", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/71001/" ]
You're absolutely right that a rotor inside a magnet on a single-phase circuit won't start moving on its own. The key to getting it started is having a **rotating magnetic field**. The field of a magnet in a single-phase circuit doesn't rotate; it just switches polarity. Once the rotor is turning that's all it needs, b...
You were right if you talked about single-phase induction motors with no additional provisions. Such induction motors are rare for that very reason. You can find them as electrical brakes for example, because that starting problem doesn't apply then. If you insisted on single-phase and single-coil (well, sort of), you...
2,960,515
Is it possible to echo something while the script for example is still running in a loop? my problem: I ask the server with Ajax and then the server is fetching mails and store them in Database. This took around 15 sec. During that Time the Server should echo his progress so that the Javascript can update a loading ba...
2010/06/02
[ "https://Stackoverflow.com/questions/2960515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/334501/" ]
On many processors address zero is the reset vector, wherein lies the bootrom (BIOS on a PC), so you are unlikely to be storing anything at that physical address. On a processor with an MMU and a supporting OS, the physical and logical address addresses need not be the same, and the address zero may not be a valid logi...
You are correct in noting that the address space at 0 is not usable storate for your program. For a number of reasons a variety of systems do not consider this a valid address space for your program anyway. Allowing any valid address to be used would require a null value flag for all pointers. This would exceed the ov...
47,833,675
I've created an android app that calculates the factorial of an input number. My code is: ``` void factorial(int x){ if(x>=0){ BigInteger res= new BigInteger("1"); for(int i=x; i>1; i--){ res = res.multiply(BigInteger.valueOf(i)); } TextView text = (TextView)findViewByI...
2017/12/15
[ "https://Stackoverflow.com/questions/47833675", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6906418/" ]
Try this: ``` private class FactCalculator extends AsyncTask<Void, Void, BigInteger> { int number = 0; public FactCalculator(int i) { this.number =i; } @Override protected BigInteger doInBackground(final Void... params){ try{ if(number>=0) { BigInteger ...
Calculating factorials lead to very big numbers very fast. The factorial of 100 is 9.332621544 E+157. Your factorial is 3.097722251 E+357506! Although BigInteger theoretically has no limitations, I will suggest you to read the answer in [this question](https://stackoverflow.com/questions/12088436/what-does-biginteger-h...
5,437,164
I have an ArrayCollection derived from a httpService call where the XML looks like the following: > > > ``` > <data> > <label>John</label><height>5.5</height> > <label>John</label><height>7.2</height> > <label>John</label><height>3.2</height> > </data> > > ``` > > I know how to use Math.min and Math....
2011/03/25
[ "https://Stackoverflow.com/questions/5437164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/677325/" ]
You can achieve this with [Apache Commons StringUtils](https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#removeEnd-java.lang.String-java.lang.String-) as follows: ``` String s = "http://almaden.ibm.com/"; StringUtils.removeEnd(s, "/") ```
``` if (null != str && str.length > 0 ) { int endIndex = str.lastIndexOf("/"); if (endIndex != -1) { String newstr = str.subString(0, endIndex); // not forgot to put check if(endIndex != -1) } } ```
25,806
I posted earlier about how I was surprised that a typical Calculus 1 course that meets 3-4 hours each week for 15 weeks only barely manages to reach the fundamental theorem by the end of the course. If we consider James Stewart's *Calculus: Early Transcendentals*, then the fundamental theorem of calculus is towards the...
2022/11/14
[ "https://matheducators.stackexchange.com/questions/25806", "https://matheducators.stackexchange.com", "https://matheducators.stackexchange.com/users/20591/" ]
IF you want to fill more time (and that is what the question asks), the clear answer is to spend more time on in-class drill. You are verging back to debating if you should spend more time, in responding to answers. But that's not this question (which is "how", not "if", as your other question was). FWIW, if you're re...
Either the centralized tests do not properly assess your students' understanding, or your students are being inspired by your fast-paced style to spend more of their own time on reading and doing exercises - things that the lecturer or a TA would usually be doing in the settings I have been part of, as a student long a...
6,527,762
I am using IBOutletCollections to group several Instances of similar UI Elements. In particular I group a number of UIButtons (which are similar to buzzers in a quiz game) and a group of UILabels (which display the score). I want to make sure that the label directly over the button updates the score. I figured that it ...
2011/06/29
[ "https://Stackoverflow.com/questions/6527762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/347445/" ]
EDIT: Several commenters have claimed that more recent versions of Xcode return `IBOutletCollections` in the order the connections are made. Others have claimed that this approach didn't work for them in storyboards. I haven't tested this myself, but if you're willing to rely on undocumented behavior, then you may find...
Not as far as I am aware. As a workaround, you could assign each of them a tag, sequentially. Have the buttons range 100, 101, 102, etc. and the labels 200, 201, 202, etc. Then add 100 to the button's tag to get its corresponding label's tag. You can then get the label by using `viewForTag:`. Alternatively, you could...
62,857,126
I have many big strings with many characters (about 1000-1500 characters) and I want to write the string to a text file using python. However, I need the strings to occupy only a single line in a text file. For example, consider two strings: ``` string_1 = "Mary had a little lamb which was as white as snow" string_2...
2020/07/12
[ "https://Stackoverflow.com/questions/62857126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9578785/" ]
If you want all the strings to be written out on one line in a file without a newline separator between them there are a number of ways as others here have shown. The interesting issue is how you get them back into a program again if that is needed, and getting them back into appropriate variables. I like to use json...
You can split the string to lines using parenthesis: ```py s = ( "First line " "second line " "third line" ) ``` You can also use triple quotes and remove the newline characters using `strip` and `replace`: ```py s = """ First line Second line Third line """.strip().replace("\n", " ") ```
52,708,565
I'm working on a Help project that contains thousands of .htm topics. Each topic has a heading (inside a h1 tag). Each heading contains a span tag. I'm looking for a script that would allow me to insert a period (".") separator before the span tag in every h1 tag across all topics. For example, I need to change... `...
2018/10/08
[ "https://Stackoverflow.com/questions/52708565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10474834/" ]
Just use CSS to add it using after and contents ```css h1 span::after{ content: "." } ``` ```html <h1><span>Hello</span></h1> <h1><span>World</span></h1> <h1><span>Foo</span></h1> <h1><span>Bar</span></h1> ```
You could try this. ```js $("h1 span").prepend(".") ``` ```html <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <h1><span>My brain</span> <span>Yo</span></h1> <h1>Some test <span>Yo</span></h1> <h1>Another test<span>Yo</span></h1> ```
72,476,708
I have this request using a curl command and I want to translate it to python using the requests library ``` curl -X POST https://endpoint/prod/api/Translations/start \ -H 'Authorization: Bearer <accessToken>' \ -H 'Content-Type: application/json' \ -d '{ "text": ["first segment to translate.", "second seg...
2022/06/02
[ "https://Stackoverflow.com/questions/72476708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14080363/" ]
You can use `requests` library. The following curl: ``` curl -X POST "https://www.magical-website.com/api/v2/token/refresh/" \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "refresh": "$REFRESH_TOKEN" }' ...
You can try this one. ``` import requests url = "https://endpoint/prod/api/Translations/start" payload = { "text": ..., "sourceLanguageCode": ..., ... } headers = { "Authorization": "Bearer ...", "Content-Type": "application/json" } res = requests.post(url, data = payload, headers = headers) print(re...
4,154,707
I'm trying to delete records from one database based on a selection criteria of another. We have two tables, emailNotification which stores a list of jobs and emails. Then we have jobs. I want to clear out emailNotifications for jobs that have been closed. I found some earlier examples on Stackoverflow that lead me to ...
2010/11/11
[ "https://Stackoverflow.com/questions/4154707", "https://Stackoverflow.com", "https://Stackoverflow.com/users/158244/" ]
MySQL DELETE records with JOIN Delete multiple records from multiple table using Single Query is As below: You generally use INNER JOIN in the SELECT statement to select records from a table that have corresponding records in other tables. We can also use the INNER JOIN clause with the DELETE statement to delete reco...
If the aim is deleting matching rows, like deleting rows in 1st table which have relations in 2nd, to avoid deleting whole 1st table you should put additional "where" condition for 2nd table ``` DELETE f FROM firsttable f LEFT JOIN secondtable s ON f.related_id = .jobId WHERE s.related_id ```
38,950,301
I am trying to write a stored procedure in SQL Server 2008, which should generate ID number on the basis of another column's first letter like below: [![Auto Generation of ID alphabetically](https://i.stack.imgur.com/GMVFc.jpg)](https://i.stack.imgur.com/GMVFc.jpg) I am using SQL Server 2008. Would be grateful on an...
2016/08/15
[ "https://Stackoverflow.com/questions/38950301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3909410/" ]
Not sure how your localhost:3003 is configured; With or without `https:`... Say you are using http://localhost:3000 (not https:); The `Secure` cookie attribute from your target might be the cause for your browser to omit the cookie. > > 4.1.2.5. The Secure Attribute > > > The Secure attribute limits the scope of t...
B.Ma's answer give me a hint to solve my problem with the webpack-dev-server which probably uses the http-proxy-middleware under the hood to proxy the request. The problem comes with the httpOnly cookies and this approach solved it. Here is my config that I used in the webpack.conf.js: ``` let myappSessionValidationCo...
19,491,324
I am trying to create a list of members against whom I would be running comparison operation with multiple values Here's my code ``` HashSet<string> respCodeList = new HashSet<string> { "051", "052", "055", "056", "058", "059", "061", "063", "064" }; if (respCodeList.Contains(object.Property)) ``` I am gettin...
2013/10/21
[ "https://Stackoverflow.com/questions/19491324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2385057/" ]
If a save operation fails then the client side state will still be either "added", "modified" or "deleted". Changes are only accepted if a save succeeds. This allows you to "resave" the same entity or entities after you have "corrected" the issue without having to reassemble the changes. You can also use Breeze *Entit...
Have you tried using [EntityAspect.rejectChanges()](http://www.breezejs.com/sites/all/apidocs/classes/EntityAspect.html#method_rejectChanges) ? > > Returns the entity to an EntityState of 'Unchanged' by rejecting all changes made to it since the entity was last queried had 'rejectChanges' called on it. > > >
20,651,301
I am trying to open another activity through Intent on Button press. But the **app crashes every time** on launch. **IntentTest.java:** ``` package com.example.intenttest; public class IntentTest extends Activity { Button b1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedIns...
2013/12/18
[ "https://Stackoverflow.com/questions/20651301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2020956/" ]
Because you did not initialize `b1(Button)` ``` b1 = (Button)findViewById(R.id.button_id); b1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent2 = new Intent(IntentTest.this, IntentTest2.class); startActivity(intent2); ...
You did not initialize your button b1 in IntentTest class, ``` @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_intent_test); b1=(Button)findViewById(R.id.your_btn_name); b1.setOnClickListener(new View.OnClickListener()...
104,137
Some time ago I saw the [Nikon's roadmap](https://www.nikon.com/news/2018/img/pic_180823_03_08.jpg) for new S-Line lenses and today I found an [update to this roadmap](https://petapixel.com/2019/01/08/this-is-nikons-updated-mirrorless-lens-roadmap/). I am wondering why Nikon is building lenses with those apertures fir...
2019/01/09
[ "https://photo.stackexchange.com/questions/104137", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/79309/" ]
Everyone *talks* a lot more about the premium, widest aperture lenses. But a lot more folks *buy* the lower priced, narrower aperture lenses. I think that is the primary strategy: To sell as many lenses in as short a time as is possible to get users anchored in the new system. Those who tend to buy more expensive pr...
It is more difficult to make highly corrected wide aperture lenses. Perhaps it is additionally complicated by the shorter flange distance of the Z-mount.
18,768
I am moving from creating maps with Illustrator to making them with QGIS and actual data. One of the things I haven't been able to re-create in QGIS are the smooth curved lines I can get in Illustrator. I am not talking about Join and Cap Styles, but how an entire line is rendered. I am looking for an answer that does...
2012/01/12
[ "https://gis.stackexchange.com/questions/18768", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/584/" ]
Check out the Generalizer plugin, it should do what you want. The plugin has smoothing options which work quite well. It doesn't change how your lines are rendered but instead makes a new shapefile with smoothing (or simplification/generalization) applied. ![enter image description here](https://i.stack.imgur.com/Mmp...
There is a **Smooth** geoalghoritm under `Processing Toolbox -> Vector geometry -> Smooth`. [![smooth](https://i.stack.imgur.com/nhWqQ.png)](https://i.stack.imgur.com/nhWqQ.png) > > This algorithm smooths the geometries in a line or polygon layer. It > creates a new layer with the same features as the ones in the in...
3,870,808
is there a way to stop execution and return a different value in a before do block in sinatra ? ``` before do # code is here # I would like to 'return "Message"' # I would like "/home" to not get called. end // rest of the code get '/home' do end ```
2010/10/06
[ "https://Stackoverflow.com/questions/3870808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/127511/" ]
``` before do halt 401, {'Content-Type' => 'text/plain'}, 'Message!' end ``` You can specify only status if you want, here's example with status, headers and body
On <http://www.sinatrarb.com/intro> Filters section > > Before filters are evaluated before > each request within the context of the > request and can modify the request and > response. Instance variables set in > filters are accessible by routes and > templates: > > > ``` before do @note = 'Hi!' r...
21,982,619
i am storing logged in user name in arraylist and than putting the arraylist in session .Whenever the user logged in for the first time it is printing the user name but when refreshing the page the same name is printing twice but i only want to print the username only one time no matter how many times the user refresh ...
2014/02/24
[ "https://Stackoverflow.com/questions/21982619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2920839/" ]
Use a Hashmap, as it does not allow duplicates and will replace the original key with the new one. ``` HashMap hm = new HashMap(); hm.put (U_ID, new user(Name, U_ID, Pass)); ```
I am not sure what you are asking for but as far as i understood your code following changes can be done to your programme.Let me know if it helps. ``` String username = request.getParameter("username"); String password = request.getParameter("password"); HttpSession session = request.getSession(true); ...
8,055,889
In our web application, we have print functionality for a couple of our pages and the approach we take is to put the current page's content in a globally available iframe's document and print the iframe (using Javascript). This works totally fine in Firefox but in IE it prints the iframe in a very small font, almost un...
2011/11/08
[ "https://Stackoverflow.com/questions/8055889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/757483/" ]
Was having the small print on IE issue today, and to fix I simply adjusted my print function as so: ``` $(document).ready(function(){ $("#printFrame").click(function(){ if (document.queryCommandSupported('print')) { $("#iframe").get(0).contentWindow.document.execCommand('print', false, null); ...
Yes, we're seeing the same thing. If we open the same page directly it prints as you would expect. When it is loaded in an iframe and printed it makes everything smaller; not just the font. This is using IE9 on Windows 7.
359,820
Is there a single adjective that means "does not use much energy" / "not using much energy"? **I do not mean "efficient"**. Efficient means something that does not waste much energy - something efficient could use a lot of energy for a specific purpose, yet not waste much energy on actions that do not achieve that ...
2016/11/23
[ "https://english.stackexchange.com/questions/359820", "https://english.stackexchange.com", "https://english.stackexchange.com/users/207229/" ]
*low-power* or maybe *low-powered* From a physics standpoint Power = Work / Time. A low-power device does not take in much (electrical) energy. (In the end, all that energy comes out one way or the other. Often much of it as heat.)
Try "unvigorous". Since vigorous means "Characterized by forceful and energetic action or activity" and you're after the opposite of that, just invert the meaning by prefixing it with "un". "Unvigorous" might not presently be in the dictionary, but perhaps it ought to be... Other suggestions: unenergetic, lethargic, e...
2,383,554
In C/C++, there is a 'write() function which let me write to either file or a socket, I just pass in the file descriptor accordingly). And there is a fprintf() which allow me to do fprintf (myFile, "hello %d", name); but it only works for file. Is there any api which allows me to do both? i.e. able to let me do print ...
2010/03/04
[ "https://Stackoverflow.com/questions/2383554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/114970/" ]
In C, on POSIX-ish machines (which you must have to be using 'write()'), you can use: * `fdopen()` to create a file stream from a file descriptor. * `fileno()` to obtain a file descriptor from a file stream. You need to be careful about flushing the file stream at appropriate times before using the matching file desc...
generalizing tusbar answer, and to make it work with visual studio you can try the following codes: ` ``` int fdprintf(int fd, const char* fmt, ...) { int cc; va_list args; va_start(args, fmt); int len = _vscprintf(fmt,args) + 1; char* buffer = new char[len]; buffer[len] = 0; if ((cc = vs...
48,269,698
I am trying to return a vector of structs from one object to another. My first idea is to return a reference to the vector. Both object files include the struct in question (the listener struct) and the function doing the returning looks as such: ``` vector<Listener>* Component::GetListeners() { vector<Listener> l...
2018/01/15
[ "https://Stackoverflow.com/questions/48269698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9211144/" ]
In the below code the button cycles through the decimal numerals except for 0, which are basically sudoku numbers, for a `widget`'s text: ``` import tkinter as tk def cycle(widget): widget['text'] = (widget['text'] % 9) + 1 root = tk.Tk() btn = tk.Button(root, text=1) btn['command'] = lambda widget=btn: cycle(w...
You have to fix your lambda values in the button callback, this is the main change that I added to your code. All other edits are mainly to make the code clearer and remove all unnecessary parts. Take home message ist here, that you are basically always using the last iterator value for the callback function of `Butto...
70,135,719
I need to write a function that receives an non-negative integer and returns: ``` [] for n=0 [[]] for n=1 [[],[[]]] for n=2 [[],[[]],[[],[[]]]] for n=3 ``` And so on. For `n`, we will receive an `n` sized list, so that in index `i` there will be all the `i-1` elements from the list. I don't know how to explain ...
2021/11/27
[ "https://Stackoverflow.com/questions/70135719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17499674/" ]
If you can't use loops, you can use the following: ``` def recursive_list(n): if n == 0: return [] else: return recursive_list(n-1) + [recursive_list(n-1)] ``` EDIT ---- You can do the following if you want to use `append`: ``` def recursive_list(n: int) -> list: if n: result =...
You can write this down as a recursive function using a simple list comprehension: ``` def f(n): return [f(i) for i in range(n)] ``` Or instead of the list comprehension, you could also use `map`: ``` def f(n): return list(map(f, range(n))) ``` Note, though, that without [caching](https://docs.python.org/...
637,505
I have an array of dates in a one week range stored in an unusual way. The Dates are stored in this numeric format: 12150 From left to right: 1st digit represents day: 1 = sunday, 2 = monday, 3 = tuesday, ...., 7 = saturday next two digits represent hour in a 24 hour system: 00 = midnight, 23 = 11pm next two digit...
2009/03/12
[ "https://Stackoverflow.com/questions/637505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20895/" ]
How about ``` const int MAX = 72460; // Or anything more than the highest legal value inRange = (MAX + inputDate - startDate) % MAX < (MAX + endDate - startDate) % MAX; ``` This assumes of course that all the dates are well formed (according to your specs). This addresses the case where the start is "aft...
The simplest solution i found is this: said x your generic time and S, E the start and end time respectively (with 0 < S,E < T): ``` f(x) = [(x-S) * (x-E) * (E-S) < 0] ``` This function returns TRUE if x is in between the start and end time, and FALSE otherwise. It will also take care of start time bigger than end t...
7,999,240
I have a feeling this is going to be really simple. I don't know if I'm just missing a trick here, or searching for the wrong phrases. I'm looking for a profiling or code coverage (don't really know which category this falls in) that can monitor an application (preferably let me start and stop the monitoring) and coun...
2011/11/03
[ "https://Stackoverflow.com/questions/7999240", "https://Stackoverflow.com", "https://Stackoverflow.com/users/369247/" ]
[Visual Studio 2010 Premium](http://msdn.microsoft.com/en-us/library/z9z62c29.aspx) and above have performance profiling tools built in that can do exactly what you're asking. [Here's](http://blogs.msdn.com/b/profiler/archive/2009/12/22/which-profiling-mode-should-i-use.aspx) a blog about the performance tools availab...
I don't have any touch or knowledge of dotcover that you are talking about. But regarding number of times a method called, a dumb method to calculate this is create a static integer and increment it in the method. I am not sure what "profiling or code coverage" means. This may sound really stupid if you are asking some...
85,910
I do a lot of Java programming at my work (I'm an intern) and I was wondering if it is generally a rule to create javadoc to accompany my code. I usually document every method and class anyways, but I find it hard to adhere to Javadoc's syntax (writing down the variables and the output so that the parser can generate h...
2011/06/21
[ "https://softwareengineering.stackexchange.com/questions/85910", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/22067/" ]
I would say it's wrong not to make certain that the code you develop is clearly and understandably documented for the situation at hand. What that means is situational. As an intern, consider that all the code you write is going to be someone else's responsibility. That ups the ante for what constitutes understandable...
JavaDoc makes your code easier to use. I doubt it helps better than normal comments when it comes to bugfixing or modifying the code, but using your classes in other projects is by far easier and therefore more likely when JavaDoc comments allow other programmers to find and use your classes and methods. Since code reu...
46,516,868
I've created a new WPF App in Visual Studio 2017 for Windows Classic Desktop on Windows 10. I add the ribbon to new application in following way. The xaml code: ``` <r:RibbonWindow x:Class="AKnowledgeBase.MainWindow" xmlns:r1="http://schemas.microsoft.com/winfx/2006/xaml/presentation/ribbon" xmlns="ht...
2017/10/01
[ "https://Stackoverflow.com/questions/46516868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3260229/" ]
Add a reference to `System.Windows.Controls.Ribbon.dll` and try this XAML markup: ``` <RibbonWindow x:Class="AKnowledgeBase.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/...
You have probably added some theme based styling along with your r, r1 and r2 references. I'd suggest you look for a way to build Ribbon without overriding default styling.
32,047,544
I'm trying to change a text inside a canvas circle only once a week in wordpress The increment will always be the same. How can I do it automatically? I suppose it has to do with server side javascript? Thank you,
2015/08/17
[ "https://Stackoverflow.com/questions/32047544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4090776/" ]
Your use case doesn’t seem to be a critical security issue, so it might be okay to store the information date client-side. You can save a timestamp in [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) and just do a integer comparison with something along the lines of: ``` var weekI...
You can store the first time a page is loaded in your cookie or localstorage and then each time the page os loaded do a check with the current date. With that said you should probably do this kind of things on the server side and retrive it on the client because if you're doing it in browser you have no control or re...
72,430,741
This is not the usual problem with a missing `super()` call. Instead I have a special construct where I need to call `super()` differently. Check this code: ```js class A { public constructor() { console.log("c-tor A"); } } class B extends A { public constructor(s: string); public constructor(...
2022/05/30
[ "https://Stackoverflow.com/questions/72430741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1137174/" ]
[`JsonSerializer.Deserialize()`](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.jsonserializer.deserialize?view=net-6.0) is a static method. You don't need to create instance for `JsonSerializer`. Meanwhile `JToken` is from `Newtonsoft.Json`. I think would be great not to mix up with `System.Text.Json` ...
If you need only just the property names from the first object then you can take advantage of [Json.NET's Linq](https://www.newtonsoft.com/json/help/html/queryinglinqtojson.htm) ``` var semiParsedJson = JObject.Parse(json); var collection = (JArray)semiParsedJson["RandonName"]; var firstObject = (JObject)collection.Fi...
21,451,622
Hive Metastore is not creating MYSQL or Derby Connection. For Derby ``` schematool -dbType derby -initSchema Metastore connection URL: jdbc:mysql://localhost/metastore Metastore Connection Driver : com.mysql.jdbc.Driver Metastore connection User: hive schematool -dbType derby -info Metastore connection URL: ...
2014/01/30
[ "https://Stackoverflow.com/questions/21451622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2028043/" ]
I think the problem is with your URL. Modify the URL as follows. Put the mysql port no. Metastore connection URL: `jdbc:mysql://localhost:3306/metastore`
For this specific error "Failed to load driver", you should check if you have the mysql connector copied or has a link in Hive lib folder. ln -s /usr/share/java/mysql-connector-java.jar $HIVE\_HOME/lib/mysql-connector-java.jar (Download it if you don't have it within the Java libs) Similarly get the lib for Derby to...
3,167,494
1. How often does Python flush to a file? 2. How often does Python flush to stdout? I'm unsure about (1). As for (2), I believe Python flushes to stdout after every new line. But, if you overload stdout to be to a file, does it flush as often?
2010/07/02
[ "https://Stackoverflow.com/questions/3167494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/329344/" ]
For file operations, Python uses the operating system's default buffering unless you configure it do otherwise. You can specify a buffer size, unbuffered, or line buffered. For example, the open function takes a buffer size argument. <http://docs.python.org/library/functions.html#open> "The optional buffering argume...
You can also check the default buffer size by calling the read only DEFAULT\_BUFFER\_SIZE attribute from io module. ``` import io print (io.DEFAULT_BUFFER_SIZE) ```
8,444,087
**Goal** I've got a DOM with about 70 elements on it (divs with some content) . I need to move and toggle the display of those divs quite a lot and also quite fast. The speed is one of the most important things. The trigger for moving and toggling these divs is a search query, kind of like [Google Instant](http://www....
2011/12/09
[ "https://Stackoverflow.com/questions/8444087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61109/" ]
Well commented and formatted JavaScript, kudos sir! First off, it seams like your use-case would be perfect for a SQL database query. Sending your query to a DB and getting the category IDs and locations back would be much simpler than your current implementation. I assume you do it all client side because you don't h...
I think that it really possible to use tree structure there. Also you can try to implement manipulate some graph algorithms. Also, think it could be reasonable to have some hidden div on each level of the tree, when you store most popular information, and you can just display it if necessary instead of manipulation wit...
43,739,658
I get a iterable list which I iterate using following code ``` for (IssueField issueObj : issue.getFields()) { System.out.println(issueObj.getId()); } ``` the list is of following structure ``` [IssueField{id=customfield_13061, name=Dev Team Updates, type=null, value=null}, IssueField{id=customfield_13060, nam...
2017/05/02
[ "https://Stackoverflow.com/questions/43739658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7925298/" ]
If you want to be able to do frequent searching over a large dataset like you said then you should use a HashMap where the string is the value in your getId(). The big O time complexity for search of a HashMap is O(1) where for a list it is O(n). This would net you the desired efficiency.
If you are using java 8, You can try this ``` <your-object> result1 = <your-list>.stream() .filter(x -> "jack".equals(x.getId())) .findAny() .orElse(null); ``` First of all it Convert list to Stream...
2,195,953
> > Show that ${n\choose r}={{n-1}\choose{r-1}}+{{n-1}\choose {r}}$. > > > My try: $$\dfrac{n!}{(n-r)!\;r!}=\dfrac{(n-1)!}{(n-r)!(r-1)!}+\dfrac{(n-1)!}{(n-1-r)!\;r!}$$ Multiplying all terms by $r!(n-r)!$ $$n!=r(n-1)!+(n-1)!(n-r)$$ Dividing everything by $(n-1)!$ $$n=r+(n-r)$$ $$n=n$$ Is this correct?
2017/03/21
[ "https://math.stackexchange.com/questions/2195953", "https://math.stackexchange.com", "https://math.stackexchange.com/users/167548/" ]
Combinatorial Proof: Let $A= \big\{1,2, \ldots,n\big\} $. there are $\binom{n}{r}$ ways to form r-combinations $S$ of $A$. we can count the number of r-combinations $S$ of $A$ in a different way. Every r-combination $S$ of $A$ either contains the element $1$ or not. if $1 \in S$, the number of ways to form S is $\bi...
Not quite. Following your method: $$\dfrac{n!}{(n-r)!\;r!}=\dfrac{(n-1)!}{(n-r)!(r-1)!}+\dfrac{(n-1)!}{(n-1-r)!\;r!}$$ Multiplying all terms by $r!(n-r)!$ (rather than $(r-1)!(n-r)!$) $$n!=r(n-1)!+(n-1)!(n-r) = r(n-1)!+(n-1)!n - r(n-1)! = n!$$ But it's usually better to start with one side and ending up at the other ...
1,844,603
Is the *NSSearchPathForDirectoriesInDomain*s function still the best way to get the path of the iPhone Documents directory? I ask because most topics I see on this are dated last year, and it still seems like a pretty cumbersome way of getting to a directory that is used commonly on iPhones. You'd think that there'd be...
2009/12/04
[ "https://Stackoverflow.com/questions/1844603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/162491/" ]
The Core Data-based application template in Xcode provides this method: ``` - (NSString *)applicationDocumentsDirectory { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil; return basePath; } ``` ...
This works for me, pretty short and sweet ``` #define kDOCSFOLDER [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] ``` Cheers!
5,070,328
Can anybody help me with this? Here's the problem... When I have to code let's say, a registration form, I add the new form and start coding it. But sometimes the form is a bit complex and I find myself duplicating code and making the same verifications over and over again making the code messy. I was wondering is t...
2011/02/21
[ "https://Stackoverflow.com/questions/5070328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/555089/" ]
Well real tool/language designed for this is [UML](http://en.wikipedia.org/wiki/Unified_Modeling_Language). You can read up on it. But its very strict. Altough you don't have to follow all specs and conventions. There are several types of diagram that cover pretty much everything. But AFAIK only 4 are practically in u...
1) The best place to start is the white board. If your company doesn't have white boards, tell them to order some. Seriously. You will wonder how you lived without it. 2) Build a paper prototype with the stakeholders, or have them build one. They take maybe 30 minutes to make and solve a ton of UI arguments that other...
9,215,063
How can an object replace itself in ASNI C++ ? I want a function like foo->replaceBy(bar) which will cause object foo to delete itself and replace pointer by bar ``` if (foo->isFoo()) { foo->replaceBy(bar); } ASSERT(foo->isFoo(), false); ASSERT(foo->isBar(), true); ```
2012/02/09
[ "https://Stackoverflow.com/questions/9215063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298023/" ]
You cannot do this unless you pass a pointer to the pointer or a reference to the pointer ([example here](http://ideone.com/lwV9u)): ``` void replaceBy(Foo*& foo, Foo* bar) { delete foo; foo = bar; } //... foo->replaceBy(foo, bar); ``` Which would defeat the purpose of `replaceBy` being a non-static member fun...
With the `PIMPL` idiom it's easy to *effectively* let objects take each others place: [The Pimpl Idiom in practice](https://stackoverflow.com/questions/843389/the-pimpl-idiom-in-practice) Perhaps you also want a `swap` method to swap the contents of two objects. <https://stackoverflow.com/a/843418/1149664>
10,152,650
Is there a way in JavaScript to get Boolean value for a match of the string against the array of regular expressions? The example would be (where the 'if' statement is representing what I'm trying to achieve): ``` var thisExpressions = [ '/something/', '/something_else/', '/and_something_else/']; var thisString = 'el...
2012/04/14
[ "https://Stackoverflow.com/questions/10152650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/398341/" ]
Using a more functional approach, you can implement the match with a one-liner using an [array function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some): ECMAScript 6: ``` const regexList = [/apple/, /pear/]; const text = "banana pear"; const isMatch = regexList.some(rx =>...
You could use [.test()](http://www.w3schools.com/jsref/jsref_regexp_test.asp) which returns a boolean value when is find what your looking for in another string: ``` var thisExpressions = [ '/something/', '/something_else/', '/and_something_else/']; var thisString = new RegExp('\\b' + 'else' + '\\b', 'i'); var FoundIt...
59,178,418
I am little confused with the caching mechanism of Spark. Let's say I have a Spark application with only one action at the end of multiple transformations. In which suppose I have a dataframe A and I applied 2-3 transformation on it, creating multiple dataframes which eventually helps creating a last dataframe which ...
2019/12/04
[ "https://Stackoverflow.com/questions/59178418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3762708/" ]
Yes, you are correct. You should cache A as it used for B & C as input. The DAG visualization would show the extent of reuse or going back to source (in this case). If you have a noisy cluster, some spilling to disk could occur. See also top answer here [(Why) do we need to call cache or persist on a RDD](https://st...
I think thebluephantom's answer is right. I had faced same situation with you until today, and i also found answers only saying Spark `cache()` does not work on single query. And also my spark job executing single query seems not caching. Because of them, i was also doubted for he's answer. But he showed evidences...
182,606
You are given four numbers. The first three are \$a\$, \$b\$, and \$c\$ respectively, for the sequence: $$T\_n=an^2+bn+c$$ You may take input of these four numbers in any way. The output should be one of two distinct outputs mentioned in your answer, one means that the fourth number is a term in the sequence (the abo...
2019/04/03
[ "https://codegolf.stackexchange.com/questions/182606", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/80756/" ]
[05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 35 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) ============================================================================================================================ ``` Æ©²Āi²4P³n+tÐdi(‚³-IJ·Ä%P}뮳Āi³%]_ ``` Port of [*@Arnauld*'s J...
[Jelly](https://github.com/DennisMitchell/jelly), 15 bytes ========================================================== ``` _3¦UÆr=Ḟ$;3ị=ɗẸ ``` [Try it online!](https://tio.run/##y0rNyan8/z/e@NCy0MNtRbYPd8xTsTZ@uLvb9uT0h7t2/D866eHOGTqPGuYo6NopPGqYq3N4uT5Q9lHjvki/Y11ch9sfNa2J/P8/OtpQBwhjQSg62kjHWMcUyjbQMwXK6BrF6ugCmagi...
13,020,103
I'm working with ASP.NET MVC 4 WebApi and am having a lot of fun with it running it on my local computer on IIS Express. I've configured IIS Express to serve remote machines too, and so other's in my company are using my computer as our webserver. After deciding this was a less-than-optimal solution, we decided to pu...
2012/10/22
[ "https://Stackoverflow.com/questions/13020103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1087161/" ]
I always come to this question when I hit an error in the test environment and remember, "I've done this before, but I can do it straight in the web.config without having to modify code and re-deploy to the test environment, but it takes 2 changes... what was it again?" For future reference ``` <system.web> <custo...
So i tried all the suggested solutions to no avail. All i did was to set run the app from the server and it displayed the error in full, this should have worked when i set customErrors mode to false but it didn't. The moment i browsed the API form the server i was able to see the problem.
73,249,019
let's say I have the following data frame table: df ``` Users Data_Type User1 String User2 Integer User3 String ``` I have the following sample list which dictionary elements inside it. my\_dicts ``` [{'name': 'User4', 'dtype': 'StringType'}, {'name': 'User3', 'dtype': 'String'}, {'name': 'User1'...
2022/08/05
[ "https://Stackoverflow.com/questions/73249019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14882883/" ]
You did not provide how the table is formatted, so I'm assuming this data structure: ```py updates = [ ("User1", "String"), ("User2", "Integer"), ("User3", "String") ] ``` You can update `my_dicts` by going over each element and checking if the `name` key corresponds. If so, overwrite `dtype`. ```py for...
``` newlist = sorted(my_dicts, key=lambda d: d['name']) ```
6,477,318
Given a jar runs within a JVM would it be possible to unload the current running Jar and remove it from the system. Download a new version and rename it with the same name of the last Jar and then initialise the new Jar, creating a seamless update of the Jar within the JVM. Is it even possible to instruct the JVM to pe...
2011/06/25
[ "https://Stackoverflow.com/questions/6477318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/450321/" ]
Generally you cannot do this as this behaviour to my knowledge is not officially defined. You CAN however create a classloader using a jar file *outside* your official classpath and then load classes from that as you need. By discarding all instances of classes loaded by the classloader you can remove the current reso...
Please pay attention to Tom Hubbard's comment. If a class was not used yet in Runtime (and therefore not loaded), if you remove the class in the new JAR - you will have some issues. For example, if you will execute the following code: ``` public static void main(String[] args) throws InterruptedException { ...
4,290,230
I have a page `action.php` on which I run an SQL query through the code, so that whenever the page is viewed the query runs like **its like counting page views** ``` <?php mysqli_query("UPDATE ****"); ?> ``` The problem is when the page is refreshed, the query is run & PAGE REFRESH is counted as a PAGE VIEW which I ...
2010/11/27
[ "https://Stackoverflow.com/questions/4290230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/158455/" ]
You can't directly detect a page refresh, but you can use a cookie to simulate what you want: ``` if (isset($_COOKIE['action'])) { // action already done } else { setcookie('action'); // run query } ``` Depending on your requirements, you also need to decide when to remove the cookie and/or perform the action ...
``` //here you get the url behind the domain. $currentPage = $_SERVER['REQUEST_URI']; //if the session current page is not set. if(!isset($_SESSION['currentPage'])){ //set the session to the current page. $_SESSION['currentPage'] = $currentPage; } //check if the session is ...
71,849,087
I am new to Flutter. Why Do I need a Mac OS to develop IOS Applications in Flutter?
2022/04/12
[ "https://Stackoverflow.com/questions/71849087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18730456/" ]
change the `PASSWORD_HASHERS` in your `settings.py` ``` PASSWORD_HASHERS = [ 'django.contrib.auth.hashers.PBKDF2PasswordHasher', 'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher', 'django.contrib.auth.hashers.Argon2PasswordHasher', 'django.contrib.auth.hashers.BCryptSHA256PasswordHasher', 'dja...
Django rest framework doesn't encrypt the passwords automatically. You 'll have to explicitly do that. Use make\_password function from django contrib or if the insance is available you can simply do `instance.set_password(<password here>)` Override the create/Update method of the serializer: ``` from django.contrib....
44,344,624
I'm trying to make a function in my service class, that render a twig page. I've tried to do like this: **service.yml:** ``` ******** parameters: error.class: AppBundle\Utils\Error services: app.error: class: '%error.class%' arguments: [@templating] ``` **Error.php (service class):** ``` ***...
2017/06/03
[ "https://Stackoverflow.com/questions/44344624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3628180/" ]
YAML can be a bit iffy when it comes to syntax, make sure your using all spaces (no tab chars). And makes sure every indentation is the same amount of space characters. Like 2/4/6/8 for each level or 4/8/12 etc if you prefer 4 wide. The code you posted should be fine, but its probably something silly as described abov...
You should put `'` around `@templating` ``` services: app.error: class: AppBundle\Utils\Error arguments: ['@templating'] ```
2,221,806
There are lots of PE file browsers. Here is a list of good ones if you are interested: > > PE File format viewers: > > > * PE Explorer <http://www.pe-explorer.com/> > * PE VIew: <http://www.magma.ca/~wjr/> > * PEBrowse Professional <http://www.smidgeonsoft.prohosting.com/pebrowse-pro-file-viewer.html> > * PE Browse...
2010/02/08
[ "https://Stackoverflow.com/questions/2221806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/268241/" ]
`readelf` and `objdump` are both excellent utilities if you are on a Unix box. Both are provided by Cygwin. `readelf` will give you a good overview of the ELF header information, section headers. You can also use it to get relocation and symbol information. Overall, `readelf` can give greater detail on the contents of...
I like objdump. I think it comes with the Mingw and/or cygwin distributions.
1,399,336
I have about one hundred of XML file (with the same structure) and I want to import them in SAS. Unfortunately in doing that I have some issues relatated to the MAP file of the XML files (I have not the MAP file for these files). So I though to convert these files in CSV through Excel. But if I use this path, I need so...
2019/01/28
[ "https://superuser.com/questions/1399336", "https://superuser.com", "https://superuser.com/users/991047/" ]
I've solve my issue with this VBA script: ``` Public Sub ConvertXmlToXlsx() Application.DisplayAlerts = False Dim objFSO As Object Dim objFolder As Object Dim objFile As Object xmlFolder = "C:\Users\xxx\xxx\xxx\xxx\" convFolder = "C:\Users\xxx\xxx\xxx\xxx\" Set objFSO = CreateObject("Scripting.FileSystemObject") S...
Since you seem to be familiar with SAS, or you'll have to be soon, I'd use R to read out the Excel files and then write them again as CSV. The code below allows you to set the working directory, read the contents onto a list and iterate through the list to conver the files in a few lines. ``` library(readxl) setwd("T...
38,689,254
Just launched mule studio 6.0.3 and trying to use Data Weaver. When I double click the transform message,only blank space coming up. Whenever I drag and drop any components from palette, i am getting the error as :- An internal error has occurred. org/mule/tooling/apikit/common/metadata/resolver/APIkitRouterInvokerMet...
2016/07/31
[ "https://Stackoverflow.com/questions/38689254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1767265/" ]
Maybe you have to write the entire url when you are setting the header: ``` header("Location: http://www.google.com"); ```
I wonder why you have set form method="get", but used $\_POST variable under php code. Here's another version using POST method, try if it helps. ``` <?php ini_set("SMTP","ssl://smtp.gmail.com"); ini_set("smtp_port","465"); if (isset($_POST['email'])) { $email = $_POST['email']; $address= $_POST['address']; ...
34,777,595
I have a single .json file that contains configuration stuff that I would like to reference from another script file using the typical import/require syntax. Currently I'm using webpack to resolve these dependencies and bundle them for me. This file however I want to be loaded at runtime and was hoping that there might...
2016/01/13
[ "https://Stackoverflow.com/questions/34777595", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83658/" ]
I think what you want is [require.ensure](https://webpack.github.io/docs/code-splitting.html), webpack's code splitting. The modules that you 'ensure' are put into a separate bundle, and when your 'ensure' executes at runtime, the webpack runtime automatically fetches the bundle via ajax. Note the callback syntax for e...
I had the same case with a file (config.json). I decided to copy it with [Copy-Webpack-Plugin](https://github.com/kevlened/copy-webpack-plugin) ``` new CopyWebpackPlugin([ // Copy directory contents to {output}/ { from: 'config.json' } ]) ``` After that, my file was in the output build directory. I used ...
21,423,697
I have class A and class B. And I have two functions: `B FromAToB(A)` and `A FromBToA(B)` The question is: In which class should I implement these functions? Or they should belong in another class? Or it doesn't matter?
2014/01/29
[ "https://Stackoverflow.com/questions/21423697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2708741/" ]
You can provide mutual conversion operators. This will require you to forward declare one class and defer the implementation of the conversion operator to after the implementation of the other class. For example: ``` #include <iostream> struct Seconds; struct Minutes { int value; operator Seconds() const; }; ...
Simply you may redefine cast operators to your type in each class you need. For example, instead of calling functions (FromAToB etc) in A class you can do this: ``` operator B() { // Creating B b_object return b_object; } ``` And then use it in the code ``` main() { // Creating A a_object B b_object = (B)a...
38,032,105
I'm trying to use the EOF function but it doesn't work as I expect it. In the debugger mode it doesn't detect the second "scanf" function and just carries on. It keeps on missing out the "scanf" function now and then. Code is posted below ``` int main() { char tempString; int i = 0; printf("Enter your l...
2016/06/25
[ "https://Stackoverflow.com/questions/38032105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6513225/" ]
EDIT: Firstly you omitted the length argument required by `scanf_s` for `%c` and `%s` formats. Second, the `%c` format takes the *next character from the input buffer*. At the second (and subsequent) entries there was a `newline` left in the input buffer from the first input. Adding a `space` before the `%c` format s...
try this ``` #include <stdio.h> int main(void) { char tempString; printf("Enter your letter\n"); while (scanf_s("%c%*c", &tempString, 1) != EOF) {//%*c for consume newline, 1 is buffer size printf("You entered:%c\n", tempString); } return 0; } ``` --- ``` int tempString;//int for che...
1,411,854
I have a collection of static libraries (.lib) files one of which may have been built with a different version of Visual Studio. This is causing the code generation of a project that links against all of them to fail. Is there any way to determine which version of Visual Studio was used to compile a static library?
2009/09/11
[ "https://Stackoverflow.com/questions/1411854", "https://Stackoverflow.com", "https://Stackoverflow.com/users/118815/" ]
If you have the corresponding .PDB files then you can see the version of the compiler from there with a tool like [Pdb Inspector](http://www.codeproject.com/Articles/37456/How-To-Inspect-the-Content-of-a-Program-Database-P). Or open the PDB in a hex viewer and search for the string "Microsoft (R) Optimizing Compiler"....
You didn't specify the language, but in C# the answer for knowing the OS and .NET version (in your code at runtime) is: ``` System.Version osVersion = System.Environment.OSVersion; System.Version cliVersion = System.Environment.Version; ``` There would be an equivalent in Managed C++/CLI That won't tell you the ver...
1,469,854
I have an asp Label control used for displaying error messages to the user. My client would like certain words in these messages to be underlined. How would this be accomplished? Thank you, James
2009/09/24
[ "https://Stackoverflow.com/questions/1469854", "https://Stackoverflow.com", "https://Stackoverflow.com/users/167027/" ]
Though a bit hacky, you can assign HTML markup to the Label's Text property. Something like this should suffice: ``` Label.Text = "this is an <span class='underlineIt'>underlined expression</span>"; ``` The would assign class `underlineIt` to the words "underlined expression." Within the underlineIt CSS class, you c...
I total misunderstood the question blah. Embed the HTML into the label's text property.
29,991,578
I'm developing an app that uses GPS position. For knowing position I get latitude and longitude. I don't get position at regular intervals, but I want to know if user has moved. For that I store last position and current position (both latitude and longitude) I was doing this: ``` if (latitudNew != latitudOld && lon...
2015/05/01
[ "https://Stackoverflow.com/questions/29991578", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1520085/" ]
You have the line: ``` if (latitudNew != latitudOld && longitudNew != longitudNew) ``` This is doing `longitudNew != longitudNew`. You have a typo there, you're testing to see if a variable is not equal to itself. It'll always be false. You meant to put `longitudOld` for one of them. Though you probably want to repl...
That looks correct to me, you'd compare `double`s in Objective-C just as you would in C. The datasource you're getting the information from might be rounding the values so that they appear as equal or the data isn't updating often enough. Also, you'd probably want to change the logic to have an `||` in the `if` instea...
1,483,278
I know that $A-S-S$$(Angle-Side-Side)$ congruence does not exist.But I cannot disprove it. Every time I draw a figure,I get two congruent triangles. **My Attempt**-[![](https://i.stack.imgur.com/08uqQ.jpg)](https://i.stack.imgur.com/08uqQ.jpg) So,we draw two lines such that $AB=DE$.Now we draw angles $\angle CAB=\ang...
2015/10/16
[ "https://math.stackexchange.com/questions/1483278", "https://math.stackexchange.com", "https://math.stackexchange.com/users/242402/" ]
Here is a counterexample that should be what you are looking for: [![enter image description here](https://i.stack.imgur.com/PLF9b.png)](https://i.stack.imgur.com/PLF9b.png)
Did you see that your example is a **right** triangle? Look at your method but imagine that last side being done by setting the point of compasses, set to the given length, at E and striking an arc. There are **three** possible results. In might happen that the arc is simply NOT long enough to reach side AC. In that ca...
803,921
I'm trying to use the navigation command framework in WPF to navigate between Pages within a WPF application (desktop; not XBAP or Silverlight). I believe I have everything configured correctly, yet its not working. I build and run without errors, I'm not getting any binding errors in the Output window, but my navigat...
2009/04/29
[ "https://Stackoverflow.com/questions/803921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
According to the [documentation](http://msdn.microsoft.com/en-us/library/system.windows.input.navigationcommands.gotopage.aspx), only `DocumentViewer` and `FlowDocumentViewer` implement this command specifically. You'll need to either find a command for navigation that `NavigationWindow` implements, or set up a `Comman...
In XAML: ``` <Button Command="{x:Static Views:Commands.NavigateHelp}" Content="Help"/> ``` In Views (We have a `Commands.cs` file that contains all of these): ``` public static RoutedCommand NavigateHelp = new RoutedCommand(); ``` In the Page contstructor, you can connect the two: ``` CommandBindings.Add(new Com...
8,232,608
How to fit an image of random size to an `ImageView`? When: * Initially `ImageView` dimensions are 250dp \* 250dp * The image's larger dimension should be scaled up/down to 250dp * The image should keep its aspect ratio * The `ImageView` dimensions should match scaled image's dimensions after scaling E.g. for an i...
2011/11/22
[ "https://Stackoverflow.com/questions/8232608", "https://Stackoverflow.com", "https://Stackoverflow.com/users/326849/" ]
After searching for a day, I think this is the easiest solution: ``` imageView.getLayoutParams().width = 250; imageView.getLayoutParams().height = 250; imageView.setAdjustViewBounds(true); ```
Use Simple math to resize the image . either you can resize `ImageView` or you can resize drawable image than set on `ImageView` . find the width and height of your bitmap which you want to set on `ImageView` and call the desired method. suppose your width 500 is greater than height than call method ``` //250 is the ...
21,615,687
I'm trying to sort my users in my controller, and I wanted to sort them by id number. My question is, does rails automatically assign orders an id when they are created, or do I need to add that to the create function in my create action in my controller? For example, can I say this: ``` def index @users = User.all...
2014/02/06
[ "https://Stackoverflow.com/questions/21615687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2253215/" ]
In most cases Rails would return you records sorted by id. But you should not rely on Rails as sorting is database-specific. To explicitly add sorting by id you should use: ``` def index @users = User.order(:id) end ``` Id is automatically added, you don't need to declare it anywhere.
If you want to sort User by ID ``` @users = User.order(:id) #ASC default @users = User.order('id ASC') #ASC explicit @users = User.order('id DESC') #DESC explicit ```
49,871,582
I wanted to circle my UIImageView and added this code : ``` profileImage.layer.cornerRadius = profileImage.frame.size.height/2 profileImage.clipsToBounds = true ``` and it work perfectly, but when images are horizontal, I get this picture: [![enter image description here](https://i.stack.imgur.com/20Sn5.png)](ht...
2018/04/17
[ "https://Stackoverflow.com/questions/49871582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4646999/" ]
You have already set the `clipsToBound` property. So just update the `contentMode`. **I you don't want to distort image's scale:** ``` profileImage.contentMode = .scaleAspectFill ``` **If image's scale does not matter, you also can use:** ``` profileImage.contentMode = .scaleToFill ``` > > Follow the link for m...
Set the `contentMode` of your UIImageView to `scaleAspectFill` ``` profileImage.contentMode = .scaleAspectFill ``` Keep in mind that using this contentMode option some portion of the content may be clipped to fill the view’s bounds.
257,353
Is there a native c++ variable type that's "bigger" than a double? float is 7 double is 15 (of course depending on the compiler) Is there anything bigger that's native, or even non-native?
2008/11/02
[ "https://Stackoverflow.com/questions/257353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31325/" ]
C++ has long double, but it's still quite limited. For good time try GNU's gmp library. You can set up numbers as big as you like, and it's quite fun and hackishly when you use gmp\_add instead of a normal +. I'm sure there's a C++ wrapper somewhere.
Boost 1.53 or higher has multiprecision. <http://www.boost.org/doc/libs/1_54_0/libs/multiprecision/doc/html/index.html>
17,474,793
Currently we have a splash screen that is displayed in our app. However, if there is no data to be gathered or processed that is waiting, we'd like to go straight into our first activity. Is there a way to do that without having the splash screen flash? The AndroidManifest.XML of the splashscreen portion is as follows...
2013/07/04
[ "https://Stackoverflow.com/questions/17474793", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1176436/" ]
Given that the launcher will start the activity you specify in your Manifest, it's not possible to set conditions on whether that activity will be started (or another). So you're left with the options as Richard Le Mesurier and dors suggest: 1. Start the main Activity, then launch the Splash Activity if needed 2. Sta...
You can do something like this: 1. Your Splash Screen is the main activity (Launcher-Category) 2. If your splash screen can load data (or whatever your splashscreen does), do it. After finished, close the spalsh screen (call finish()) and start the real first activity and pass the data as intent extra. 3. If your spla...
9,684,478
Happily using `Rinku` gem to autolink my text. This is helpful when someone pastes in a URL in a comment - `Rinku` will autolink that URL. However, really long URLs are messing with the page layout. It would be helpful for every hyperlink encountered: * Shorten the hyperlink text * Keep the underlying hyperlink e.g....
2012/03/13
[ "https://Stackoverflow.com/questions/9684478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/625666/" ]
[Looks like](https://github.com/tanoku/rinku/blob/master/README.markdown) Rinku supports customization of the link text: ``` auto_link(text) do |url| url.truncate :length => 15 end ```
Not sure about Rinku, but you could easily do this from within the view: ``` <% trunk_url = truncate(url, :length => 15) %><%= link_to(trunk_url, url) %> ``` Basically, truncate the url itself into a string (trunk\_url), then use that as the text for the link\_to. In my case, the url was a field (tm.website). Works ...
31,541,489
I'm trying hard to get the modification date from a MP4 file hosted on my server. I tried the following library: ``` ffmpeg -i video.mp4 ``` Without any luck. All I get is duration and a few other fields but I'm not able to get modification date. I tried ffprobe as well and it is not there either. Any suggestions?...
2015/07/21
[ "https://Stackoverflow.com/questions/31541489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3280699/" ]
I checked for you, and indeed, mp4 has a modification time entry in the MDHD, but it's not exported (see [code](http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/mov.c;h=92bf2f894099f0e4d50b6184f19852769c372139;hb=HEAD#l1045)). You can file an [enhancement request](https://www.ffmpeg.org/bugreports.html) to ge...
A simpler alternative to aergistal in terms of output is ```sh $ ffprobe -v quiet -select_streams v:0 -show_entries stream_tags=creation_time -of default=noprint_wrappers=1:nokey=1 input.mp4 ``` which will just print the creation time like so: ``` 2020-07-23T11:51:02.000000Z ```
493,071
I have a minimal CentOS 6.3, 64 bit acting as gateway with 4 NIC (1 Gbps), each bonded together one for public traffic and other for private, which performs NATing. It has 6 GB RAM and 4 logical cores. We have been using this for the past two years without any problems. I don't have any experience with hardware router...
2013/03/28
[ "https://serverfault.com/questions/493071", "https://serverfault.com", "https://serverfault.com/users/133041/" ]
"Other than IOS" ? IOS makes almost all the difference. CentOS is a general-purpose operating system. It's designed to perform well enough under a very wide range of scenarios, using a vast array of different hardware configurations. IOS on the other hand is extremely fine tuned to handle only the kind of workloads yo...
AFAIK, it's the overhead of a general-purpose operating system; regardless of how fast your connections, the packets are dealt with on a packet-by-packet basis within the kernel's context, increasing latency and strain on the system. I believe it's been already explained in the other Answers better than I could do. Ha...
60,695
So I was thinking about how I could make a responsive menu a better experience rather than just firing it into a drop down on mobile that has a hamburger as an icon. Would it perhaps be a better user experience to limit the amount of navigation items, for example if you had: (We'll use this site as an example) Quest...
2014/07/02
[ "https://ux.stackexchange.com/questions/60695", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/51171/" ]
Paddi MacDonnell wrote an interesting [article on the hamburger menu](http://www.webdesignerdepot.com/2014/06/how-to-solve-the-hamburger-icon-problem/) and related mobile-first approaches to design a few days ago: It outlines some of the problems of hamburger menus, and concludes with the observation that the device i...
I'd prefer expandable and collapsible parent menu items on mobile devices. Each parent item that is expanded, automatically closes any others. This keeps the navigation compact and user friendly across mobile devices. Whether you trigger this menu via a hamburger icon or otherwise is just one option of many but at lea...