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
15,821,461
I am currently learning javascript. I have created a calculator to find invesment future value. It is giving me an incorrect value when it displays the `future value`. I have checked the formula several times but it still gives me an error. Also, I have set alerts to appear if the interest is less than `0` or greater t...
2013/04/04
[ "https://Stackoverflow.com/questions/15821461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1513531/" ]
Using `.value` is incorrect, its javascript, while this is jquery, try adding a `#` in front and use `.val()` instead. Its similar to this: [jquery function val() is not equivalent to "$(this).value="?](https://stackoverflow.com/questions/4524702/jquery-function-val-is-not-equivalent-to-this-value) EDIT He's not u...
If I remember the future value correctly, you are messing up the formula, which is why you aren't getting the expected value. Change: ``` for ( i = 1; i <= years; i++ ) { futureValue = ( futureValue + investment ) * ( 1 + annualRate ); } ``` To: ``` futureValue = investment*Math.pow((1+...
70,601,691
I am trying to build a simple bot that can kick, ban, and say "Hi" to a member. Kick and ban work perfectly fine and do their job, but when I add an "on\_message" function, the on\_message function works but cancels out kick and ban. Any ideas? My code: ``` import discord from discord.ext import commands bot = comma...
2022/01/06
[ "https://Stackoverflow.com/questions/70601691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16979809/" ]
When you define a variable as a union, it means that that variable can be any of the items within the union. Therefore, TypeScript will assert that an operation is valid for all types within the union before you are able to do it. Therefore, if you did want your code to work when you know the type of the config at comp...
You are using your `typeCheck` like this: ```js console.log(typeCheck.test.run) ``` This statement presupposes that `typeCheck.test` has a `run` property. At the same time `TestConfig` hasn't one. So it's a contradiction, because any variable of `MixConfig` type could have a `test` of `TestConfig`. Thus to have thi...
21,623,614
I need to find the first set bit in a binary number from right to left; I came up with this solution: ``` int cnt=0; while (number& 1 ==0) { cnt++; number>>=1; } ``` Is there a better way of doing it? Some clever bit manipulation technique?
2014/02/07
[ "https://Stackoverflow.com/questions/21623614", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If you want it to be fast, bitscan instruction (`bsf`, `bsr`) or [bit-twiddling hack](http://graphics.stanford.edu/~seander/bithacks.html) is the target to go. **EDIT: The idea of using switch-case table to improve performance is nothing but immature.**
Your code ``` int cnt=0; while (number& 1 ==0) { cnt++; number>>=1; } ``` has a bug. For example if number is equal to 0 then the loop will be infinite. I would rewrite it the following way ``` int cnt = 0; if ( number ) while ( !( number & ( 1 << cnt++ ) ) ); ``` In this case if number is...
37,489,647
I have a DIV with an H2 inside. The DIV is completely separate from all the other work, placed at the bottom of the HTML, yet for some reason it is sticking to the top of the page, inside one of the other DIVs. I've tried Googling but to no avail, I need it below the background to start working on a new section. What s...
2016/05/27
[ "https://Stackoverflow.com/questions/37489647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6012587/" ]
I use both IBM MQ and ActiveMQ on a regular basis. This example below will show you some sample configuration options. Please make sure you configure these to your own use cases. ``` //ActiveMQ connection factory <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" destroy-method="doStop">...
You can use users camel extra component <https://github.com/camel-extra/camel-extra/blob/master/components/camel-wmq/README.md> to get messages from wmq without using the JMS wrapping and then send messages to ActiveMQ with custom camel component <https://camel.apache.org/components/latest/activemq-component.html>. See...
555,010
Until this morning, I'd been using sshfs quite nicely to mount a directory from a linux machine in my office. Today, it stopped. Here's my sshfs command: ``` sshfs -osshfs_sync,volname=linux-builder3 linux-builder3:/home/cnorum /Users/carl/linux-builder3 ``` I get this error, but the sshfs process seems to still be ...
2013/02/20
[ "https://superuser.com/questions/555010", "https://superuser.com", "https://superuser.com/users/12727/" ]
I think it's fixed. I had this line in the `.bashrc` on the linux box: ``` CLIENT_PATH_PREFIX="$(ssh ${CLIENT_ADDR} 'echo ${SSHFS_PATH_PREFIX}')/$(hostname)/$(whoami)" ``` It didn't need to be run by non-interactive shells, so I pushed that off to a different file, and it's better now. I don't really understand *why...
My problem was that the RSA host key for my host changed, so I had to run ``` ssh-keygen -R site.com ```
50,908,313
This is often suggested, as a way to initialize a struct to zero values: ``` struct foo f = {0}; ``` It is also mentioned that `{}` could be used under gcc, but that this is not standard C99. I wonder if this works for a struct whose layout may vary outside my control. I'm anxious because `0` is not a valid initial...
2018/06/18
[ "https://Stackoverflow.com/questions/50908313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/799204/" ]
Yes. Inside an initialization list, "missing braces around initializer" is allowed by the standard. C99: > > If the aggregate or union contains elements or members that are aggregates or unions, > these rules apply recursively to the subaggregates or contained unions. > If the initializer of > a subaggregate or c...
`= {0}` tells the compiler to perform *aggregate initialisation*, and the first member is set to the value that it would be assumed if the `struct` had static storage duration. In such an aggregate initialisation, if there are fewer initialisers in the list than there are members in the `struct`, then each member not ...
11,324,640
I want to check if a web host is available so i used the code down below, it works, but sometimes if the site is slow in response it keep waiting, how do i implant a timeout into it? if no response from the host withen 2-3 second, return false also. Please help me out ``` - (BOOL)isDataSourceAvailable { static B...
2012/07/04
[ "https://Stackoverflow.com/questions/11324640", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1480092/" ]
You need to find a way to identify a "checkbox set" use the object spy or a dom inspector to see what identifies the set (probably some kind of `div` or `span`) for the sake of this answer I'll assume that it's a `div` with a specific `class` `"chkbxGrp"`. Then look for the first checkbox contained within this group a...
You can "identify" the checkbox using QTP index. It's not the best option to do, though if you need only the 1st checkbox. Just look for all Objects on the page of a type "CheckBox", and if the result set > 0, get the first one. The second option is to "locate" the Checkbox by the nearby elements, but in this case you...
35,463,769
I am trying to extract substring like \*\*\*.ini from string. For example, I have ``` 000012: 378:210 File=test1.ini Cmd:send command1 000512: 3378:990 File=test2.ini Cmd:send command2 File=not.ini Cmd: include command ``` I need to extract the substring after the first "File=", and the substring after the firs...
2016/02/17
[ "https://Stackoverflow.com/questions/35463769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1558064/" ]
run below query ``` select * from sys.databases ``` it shows all the information for a database. there is no unique information for database but name and database\_id BTW, I don't know why you are concern about it!
This query returns the GUID you need, for the current Database. ``` SELECT database_guid FROM sys.database_recovery_status WHERE database_id = DB_ID() ``` Of course the user can always rename his database after this GUID.
16,124,821
I wonder how to convert a string to an HTMLElement ? I have tryed : ``` $('<i data-icon="'+icon+'" class="smiley-big"></i>') ``` But in console it shows type: [object Object] If I log existing ellements in the Dom like this: ``` $('[class^="smiley"]').each(function(){ console.log(this); }); ``` I get [objec...
2013/04/20
[ "https://Stackoverflow.com/questions/16124821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2071284/" ]
My Idea would be something like: **Short version:** 1. change task interval to 1 minute; 2. add `unsetAllTokensIfNeeded` method to `SessionTokenService` that will be invoked every minute but will just clean the tokens list if it is really needed (in this case the decision is done based on the time). **Detailed Versi...
It seems the token remover periodic job you setup did not run in the context of a particular user session -- nor all user sessions. I'm not sure if there's any mechanism for you to scan through all active sessions and modify it, however the alternative I'm proposing is: Store a pair of unique token with a timestamp ...
205,664
How do I remove Windows Mobile Device Center from Windows 7? When I connect any mobile device, I don't want Windows Mobile Device Center to pop up, like ActiveSync 4.5 did.
2010/11/01
[ "https://superuser.com/questions/205664", "https://superuser.com", "https://superuser.com/users/22580/" ]
User [flapjack](http://forum.xda-developers.com/member.php?u=574279)'s solution on [xda-developers forum](http://forum.xda-developers.com/showthread.php?t=394984): > > I was able to fix this. First, I > stopped and disabled both WMDC > services under Computer Management > > Services. Then, I found mobsync.exe in >...
Another user from the xda.developers forums has created a program that achieves just what you're looking for: <http://forum.xda-developers.com/showpost.php?p=1843786&postcount=2>.
70,537,742
I have a block of text in a .txt file that reads: OVERVIEW OF FINDINGS --datatext1 OVERVIEW OF FINDINGS --datatext2 OVERVIEW OF FINDINGS --datatext3 SUMMARY OF FINDINGS OVERVIEW OF FINDINGS can happen a random number of times, or only once. I am ONLY interested in datatext3 (a variable amount of text). That is,...
2021/12/30
[ "https://Stackoverflow.com/questions/70537742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17500135/" ]
Regular expressions aren't necessary here; just split the string on the substrings you're looking for. ``` start = 'OVERVIEW OF FINDINGS' end = 'SUMMARY OF FINDINGS' result = text.split(start)[-1].split(end)[0].strip() ```
If you're open to using regular expressions, we can use `re.findall` here: ```py inp = """OVERVIEW OF FINDINGS --datatext1 OVERVIEW OF FINDINGS --datatext2 OVERVIEW OF FINDINGS --datatext3 SUMMARY OF FINDINGS""" text = re.findall(r'\bOVERVIEW OF FINDINGS\b(?!.*\bOVERVIEW OF FINDINGS\b)\s*(\S+)\s+SUMMARY OF FIND...
92,288
In the EU, a person will soon be able to perform certain activities (going to concerts, to sports events, etc.) only if they can present a valid Green Pass that certifies that the bearer has been vaccinated, or has recovered from Covid, or has been tested negative in the recent past. The Green Pass is basically a QR c...
2021/07/27
[ "https://crypto.stackexchange.com/questions/92288", "https://crypto.stackexchange.com", "https://crypto.stackexchange.com/users/92940/" ]
The [specification](https://github.com/ehn-dcc-development/hcert-spec/releases/download/1.0.5/dgc_spec-1.0.5-final.pdf#page=6) mentions that the signature is per [ECDSA](https://www.secg.org/sec1-v2.pdf#subsection.4.1) on curve "P-256" (aka [secp256r1](https://www.secg.org/sec2-v2.pdf#subsection.2.4)), or [RSASSA-PSS](...
Answering the question what is broken, with focus on cryptographic aspects: "Green Pass" title implies **yes/no decision**, while the application actually **scans** the name, birthday, and vaccination info from QR-code, and **prints** it in cleartext. To achieve the goal, it requires infrastructure like **publicly acc...
32,885,630
When trying to map, I got this error: > > Association references unmapped class: System.Object > > > My class: ``` public partial class MessageIdentifier { public virtual int ID { get; set; } public virtual object Item { get; set; } } ``` And the convention: ``` public class MyUsertypeConvention : IPr...
2015/10/01
[ "https://Stackoverflow.com/questions/32885630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5210986/" ]
As a simple *(quick, naive)* solution - I would suggest to create and map real `string` property. And then let your *setter* and *getter* *(or some AOP or listener)* to do the "to/from string conversion": ``` public partial class MessageIdentifier { public virtual int ID { get; set; } public virtual object Ite...
Not a satisfactory answer. It doesn't work with class that is generated from xsd by using XML. You can try the following: ``` public partial class MessageIdentifier { public virtual int ID { get; set; } private object itemField; public object Item { get { return this.itemField; } set { ...
36,389,377
``` class BO2Offsets { public: struct Prestige { u32 Offset { 0x000000 }; char One { 0x01 }, Two { 0x02 }, Three { 0x03 }, Four { 0x04 }, Five { 0x05 }, Six { 0x06 }, Seven { 0x07 ...
2016/04/03
[ "https://Stackoverflow.com/questions/36389377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5898943/" ]
You need a `typedef` there. What you have right now is a variable declaration. Change `BO2Offsets BO2;` to `typedef BO2Offsets BO2;` --- As to your second question, you can't use `Prestige` like that because it is not data member. If you need to access the inner type, you need `BO2Offsets::Prestige::Offset`
BO2 isn't type, is only variable name, and compiler want type. use ``` BO2Offsets * B03; ``` EDIT: in the second place use ``` BO3->Prestige.anyName.Offset; ``` EDIT2; OK folks, if everyone edit his contents, I edit too: struct is improperly introduced, field cannot bee accessed. Now such concept compiles OK on...
38,668,067
I am new to programming and was trying to solve a problem. What I want is to have two loops simultaneously decreasing. ``` for i in range(1000,100,-1): for j in range(1000,100,-1): product=j*k ``` If I'am not wrong, this would give me 1000\*1000, 1000\*999, 1000\*998 and so on. What if I want...
2016/07/29
[ "https://Stackoverflow.com/questions/38668067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6656096/" ]
For this case, you should just use one loop: ``` for i in range(1000, 100, -1): product = i*i ... ``` For the general case of wanting to advance two loop variables simultaneously instead of nesting the loops, you want `zip`: ``` for i, j in zip(some_iterable, some_other_iterable): ... ```
I do not see the point why you should need two loops surely you would do: ``` for i in range(1000,100,-1): product=i*i ```
1,971,141
Is it possible to add a button to a tabbed pane like in firefox. ![enter image description here](https://i.stack.imgur.com/vtVsG.png) The plus-button is what I want. Thanks
2009/12/28
[ "https://Stackoverflow.com/questions/1971141", "https://Stackoverflow.com", "https://Stackoverflow.com/users/155137/" ]
I think you should be able to manage it by building your own `JTabbedPaneUI` and setting it on the `JTabbedPane` using `setUI`. Your `ComponentUI` has methods to get a hold of the accessible children. If you specify a `JButton` and a `JLabel` then you may be in business. I haven't attempted this myself though. This i...
I have tried several solutions and came with this one: ``` import java.awt.Dimension; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; public class TestTab { public static void main(String[] args) { JFrame parent = new JFrame(); fina...
9,072,563
Take this code: ``` var obj = { init: function(){ console.log(obj.count); //or console.log(this.count); }, count: 1, msg: 'hello' } obj.init(); ``` I can access property of obj by `this` or the variable name `obj` both. Is there any advantage in using **`this`** ? Because in my opinion using th...
2012/01/30
[ "https://Stackoverflow.com/questions/9072563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/702469/" ]
As already mentioned in paislee's answer, this is a variation on the [knapsack problem](https://en.wikipedia.org/wiki/Knapsack_problem). In fact, this specific problem is called the [subset sum problem](https://en.wikipedia.org/wiki/Subset_sum_problem), and like the knapsack problem, it is NP-complete. The linked Wiki...
Read other answers/comments first. Here is a solution that could be used for a *small* set of data. ``` double[] nums = new double[] { 10,20,30,40,50,60,70,80,90,100,150,200,250,300,400,500}; Parallel.ForEach(GetIndexes(nums.Length), list => { if (list.Select(n => nums[n]).Sum()==350) { Console.WriteL...
3,812,621
The idea is simple - I have two tables, categories and products. Categories: ``` id | parent_id | name | count 1 NULL Literature 6020 2 1 Interesting books 1000 3 1 Horrible books 5000 4 1 Books to burn 20 5 NULL Motor...
2010/09/28
[ "https://Stackoverflow.com/questions/3812621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/371707/" ]
As you havent accepted an answer yet i thought i'd post my method for handling trees in mysql and php. (single db call to non recursive sproc) Full script here : <http://pastie.org/1252426> or see below... Hope this helps :) **PHP** ``` <?php $conn = new mysqli("localhost", "foo_dbo", "pass", "foo_db", 3306); $res...
What you want is a common table expression. Unfortunately it looks like mysql doesn't support them. Instead you will probably need to use a loop to keep selecting deeper trees. I'll try whip up an example. To clarify, you're looking to be able to call the procedure with an input of say '1' and get back all the sub c...
4,644,929
What regular expression would match any characters (including spaces), but have a maximum of 255 characters? Is this it? ``` ^[a-zA-Z0-9._]{1,255}$ ```
2011/01/10
[ "https://Stackoverflow.com/questions/4644929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/495365/" ]
Well, *anything* would be: ``` ^.{1,255}$ ``` `.` doesn't allow new lines. If that's a problem, you can use the dot-all flag (usually `/s`). If you want to add spaces to your regex, try this (note the space): * `^[a-zA-Z0-9._ \t]{1,255}$` - Allow spaces and tabs. * `^[a-zA-Z0-9._\s]{1,255}$` - Allow all whitespace...
Well that would not allow anything, if you want anything, you're better off using `^.{1,255}$`. Or, if you want to allow nothing as well: `^.{0,255}$`
15,376,688
I have a program that I'm trying to use which crashes often, and one of the fixes for this is to set it to only use one processor. I can easily do this through task manager manually, but I'd much prefer a solution along the lines of doubleclicking a shortcut. I've tried making at .bat file with this line of code: C:\W...
2013/03/13
[ "https://Stackoverflow.com/questions/15376688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2163655/" ]
I just ran into this same issue myself trying to run KSP on an older Win XP 32-bit rig. cmd.exe did not receive the /affinity switch until Vista, IIRC. I realize OP is over a year old, however it is still currently an issue for some users. The solution is to use psexec.exe from Sysinternals in lieu of cmd.exe, which c...
first be aware, you have to provide Administrator right to your program, either by right clic, and sart as admin, or by creating a task. So, after you started your cmd with those admin right, you can start your program this way: ``` <code>`start /AFFINITY 1 /B notepad.exe`</code> ``` Using procexp, and right click ...
10,651
How do you justify new purchases? Do you set guidelines for yourself? "After this project, you get a new toy/tool"? Or, "Because of this new project, you get a new toy/tool"? Or do you have strict boundaries about what new tools you allow into your arsenal?
2011/10/02
[ "https://sound.stackexchange.com/questions/10651", "https://sound.stackexchange.com", "https://sound.stackexchange.com/users/28/" ]
I;ve said this before in another answer about going debt. I think it still applies: One of the rules i've learned to follow is this: "Will spending this amount of money, on that piece of gear, allow me to work better/faster/for other people/projects? If the answer is yes and you have the money reserved, do it. If in d...
The greatest asset and piece of gear is the mind and experience.
41,985,466
I'm currently doing some tests to see if my app runs correctly on Retina Macs. I have installed Quartz Debug for this purpose and I'm currently running a scaled mode. My screen mode is now 960x540 but of course the physical size of the monitor is still Full HD, i.e. 1920x1080 pixels. When querying the monitor database...
2017/02/01
[ "https://Stackoverflow.com/questions/41985466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1197719/" ]
You need to examine the *mode* of the display, not just the display itself. Use `CGDisplayCopyDisplayMode()` and then `CGDisplayModeGetPixelWidth()` and `CGDisplayModeGetPixelHeight()`. These last two are relatively newer functions and the documentation primarily exists in the headers. And, of course, don't forget to ...
From Ken's answer it is not obvious how you find the native mode(s). To do this, call `CGDisplayModeGetIOFlags` and choose from the modes that have the `kDisplayModeNativeFlag` set (see `IOKit/IOGraphicsTypes.h`, the value is 0x02000000). ``` const int kFlagNativeMode = 0x2000000; // see IOGraphicsTypes.h const CGFlo...
17,196,117
Sometimes you need to check whether you Linux 3D acceleration is really working (besides the `glxinfo` output). This can be quickly done by the `glxgears` tool. However, the FPS are often limited to the displays vertical refresh rate (i.e. 60 fps). So the tool becomes more or less useless since even a software render c...
2013/06/19
[ "https://Stackoverflow.com/questions/17196117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/884474/" ]
The `vblank_mode` environment variable does the trick. You should then get several hundreds FPS on modern hardware. And you are now able to compare the results with others. ``` $> vblank_mode=0 glxgears ```
If you're using the NVIDIA closed-source drivers you can vary the vertical sync mode on the fly using the [`__GL_SYNC_TO_VBLANK` environment variable](http://us.download.nvidia.com/XFree86/Linux-x86_64/304.43/README/openglenvvariables.html): ``` ~$ __GL_SYNC_TO_VBLANK=1 glxgears Running synchronized to the vertical re...
22,650
Is there an XDM variant (kdm, gdm etc.) that allows graphical login without a physical keyboard? I have a tablet computer (like iPad, but Intel i5) running KDE and would prefer that users have to login to use it. However, the virtual keyboard is not available in the xdm screens I have seen. I could plug in keyboard, ...
2011/10/15
[ "https://unix.stackexchange.com/questions/22650", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/11146/" ]
I know that GDM in recent versions of Fedora runs a panel with accessibility options available so that an on-screen keyboard can be run. I'm not sure how it's configured to do so though.
If you are gdm user you can add some kind of onscreen keaboard or gesture grapper to `/etc/gdm/Init/Default` just before `exit 0` This [mini howto for screen keaboard](http://ubuntuforums.org/showpost.php?p=7959338&postcount=8) will give you examples how to do it with `kdm` and with different virtual keyboards. Here's ...
20,351,637
I'm trying to create a proxy server to pass `HTTP GET` requests from a client to a third party website (say google). My proxy just needs to mirror incoming requests to their corresponding path on the target site, so if my client's requested url is: ``` 127.0.0.1/images/srpr/logo11w.png ``` The following resource sho...
2013/12/03
[ "https://Stackoverflow.com/questions/20351637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2808025/" ]
Here's a more optimized version of Mike's answer above that gets the websites Content-Type properly, supports POST and GET request, and uses your browsers User-Agent so websites can identify your proxy as a browser. You can just simply set the URL by changing `url =` and it will automatically set HTTP and HTTPS stuff w...
Super simple and readable, here's how you create a local proxy server to a local HTTP server with just Node.js (tested on *v8.1.0*). I've found it particular useful for integration testing so here's my share: ``` /** * Once this is running open your browser and hit http://localhost * You'll see that the request hits...
55,598,481
I know there is a package called dart:convert which let me decode base64 image. But apparently, it doesn't work with pdf files. How can I decode the base64 PDF file in Flutter? I want to store it in Firebase Storage (I know how to do it) but I need the File variable to do it. I have a web service written in node js w...
2019/04/09
[ "https://Stackoverflow.com/questions/55598481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10405853/" ]
@SwiftingDuster a little added, maybe besides decoding, it's also necessary to create a pdf file and open it. ``` createPdf() async { var bytes = base64Decode(widget.base64String.replaceAll('\n', '')); final output = await getTemporaryDirectory(); final file = File("${output.path}/example.pdf"); await...
I think it's better to get the BufferArray and convert it into a pdf file. Check out my answer from here : [Get pdf from blob data](https://stackoverflow.com/questions/57111488/how-to-convert-bytebuffer-to-pdf/68320545#68320545)
432,176
If my service is inserting into a varchar column with a certain max length, I can either 1. validate its length prior to inserting to avoid getting an error from the database if the string is too long 2. try inserting it as is and then handle the error if the database say it's too long, and giving the consumer a valid...
2021/09/23
[ "https://softwareengineering.stackexchange.com/questions/432176", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/276066/" ]
You should do ***both*** (and, if there's a web-based User Interface involved, you should be *limiting* the length of the input field *there* as well!) Yes, it means you have the length of this field defined in multiple places but that's no different to having field names in SQL in the Application code. If those becom...
This is not an answer to the literal question you posed, but based on the (supposedly) underlying requirement. You typically declare a varchar length because you know that longer strings are invalid for that field, because of some business logic / domain analysis. In my experience, all cases with a limited string len...
134,301
I would like to have some clarification on the below question and its given answer. > > Does the following statement agree with the views of the writer in given passage? > You have to answer, > > > * True: *If the statement agrees with the writer* > * False: *If the state does not agree with the writer* > * Not ...
2017/07/03
[ "https://ell.stackexchange.com/questions/134301", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/56324/" ]
The answer is **false**. The passage of text talks about the piano or saxophone being the lead instrument, but then says they were "replaced **or supplemented by** the guitar in the middle to late 1950s." If it only said "replaced", then you could make an argument for "not given", because the piano or saxophone being ...
I think the teacher had a point. It is highly possible that the lead instrument thing was all but a distractor. Closely look at the statement: Guitar was used in **rock and roll from the 1940s.** The statement implies 2 aspects: * Firstly, rock and roll **has been around from the 1940s**. * Secondly, guitar was avai...
564,922
I keep getting this error when I start Android Studio. I am running Ubuntu, I did a fresh install and this happened upon start up. > > ADB not responding. If you'd like to retry, then please manually kill > "adb" and click 'Restart' > > > I have [tried](https://stackoverflow.com/questions/22381790/adb-not-respon...
2014/12/24
[ "https://askubuntu.com/questions/564922", "https://askubuntu.com", "https://askubuntu.com/users/299593/" ]
I had same problem while configuring Android Studio. I tried following command in terminal. ``` sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6 ``` If that doesn't helps make sure that "adb" in "AndroidStudioSdk/platform-tools/" folder is executable. If its executables permission are not set tha...
I've been having this same problem but under a Linux system (32-bit), after searching t'interweb and finding nothing that helped me I went about fixing this issue myself. I found that if I try to execute certain binaries that are bundled with Android Studio they would not execute, infact both adb and java threw the sa...
3,799
I've got following problem: - We have set of N people - We have set of K images - Each person rates some number of images. A person might like or not like an image (these are the only two possibilites) . - The problem is how to calculate likelihood that some person likes a particular image. I'll give example...
2010/10/20
[ "https://stats.stackexchange.com/questions/3799", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/1643/" ]
I used Lisrel, AMOS, Mplus before but only R. In R, one can do almost every step to fit SEM with the data, from exploring pattern to fitting the model and improving the model. Recently (2012), there are many new R packages and updated ones, which allow us to fit SEM intuitively. Moreover, R is free and open-source so...
THANK-YOU!! I tried a few of these but the free software Dia is all I need to draw my structural equation model (4 latent variables). I viewed a few Youtube tutorials and went to the wiki as needed <https://wiki.gnome.org/Apps/Dia/Documentation> I did this in an evening or in about 3 hours had my full model developed a...
20,635
This question has been nagging me for ages. I've read a lot of Sheldon Brown's site and actually tend to use bikes from the 70s-80s because they're more economical for daily use and especially for a student like me. But I've noticed that *some* of his opinions can be controversial (his discussion of "lawyer lips"), c...
2014/03/08
[ "https://bicycles.stackexchange.com/questions/20635", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/8649/" ]
Sheldon Brown was a good man, a good cyclist, and he spent an inordinate amount of time writing answers for everybody to questions that every new cyclist has. In a lot of ways, his answers were pretty dead on. However, like any person with the energy and commitment that Mr. Brown showed with his site, he was very opin...
Every theory in science can be discussed. No one can say something absolute - even things, that looks now like "the only truth", can be overridden the next year (or even before). Sheldon Brown was a great bicyclist, that knew the theory and physics of bikes. He also was a rider with lot of experience in it. He wrote...
17,601,473
I'm creating a batch to turn my laptop into wifi an make my life easier to type lines in cmd each time. The trouble is the wifi name always get set to **key=** insted of the one which I enter. Here is what I did: ``` @echo OFF set /p option="Enter 1 to create wifi, Enter 2 to stop wifi " IF %option% EQU 1 ( set...
2013/07/11
[ "https://Stackoverflow.com/questions/17601473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/809307/" ]
``` @echo off setlocal enabledelayedexpansion SET /P myvar="Enter variables: " set argCount=0 for %%x in (%myvar%) do ( set /A argCount+=1 set "argVec[!argCount!]=%%~x" ) echo Number of processed arguments: %argCount% for /L %%i in (1,1,%argCount%) do ( echo %%i- "!argVec[%%i]!" ) ``` The result of call...
Here is another way to do it. I also removed the spaces around ssid= and key= as that may be an issue. ``` @echo OFF set "option=" set /p "option=Enter a name to create wifi, or just press Enter to stop wifi: " IF not defined option ( netsh wlan set hostednetwork mode=disallow goto :EOF ) set /p key="Set passwor...
20,028,186
``` public class Employee2 implements java.io.Serializable { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } ``` i first serialized the Employee2 object.Then added one more field i.e age under Employee2. Now deserialize the Emp...
2013/11/17
[ "https://Stackoverflow.com/questions/20028186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/802050/" ]
Look again. 'Long' isn't the same as 'long', and 1L isn't the same as -342194960183674221L, which is what is in the stream.
An serialVersionUID is a hash of its originating class. If the class is updated, for example with different fields, the serialVersionUID can change. You have four (at least) possible courses of action: 1. Leave out the serialVersionUID. This tells the runtime that there are no differences between versions of classes w...
49,292,556
I have to project some fields of javascript to new object. for example I have a below object ``` var obj = { fn : 'Abc', ln : 'Xyz', id : 123, nt : 'Note', sl : 50000} ``` and i want new object containing `fn and id` ``` var projectedObj = { fn : 'Abc', id : 123 ...
2018/03/15
[ "https://Stackoverflow.com/questions/49292556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4231809/" ]
Just loop through the projection object and get the keys projected. For example, ``` function project(obj, projection) { let projectedObj = {} for(let key in projection) { projectedObj[key] = obj[key]; } return projectedObj; } ```
As an alternative approach of not passing in a projection object but instead listing up the properties to project as a comma separated string, this module can do that. Note that this module supports not object, but arrays. ``` var linqmodule = (function() { projection = function(members) { var membersArray ...
4,631,960
I just want to be able to split my VIM buffers/windows vertically and/or horizontally with a keyboard shortcut. I would like to use the following shortcuts: Vertical split ``` ,v ``` Horizontal split ``` ,h ``` That would be a **,** *(comma)* followed by a **v** to vertically split a buffer & **,** (comma) foll...
2011/01/08
[ "https://Stackoverflow.com/questions/4631960", "https://Stackoverflow.com", "https://Stackoverflow.com/users/523883/" ]
``` nnoremap ,v <C-w>v nnoremap ,h <C-w>s ```
``` nnoremap ,v :vsplit<CR> nnoremap ,h :split<CR> ```
32,489,812
First off, I'm new to the Entity Framework and am migrating an existing project from a database framework that I wrote myself so I have a fair amount of flexibility in the solution I choose. From what I've researched so far everything appears to be set up correctly. However, when my database is constructed, the table ...
2015/09/09
[ "https://Stackoverflow.com/questions/32489812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5318738/" ]
I had a similar case where I needed such a functionality. What I did was to add an event to the cell and consume it in my `UITableViewSource` which has a reference to the controller.
If you want to maintain an iOS feel, you would use the iOS Delegate pattern (see the section on [Events, Delegates and Protocols](https://developer.xamarin.com/guides/ios/application_fundamentals/delegates,_protocols,_and_events/) on the Xamarin site). Basically, you would declare a protocol (an Interface in C# parlan...
287
There are a lot of companies that provide domain whois but I've heard of a lot of people who had bad experiences where the domain was bought soon after the whois search and the price was increased dramatically. Where can I gain access to a domain whois where I don't have to worry about that happening? **Update:** **...
2010/07/08
[ "https://webmasters.stackexchange.com/questions/287", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/120/" ]
I'm a little surprised that no one has mentioned the official [ICANN whois lookup website](https://whois.icann.org/en).
I have registered 100+ domains with both Namecheap and GoDaddy and I have never faced this types of issue. I think this happens with only small comapnies. So if you check it on big companies like NameCheap or GoDaddy, you won't face this problem.
26,768,167
I have searched extensively for a relevant answer, but none quite satisfy what I need to be doing. For our purposes I have a column with a 50 character binary string. In our database, it is actually hundreds of characters long. There is one string for each unique item ID in our database. The location of each '1' fl...
2014/11/05
[ "https://Stackoverflow.com/questions/26768167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4220466/" ]
You aren't loading the jquery-ui properly. You need a closing bracket.
HTML: ``` <input type="text" id="your_input" name="your_input" /> ``` JS: ``` <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css"> <script> $(fu...
68,844,811
In my Laravel (5.7) controller, I have set pagination + 'on each side navigation' to 2 items. However, this is not working on my view. I'm getting much more items than 2, which causes my window to break out on small mobile devices. What can be the cause of this and how can I fix it? I mean, I can get it fixed with CSS...
2021/08/19
[ "https://Stackoverflow.com/questions/68844811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15117732/" ]
First of all The laravel pagination ***onEachSide(x)*** has **leading and tailing parts besides the middle section**. Leading two pages and tailing two pages. You are trying with ***onEachSide(2)*** and on the 6th page. So now we try to look at the logic in pagination. In laravel when using ***onEachSide(2)*** it wil...
You should use `onEachSide` this in blade. Remove the `onEachSide` from the controllers. Using `onEachSide` in controllers will be helpful when you are creating APIs. Instead use `onEachSide` in blade file. ``` <section class="pagination"> <div class="container"> <div class="row"> <div class="...
66,801,794
I have a code in HomeController.php in the Laravel framework, but I could not access the index/homepage it redirects to the login page. what is the blunder I am committing? ``` <?php namespace App\Http\Controllers; use App\User; use Illuminate\Http\Request; class HomeController extends Controller { /** * Cr...
2021/03/25
[ "https://Stackoverflow.com/questions/66801794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15025906/" ]
The answer is simple. In the `__construct()` method, you specified that every function under this controller must use the `auth` `middleware`. This will redirect to `login` page is the user is not logged in. There are a number of ways to work around this, the first being to remove the `__construct` entirely. However, ...
Based on the code you posted, the homepage route is protected by the 'auth' middleware, which means users have to login to access the resource page (Home page), so you should first login and then it will direct you to the intended page. If you don't want the page to be protected, then you could either remove the `$this...
16,149,453
If user is inactive for some specific duration, then it should autometically log out. So how I can do this using codeigniter? OR how to check whether user is active or not after login on that site?
2013/04/22
[ "https://Stackoverflow.com/questions/16149453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2286294/" ]
You can save the time that your user logged-in in a `session` or a `cookie` Example: `$this->session->set_userdata('time', time());` and use a javascriptjQuery function (Exp. `$.getJSON('time.php', function (data) {alert(data.serverTime);});`) or anything else to check the current time. Then, log your user out when ne...
``` <?php $minutes=3;//Set logout time in minutes if (!isset($_SESSION['time'])) { $_SESSION['time'] = time(); } else if (time() – $_SESSION['time'] > $minutes*60) { session_destroy(); header(‘location:login.php’);//redirect user to a login page or any page to which we want to r...
26,773,830
I am doing ajax post to post the data from javascript in mvc4 but it fails with following exception ``` string exceeds the value set on the maxJsonLength property. Parameter name: input System.ArgumentException: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string...
2014/11/06
[ "https://Stackoverflow.com/questions/26773830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2826273/" ]
Hi @usFarswan this is exactly what I came across just half an hour ago , and the solution is <http://forums.asp.net/t/1751116.aspx?How+to+increase+maxJsonLength+for+JSON+POST+in+MVC3> And you can implement it like that, in **global.asax** add the following lines pointed by ///\*\*\*\*\*. ``` namespace MyWebApp { ...
there is a another setting in web.config which you can try to increase: ``` <system.web> // the default request size is 4096 KB (4 MB) this will increase it to 100 MB <httpRuntime targetFramework="4.5" maxRequestLength="102400" /> <system.web> ```
961,079
I have gotten the code to work so that when I press the button, "Add More", it adds more combo boxes to the form with the names dayBox1, dayBox2, and so on. This is the code for that: ``` private void addMoreBtn_Click(object sender, EventArgs e) { //Keep track of how many dayBoxes we have ...
2009/06/07
[ "https://Stackoverflow.com/questions/961079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49549/" ]
I know this is an old question but since it's one of the first results when searching for this issue I figured I should post what worked for me. I had a query that took less than 10 seconds when I used SQL Server JDBC driver but more than 4 minutes when using jTDS. I tried all suggestions mentioned here and none of it ...
Two connections instead of two Statements ========================================= I had one connection to SQL server and used it for running all queries I needed, creating a new Statement in each method that needed DB interaction. My application was traversing a master table and, for each record, fetching all relat...
67,549,532
I pass an array variable from PHP to JavaScript. My variable content in JavaScript console is: ``` [ { "function": "change", "parameter": "link", "err_msg": "It seems your input is not valid", "id": "element1" }, { "function": "change", "parameter": "check", "err_msg": "please enter a...
2021/05/15
[ "https://Stackoverflow.com/questions/67549532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7278940/" ]
Ok, this was an interesting challenge and though it seemed deceptively simple, I couldn't find a simple elegant way. Here's a working approach (though hardly elegant) that seems to not suffer from the race condition of using `PrefixUntilOutput`/`Concatenate` combo. The idea is to use `combineLatest`, but one that emi...
Edit ---- After stumbling on this [post](https://forums.swift.org/t/combine-what-are-those-multicast-functions-for/26677/12) I wonder if the problem in your example is not related to the `PassthroughSubject`: > > PassthroughSubject will drop values if the downstream has not made any demand for them. > > > and in...
59,944
I am using `emacs` under `iTerm2` on Mac. I am using mouse to scroll up and down. Please not that I haven't face with the issue when I remotely connected into a linux machine, which has exactly same emacs setup. When I scroll to bottom `OBB` character is generated and emacs is hangs. When I scroll to top section `OAA`...
2020/08/03
[ "https://emacs.stackexchange.com/questions/59944", "https://emacs.stackexchange.com", "https://emacs.stackexchange.com/users/18414/" ]
The Elisp code below shows how it can be done. First, some notes: 1. You can use the [`display` text property](https://www.gnu.org/software/emacs/manual/html_node/elisp/Replacing-Specs.html#Replacing-Specs) to replace characters visually with other text. 2. If you want to display the bullet in red, propertize the r...
This is a complementary answer to the one posted by Tobias. I noticed that the following worked for me too: ```el (setq red-unicode-dot (propertize "•" 'font-lock-face '(:foreground "red"))) (font-lock-add-keywords 'org-mode '(("^ *\\([-]\\) " (0 (prog1 () (put-text-property (match-be...
39,087,749
Of course I know a method to do this: ```cs /// <summary>Gets the number of bits needed to represent the number.</summary> public static int Size(int bits) { var size = 0; while(bits != 0) { bits >>= 1; size++; } return size; } ``` So the Size(15) returns 4, and Size(16) returns 5...
2016/08/22
[ "https://Stackoverflow.com/questions/39087749", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2266405/" ]
This isn't short, but it's quick (averaged over the full range of ints) ``` internal static readonly byte[] msbPos256 = new byte[] { 255, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,...
If you are looking for the the highest bit set, see [Find first set](https://en.wikipedia.org/wiki/Find_first_set). One possible implementation (does not handle zero input) is: > > > ``` > table[0..31] = {0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, > 8, 12, 20, 28, 15, 17, 24, 7, 19, 2...
25,191,697
My Idea is to give the User a chance to store a value (in my case an `int` how broad the `JFrame` should be, so that the next time he starts my .jar, I can make it that broad from beginning on and he hasn't got to resize it again). As it is only one single value, I would not like to have to write it into a separate fi...
2014/08/07
[ "https://Stackoverflow.com/questions/25191697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The Preferences class does this. You should not use it for more application specific values though. The size and location of the windows and such is what it is used for. ``` Preferences prefs = Preferences.userRoot(); prefs.put("AppWindowSize", "10"); prefs.get("AppWindowSize","DefaultValueHere"); ```
Can you do it? Yes. [You can put a properties file in your classpath and then use `getResourceAsStream` to load it from a package](https://stackoverflow.com/questions/333363/loading-a-properties-file-from-java-package). Should you do it? No. Consider the case where the user makes a mistake and sets their JFrame size ...
948,564
How do you code special cases for objects? For example, let's say I'm coding an rpg - there are N = 5 classes. There are N^2 relationships in a matrix that would determine if character A could attack (or use ability M on) character B (ignoring other factors for now). How would I code this up in OOP without putting sp...
2009/06/04
[ "https://Stackoverflow.com/questions/948564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/101823/" ]
Steve Yegge has an *awesome* blog post about the Properties pattern that you could use handle this. In fact, he wrote an RPG using it! <http://steve-yegge.blogspot.com/2008/10/universal-design-pattern.html> You might say player1 is a type1 and type1s can attack type2s and player2 is a type2, so unless there is some "...
I would (assuming C++) give each class a `std::string` identifier, returned by a getter method on the class's instance, and use a `std::map< std::pair<std::string, std::string>, ... >` to encode the special cases of relationship between classes, all nice and ordered in one place. I'd also access that map exclusively th...
19,087,710
We use Hibernate Search in our web application and following are releases which we are using: ``` hibernate-search-3.4.1.Final hibernate3.6.10.jar lucene-core-3.4.0.jar ``` Previously we had `lucene-core-3.1` but upgraded a couple of months ago because of another issue. Now I am getting following error very often. I...
2013/09/30
[ "https://Stackoverflow.com/questions/19087710", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2702510/" ]
Contrary to "[Dealing with line endings](https://help.github.com/articles/dealing-with-line-endings#platform-windows)", I would recommend to [*always* set `core.autocrlf` to `false`](https://stackoverflow.com/a/17628353/6309) (on Windows or any other platform): ``` git config --global core.autocrlf false ``` You don...
Welcome to Git. Here is one doc can help you set up your git conf file to handle this. Read it and practise you will love git. [Dealing with line endings](https://help.github.com/articles/dealing-with-line-endings)
6,709,440
i know that java programs are first compiled and a bytecode is generated which is platform independent. But my question is why is this bytecode interpreted in the next stage and not compiled even though compilation is faster than interpretation in general??
2011/07/15
[ "https://Stackoverflow.com/questions/6709440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/846744/" ]
You answered your own question. Byte code is platform independent. If the compiled code was executed then it would not work on every OS. This is what C does and it is why you have to have one version for every OS. As others have suggested, the JVM does actually compile the code using [JIT](http://en.wikipedia.org/wik...
Byte code is platform independent. Once compiled into bytecode, it could run on any system. As it says on Wikipedia, > > [`Just-in-time compilation (JIT)`](http://en.wikipedia.org/wiki/Just-in-time_compilation), also known as dynamic translation, is > a method to improve the runtime performance of computer program...
294,294
When I click on *Reports > Status report*, the *Install profile* field says *Snrub (snrub-"1.1)* (with exactly one double quote). Where is this value defined?
2020/06/05
[ "https://drupal.stackexchange.com/questions/294294", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/44582/" ]
please add at header: ``` Content-Type : application/hal+json ```
Did you check, maybe JSON data from the frontend doesn't cover inside of `JSON.stringify(...)` and you try to send regular data which not serialized for sending? I advice to make sure you stringify data before sending: `const data = {"some":"value"} JSON.stringify(data)`
24,611,993
I have three types of objects: **T, X and Y** * X creates object of type T on heap and this object is pointed to by private member pointer of class X * Y creates object of type X on heap but needs to manipulate heap object T created by heap object X + Y can either use a private member pointer to store copy of pointer...
2014/07/07
[ "https://Stackoverflow.com/questions/24611993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/238038/" ]
Method 1 sounds preferable. If type X allocates a type T member, the deletion of that T should absolutely happen in the destructor of type X. Otherwise, using Method 2, if you decide down the line to create a new type that has a member of type X, you will have to remember to delete the type T in the new constructor. Th...
Every thing must work on own task. In your case, Y call X destructor and X destroy its own resources.
965,623
I am creating a website that has an intro splash page that waits for 5 seconds before automatically sending the playhead to frame 17 if nobody has clicked the enter button doing the same thing. My code for this is here: function wait() { stop(); var myInterval = setInterval(function () { \_level0.menu\_number2 = 0; ...
2009/06/08
[ "https://Stackoverflow.com/questions/965623", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Try this code: it uses something called a closure (look it up if you're interested) ``` function wait(){ stop(); var myInterval = setInterval(function(){ _level0.menu_number2 = 0; gotoAndStop(17); clearInterval(myInterval); }, 5*1000); // stop for 5 seconds return function(){ cl...
You could always just clearInterval(myInterval) if they click the skip button. Or wrap it in a function unnecessarily: function stopwait(){ clearInterval(myInterval); }; To check the frame numbers you could use: if(\_root.\_currentFrame < 17)
7,122,544
Is there a better way to do this? ``` value = 10 train = [] storage = 12 another_var = 'apple' def first_function(value, train, storage, another_var) second_function(train, storage) third_function(train, storage, another_var) forth_function(value, another_var) end def third_function(train, storage, anoth...
2011/08/19
[ "https://Stackoverflow.com/questions/7122544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/417449/" ]
``` const date = new Date; let hours = date.getHours(); let status = (hours < 12)? "Morning" : ((hours <= 18 && hours >= 12 ) ? "Afternoon" : "Night"); console.log(status); ```
``` <SCRIPT LANGUAGE="JavaScript"> currentTime=new Date(); //getHour() function will retrieve the hour from current time if(currentTime.getHours()<12) document.write("<b>Good Morning!! </b>"); else if(currentTime.getHours()<17) document.write("<b>Good Afternoon!! </b>"); else document.write("<b>Good Evening!! </b>");...
4,682,180
Some PHP code I look at is littered with "<?php" and "?>" tags depending on whether it's outputting HTML or not. Is there any performance benefit to this rather than using echo to write the HTML? It makes the code extremely hard to read when the code's constantly switching between code and HTML via the "<?php" tag. No...
2011/01/13
[ "https://Stackoverflow.com/questions/4682180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/227086/" ]
No reason whatsoever apart from its beginners scripting, there just trying to get the results to the page without any architectural thinking or planning into the system into the long run. What you should be doing is splitting your design up away from your logical php code, and the design compilation should be done at ...
I don't have statistical data to back this up, but it's my understanding that it's more efficient to "turn off" php to output HTML rather than to use echo""; The reason being that when you run your html through echo tags, you're having PHP parse it out to display, while just putting it in the doc itself will let the br...
13,074,662
Hi I am trying to create a custom button. The button has basically two modes, pressed and not pressed. I have created an xml file named addtransaction which holds the two button images, the code is as follows ``` <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android...
2012/10/25
[ "https://Stackoverflow.com/questions/13074662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1753882/" ]
Try adding: ``` <item android:drawable="@drawable/some_drawable" /> ``` If this doesn't help, try these steps: 1. Remove the library declaration of the project. 2. Open the layout causing the error (the one which using the selector) in graphical layout. 3. Clean the project (Project -> Clean) 4. Close and reopen ec...
You say your drawable xml is named `addtransaction.xml` - in your layout file you reference it as `@drawable/trans`- So change that line to `android:background="@drawable/addtransaction"` and you should be done.
64,869,036
So i have the following JSON object: ``` var myObj = { Name: "Paul", Address: "27 Light Avenue" } ``` and I want to convert its keys to lowercase such that i would get: ``` var newObj = { name: "Paul", address: "27 Light Avenue" } ``` I tried the following: ``` var newObj = mapLower(myObj, function(f...
2020/11/17
[ "https://Stackoverflow.com/questions/64869036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7661005/" ]
```js var myObj = { Name: "Paul", Address: "27 Light Avenue" } Object.keys(myObj).map(key => { if(key.toLowerCase() != key){ myObj[key.toLowerCase()] = myObj[key]; delete myObj[key]; } }); console.log(myObj); ```
I can't reproduce your error, but if you want to lower the key than you should do: ```js var myObj = { Name: "Paul", Address: "27 Light Avenue" } function mapLower(obj, mapFunc) { return Object.keys(obj).reduce(function(result, key) { result[mapFunc(key)] = obj[key] return result; }, {}) } var newObj...
10,691,781
I have developed an app which shows the time in a full screeen. The hours minutes and seconds are displayed in the middle of the screen. So my objective is, when I long click any of the textviews be able to scrool it through all the screen, and place it where I want... I tried to find a proper code to apply to my app,...
2012/05/21
[ "https://Stackoverflow.com/questions/10691781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1354096/" ]
Add this to your onCreate: Better use FrameLayout itself. ``` txtHour.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub drag(event, v); return false; } }); ``` And this to your Ac...
``` public void drag(MotionEvent event, View v) { FrameLayout.LayoutParams params = (android.widget.FrameLayout.LayoutParams) v.getLayoutParams(); switch(event.getAction()) { case MotionEvent.ACTION_MOVE: { params.topMargin = (int)event.getRawY() - (v.getHeight()); params.leftMargi...
16,246,920
I'm not sure how to create a ConstantInt in LLVM- I know the number I would like to create, but I'm unsure how I can make a ConstantInt representing that number; I can't seem to find the constructor I need in the documentation. I'm thinking it has to be along the lines of ``` ConstantInt consVal = new ConstantInt(so...
2013/04/27
[ "https://Stackoverflow.com/questions/16246920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2077708/" ]
To make an a 32 bit integer: ``` llvm::ConstantInt::get(context, llvm::APInt(/*nbits*/32, value, /*bool*/is_signed)); ```
To create a `32-bit` integer constant: ``` llvm::Type *i32_type = llvm::IntegerType::getInt32Ty(llvm_context); llvm::Constant *i32_val = llvm::ConstantInt::get(i32_type, -1/*value*/, true); ```
17,251,177
Hi guys how do you produce a gridview where first row contains text and second row contains a combobox? i tried the code below but it renders the combobox control into a simple text saying the total item of the combobox. ``` // create columns DataColumn column1 = new DataColumn(); column1.Capt...
2013/06/22
[ "https://Stackoverflow.com/questions/17251177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2381378/" ]
* To pass the callback, use just `getPos` instead of calling the function right away. * Use proper syntax to declare properties in `PositionObj`. ``` PositionObj = { lat: null, lon: null, } ```
The callback should tell you that the request to get position information is asynchronous. This means that `getInfo()` does NOT set the values instantly, and therefore the following line cannot access the "new" values. Anything that relies on the result of an asynchronous function MUST be within the callback itself.
41,208,105
I know that MSVC compiler in x64 mode does not support inline assembly snippets of code, and in order to use assembly code you have to define your function in some external my\_asm\_funcs.asm file like that: ``` my_asm_func PROC mov rax, rcx ret my_asm_func ENDP ``` And then in your .c or .h file you define ...
2016/12/18
[ "https://Stackoverflow.com/questions/41208105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1483597/" ]
**No, there is no way to do what you want.** Microsoft's compiler doesn't support inline assembly for x86-64 targets, as you said. This forces you to define your assembly functions in an external code module (\*.asm), assemble them with MASM, and link the result together with your separately-compiled C/C++ code. The ...
Since the title mentions Visual Studio and not MSVC, I recommend installing Clang via the Visual Studio Installer. It can be used just like MSVC without needing to configure custom build tasks or anything and it supports inline assembly with Intel syntax and variables as operands. Just select "LLVM (clang-cl)" in `Pl...
71,718,167
I am getting the error > > ImportError: cannot import name 'escape' from 'jinja2' > > > When trying to run code using the following *requirements.txt*: ``` chart_studio==1.1.0 dash==2.1.0 dash_bootstrap_components==1.0.3 dash_core_components==2.0.0 dash_html_components==2.0.0 dash_renderer==1.9.1 dash_table==5.0...
2022/04/02
[ "https://Stackoverflow.com/questions/71718167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18391313/" ]
Jinja is a dependency of Flask and Flask V1.X.X uses the `escape` module from Jinja, however recently support for the `escape` module was [dropped in newer versions of Jinja](https://jinja.palletsprojects.com/en/3.1.x/changes/#version-3-1-0). To fix this issue, simply update to the newer version of Flask V2.X.X in you...
> > ImportError: cannot import name 'escape' from 'jinja2' > > > This happened to me using Voila with jupyter notebook and solved using method below: 1. going to this directory `C:\Users\admin\anaconda3\Lib\site-packages\nbconvert\filters\ansi.py` 2. adding this line to the first of file `from markupsafe import e...
43,179,497
In Selenium-java-3.0.1, I can use WebDriverWait.until for explicit waits: ``` new WebDriverWait(myChromeDriver, 30).until((ExpectedCondition<Boolean>) wd -> ((JavascriptExecutor) wd).executeScript("return document.readyState").equals("complete")); ``` Above code was running well in Selenium-java-3.0.1, until we upgr...
2017/04/03
[ "https://Stackoverflow.com/questions/43179497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3395053/" ]
You probably have old files and dublicate files that are conflicting. Change version package guava. Upgrade to guava-21.0.jar and this problem resoved. <https://github.com/SeleniumHQ/selenium/issues/3880> For me removing old selenium.jar files and pointing to latest folder did the job.
If you are using pom.xml and getting the same error again.Just go to C/user/yoursystemuser/.m2/repo/com/google/guava/guavaVersions. Delete all the previous versions of guava and keep latest. Below is the link to the dependency for guava.You might have to check your selenium version as well. <https://mvnrepository.co...
22,563,248
I need your help, there is an Fatal Error in my code. I don't know how to solve this problem... please help me out :) my code ``` public class MainActivity extends Activity { // button to show progress dialog Button btnShowProgress; // Progress Dialog private ProgressDialog pDialog; ImageView my_image; // Progress...
2014/03/21
[ "https://Stackoverflow.com/questions/22563248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3434011/" ]
You obviously have no need for the selected element, therefore i suggest instead creating your plugin on `$` directly rather than `$.fn` so that you don't waste time selecting elements that you'll never use. Pass in the context and selector through the options object parameter as an object. ``` $.myPlugin = function (...
Try this (edit) ``` (function($){ $.fn.myPlugin = function(options) { settings = { container : null }; var options = $.extend({}, settings, options); // Help!! I need another selector here! return $(options.container).on("click", function(){ alert('success!'); }); ...
54,902,621
I have a basic question. It is possible to send two parameter form POST method in Angular and Java Spring. One parameter is JSON object second is an image. I have a simple example in Angular to explain what I want: ``` addHero(file: File,category: CategoryModel): Observable<any> { const formdata: FormData = new FormD...
2019/02/27
[ "https://Stackoverflow.com/questions/54902621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11056703/" ]
You can always convert it to BASE64. Then it's a simple string which you can simply pass it within the JSON (or a different one). EDIT This is what i do in my case any time a user upload a file. Isimply transform the file chosen to a BASE64 string. There are some really nice resources out there about this. ``` onFil...
It depends on your backend. If it takes image as a multipartfile, you can't send json data with it. But you can append other values which is desired to the form data. If it takes image as a base64 file, you can use json object to send data.
56,154,957
I just did a fresh install of Windows 10 Pro version 1903 build 18362.116 and Visual Studio Code. Now the integrated terminal only launches externally. Pressing `Ctrl` + `~` results in this. [![vscode non-integrated terminal](https://i.stack.imgur.com/ia6WX.png)](https://i.stack.imgur.com/ia6WX.png) What am I missin...
2019/05/15
[ "https://Stackoverflow.com/questions/56154957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25197/" ]
OK, worked through this one [in VSCode repo issues](https://github.com/microsoft/vscode/issues/73790). For now, until it's fixed, turn off ConPTY integration in the User Settings. [![vscode conpty setting](https://i.stack.imgur.com/25xrV.png)](https://i.stack.imgur.com/25xrV.png)
The issue now says use legacy console. To change the setting open a cmd prompt. Right click the title to bring up properties. ![cmd properties](https://i.stack.imgur.com/EDTRl.png) Then Uncheck 'Use legacy console' ![Use legacy console](https://i.stack.imgur.com/pu3Zw.png)
47,880,571
I am trying to calculate in appended rows values. But, calculation scripts not working. Is there any confliction between jquery-slim and jquery? I am using bootstrap 4 and laravel framework for this project. I tried various jquery scripts for this calculation. But, did not work any. Would someone help me to complete th...
2017/12/19
[ "https://Stackoverflow.com/questions/47880571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7014431/" ]
You can use Pandas: ``` import pandas as pd l = [ ["Pakistan", 23], ["Pakistan", 127], ["India", 3], ["India", 71], ["Australia", 31], ["India", 22], ["Pakistan", 81] ] pd.DataFrame(l).groupby([0]).mean().idxmax().values[0] ``` Output: ``` 'Pakistan' ```
Another version (with stdlib only): ``` from __future__ import division import collections input= [ ["Pakistan", 23], ["Pakistan", 127], ["India", 3], ["India", 71], ["Australia", 31], ["India", 22], ["Pakistan", 81] ] t = collections.defaultdict(list) for c,n in input: t[c].append(n) max(...
53,533
Is there anything that will natively allow read/write on an ext2/3 partition within Snowie? Just don't want to get a Linux box to mount, and then access via samba. Although I could perhaps through VMware Fusion … and then share it back… Anyway to do this natively?
2009/10/10
[ "https://superuser.com/questions/53533", "https://superuser.com", "https://superuser.com/users/12555/" ]
I find the easiest and most reliable way to access linux ext3 partitions on my mac is to run Ubuntu in a vmware virtual machine on the mac. Once running you can connect Ubuntu to the ext3 drive via usb, and this way you can get complete reliability reading and writing to ext3 file systems. It's fast because the disk is...
fuse-ext2 works but is very slow (I get some 7 MB/s reading and 1 MB/s writing via USB 2.0). If you have the choice, better use Apple's HFS+ on the external drive, which is much faster (I get some 30 MB/s both reading and writing, both on Mac and Linux). HFS+ is supported by Linux mostly out-of-the-box. To get...
28,396,012
In `C` I have this `enum`: ``` enum { STAR_NONE = 1 << 0, // 1 STAR_ONE = 1 << 1, // 2 STAR_TWO = 1 << 2, // 4 STAR_THREE = 1 << 3 // 8 }; ``` Why is `1 << 3` equal to 8 and not 6?
2015/02/08
[ "https://Stackoverflow.com/questions/28396012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Shifting a number to the left is equivalent to multiplying that number by 2n where `n` is the distance you shifted that number. To see how is that true lets take an example, suppose we have the number `5` so we shift it `2` places to the left, `5` in binary is `00000101` i.e. > > 0×27 + 0×26 + 0×25 + 0×24 + 0×23 + ...
Think in binary. You are actually doing this. 0001 shifted 3 times to the left = 1000 = 8
4,037,993
The login form works fine, but any other form I submit (things like editing or creating data) I get a CSRF attack detected error. I have tried to clear symfony and browser cache, deleted cookies, tried multiple browsers and multiple computers. What can cause this? When I turn off the CSRF protection it works fine.
2010/10/27
[ "https://Stackoverflow.com/questions/4037993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459950/" ]
It's tough to answer this with the information provided. Here are two possibilities: * Are you sure the CSRF token is actually being submitted? * Is the same form processing both values? CSRF tokens in Symfony are generated from three things: the CSRF secret (set in app.yml), the session\_id, and the form class. Is on...
To check this, you should try running Fiddler while performing the POST and check the payload for %5B\_csrf\_token%5D={whateveryourtokenis}.
4,334,520
Why is the `load` event not fired in IE for iFrames? Please take a look at [this example](http://jsfiddle.net/Claudius/GTmKv/7/). Work perfectly as expected in FF and Chrome, but IE fails.
2010/12/02
[ "https://Stackoverflow.com/questions/4334520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/246277/" ]
IE might have already loaded the content (and fired the event) before you add the handler. I found that when I statically specified the iframe src attr, and added $(x).load event handlers via jquery, firefox (3.6.28) triggered my handlers but IE (8.0.6001.18702) didn't. I ended up adjusting my test program so that it ...
Seis's answer is the correct one, and can be improved to use non-global/anonymous functions. ``` window.dummy_for_ie7 = function() { } var iframe = $('<iframe onload="dummy_for_ie7" />')[0]; iframe.attachEvent('onload', real_event_handler) ``` To my surprise, this works. Note: iframe.onload = func() would NOT work,...
338,359
[Git for Windows](http://code.google.com/p/msysgit/) doesn't seem to support the extra context menu entries for "Git GUI Here" (or "Git Bash Here") when running on 64-bit systems. Is there some other way I can get an entry for "Git GUI" to show up in the context menu so that it will open the commit interface with the c...
2011/09/21
[ "https://superuser.com/questions/338359", "https://superuser.com", "https://superuser.com/users/51132/" ]
You can just type: `regsvr32 "%PROGRAMFILES%\git\git-cheetah\git_shell_ext64.dll"` in a console window (or use Win+R).
I had the same problem. After installing msysgit not in the normal program directory, everything works fine.
58,071
[In Trump's lawsuit in Arizona](https://lawandcrime.com/2020-election/trump-campaign-lawyer-admits-to-judge-our-search-for-evidence-of-fraud-produced-obvious-lies-and-spam/): > > A Trump campaign attorney conceded in court on Thursday morning that he tried to enter hundreds of dodgy form-filed affidavits into evidenc...
2020/11/14
[ "https://law.stackexchange.com/questions/58071", "https://law.stackexchange.com", "https://law.stackexchange.com/users/14414/" ]
To witness an affidavit? ------------------------ No. However, ... ------------ An affidavit is testimony-in-chief of a witness. Either: * that testimony is going to be tested under cross-examination. So, the lawyer that presents it better be pretty sure that their witness will not look like a liar. Or * for reaso...
> > Does a lawyer ordinarily need to take steps to determine that the > contents of an affidavit are actually true before submitting it > (rather than merely excluding ones determined to be false)? > > > Depends on the role of the lawyer. There can be two: 1. Lawyer who simply takes the affidavit from the person ...
735,821
This problem is designated for those who have the basic knowledge of floor brackets I know the answer will be 6. But tell me how.
2014/04/01
[ "https://math.stackexchange.com/questions/735821", "https://math.stackexchange.com", "https://math.stackexchange.com/users/132522/" ]
It is clear that $\dfrac{13x + 4}{3}$ must be an integer so $x$ must have the form of $2 + 3k$. Substitute this into the equation and now we must solve: $$\left\lfloor\frac{48+75k}{4}\right\rfloor = \left\lfloor 12 + \frac{75k}{4}\right\rfloor = 12 + \left\lfloor \frac{75k}{4}\right\rfloor = 13k + 10$$ $$ \left\lflo...
$\left[{p}\right]=\left[\frac{\mathrm{25}{x}−\mathrm{2}}{\mathrm{4}}\right]=\frac{\mathrm{13}{x}+\mathrm{4}}{\mathrm{3}}={n}\in{Z} \\ $ ${x}=\frac{\mathrm{3}{n}−\mathrm{4}}{\mathrm{13}}\Rightarrow\frac{\mathrm{25}{x}−\mathrm{2}}{\mathrm{4}}=\frac{\mathrm{75}{n}−\mathrm{74}}{\mathrm{52}} \\ $ $\left\{{p}\right\}=\frac{\...
227,879
I am trying to use `bibunits` package. If I compile the TeX file using the following sequence of commands, it works properly. ``` pdflatex document bibtex bu1 pdflatex document pdflatex document ``` However, if I compile it using TeXstudio 2.8.8, TeXstudio fails to recognize bibtex entries inside the bibunit. Here i...
2015/02/13
[ "https://tex.stackexchange.com/questions/227879", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/50211/" ]
Old question, but exactly my problem. I don't know much about TeXstudio, but I put together a hack to get it to work. There must be a better way. Somebody please post it. 1. Go to Options->Configure TeXstudio... 2. Select Commands from the options on the left 3. Scroll to BibTeX 4. Update the BibTeX command as describ...
You may want to use **[latexmk](https://www.ctan.org/pkg/latexmk/)**. It fully automates the process of compilation. ``` latexmk -pdflatex -synctex=1 document.tex ``` will do the job. You can tell TeXstudio to use **latexmk**. Just change the settings for PdfLaTeX command from ``` pdflatex -synctex=1 -interaction=...
39,532,144
i need help in getting the array length from another class. i.e., passing the length of array from one class to another. Here is the problem. **Testmatrix.java** ``` public class TestMatrix{ int rows; int cols; double data[][] = new double[4][4]; public TestMatrix() { super(); rows=1; cols=1; for(int i...
2016/09/16
[ "https://Stackoverflow.com/questions/39532144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5288543/" ]
Either declare matrix to 2\*2 as said by Chris or change ``` for (int i = 0; i < data.length ; i++) { for (int j = 0; j < data.length ; j++) { ``` to ``` for (int i = 0; i <= rows ; i++) { for (int j = 0; j <= cols ; j++) { ``` If you want any size of matrix upto 4\*4 use second solution.
Your class should be like this: ``` public class Test { int rows; int cols; double data[][] = new double[2][2]; public void print() { for (int i = 0; i < data.length; i++) { for (int j = 0; j < data.length; j++) { System.out.print(" "+data[i][j]+" "); ...
5,827,590
I would like to style the following: **forms.py:** ``` from django import forms class ContactForm(forms.Form): subject = forms.CharField(max_length=100) email = forms.EmailField(required=False) message = forms.CharField(widget=forms.Textarea) ``` **contact\_form.html:** ``` <form action="" method="pos...
2011/04/29
[ "https://Stackoverflow.com/questions/5827590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/651174/" ]
Write your form like: ``` class MyForm(forms.Form): name = forms.CharField(widget=forms.TextInput(attr={'class':'name'}),label="Your Name") message = forms.CharField(widget=forms.Textarea(attr={'class':'message'}), label="Your Message") ``` In your HTML field do something like: ``` {% for fiel...
There is a very easy to install and great tool made for Django that I use for styling and it can be used for every frontend framework like Bootstrap, Materialize, Foundation, etc. It is called widget-tweaks Documentation: [Widget Tweaks](https://pypi.python.org/pypi/django-widget-tweaks) 1. You can use it with Django'...
79,098
Is there a program/resource that allows you to track graphics files—for instance an Illustrator or Photoshop file—and will list all InDesign or Illustrator files where that asset is used? Bridge doesn't seem to do that.
2016/10/22
[ "https://graphicdesign.stackexchange.com/questions/79098", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/78629/" ]
As far as I'm aware, no file has any no clue where it may or may not be used moving forwards. Customarily assets can only be collected from the collective file, not the the individual pieces that make up the collection. I've never heard of any asset collection that can somehow magically know where the asset was used ...
I've read that NeoFinder can 'look inside' documents in a search such as a PDF. Maybe it'll see the list of links inside, for example, an InDesign file. I asked the question at the NeoFinder site and will update you when I hear back!
4,485,399
I would like to know how to bump the last digit in a version number using bash. e.g. ``` VERSION=1.9.0.9 NEXT_VERSION=1.9.0.10 ``` EDIT: The version number will only contain natural numbers. Can the solution be generic to handle any number of parts in a version number. e.g. ``` 1.2 1.2.3 1.2.3.4 1.2.3.4.5 ```
2010/12/19
[ "https://Stackoverflow.com/questions/4485399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83416/" ]
**TL;DR:** ``` VERSION=1.9.0.9 echo $VERSION | awk -F. '/[0-9]+\./{$NF++;print}' OFS=. # will print 1.9.0.10 ``` For a detailed explanation, read on. --- Let's start with the basic [answer](https://stackoverflow.com/a/4485581/15168) by [froogz3301](https://stackoverflow.com/users/83416/froogz3301): ``` VERSIONS="...
I have come up with this. ``` VERSIONS=" 1.2.3.4.4 1.2.3.4.5.6.7.7 1.9.9 1.9.0.9 " for VERSION in $VERSIONS; do echo $VERSION | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g' done ```
3,003,986
There are many ways to express a plane of $R^3$. I am focusing on two of them. The first is the cartesian equation $Ax + By + Cz + D = 0$. The second is to give two direction vectors $u$ and $v$ and a point $P$ of the plane. My question is: how can I obtain two **ortogonal** direction vectors $u$ and $v$ and a point...
2018/11/18
[ "https://math.stackexchange.com/questions/3003986", "https://math.stackexchange.com", "https://math.stackexchange.com/users/295866/" ]
$$(a,b,c)=\vec n$$ is a vector normal to the plane. From the knowledge of the Cartesian equation, choose the vector among $(0,c,-b), (-c,0,a)$ and $(b,-a,0)$ with the largest norm (do this to avoid degeneracies). This gives you a first vector perpendicular to $\vec n$, let $\vec u$. Then set $\vec v=\vec n\times\vec u...
Going one direction: Given $Ax + By + Cz + D = 0$ $(B,-A, 0)$ is a vector in the plane $(A,B,\frac {A^2 + B^2}{C})$ is a vector in the plane orthogonal to the first. $(0,0,-\frac {D}{C})$ is a point in the plane Of course, this is just one way to find orthogonal vectors and a point in the plane. Going the other d...
24,645,432
We have created a Play application in Java and are deploying it to a dev-environment virtual machine using [Atlassian Bamboo's](https://www.atlassian.com/software/bamboo) SSH task: `cd path/to/application/directory && start "" play run`. This goes to the proper location, launches a new console, and starts play: the ser...
2014/07/09
[ "https://Stackoverflow.com/questions/24645432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/935476/" ]
From [javadocs](http://docs.oracle.com/javase/tutorial/java/data/autoboxing.html) : Since java 5 **Autoboxing is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper classes. For example, converting an int to an Integer, a double to a Double, and so on...
This feature has been added in Java 5. **text** gets converted automatically into Integer by compiler. So basically its a syntactic sugar that can shorten your code (otherwise you would do conversions back and forth by yourself). Of course it has its price and if this happens a lot (I mean really a lot, big loops, fre...
32,641
> > KJV John 15:19  If ye were of the world, the world would love his own: > but because ye are not of the world, but I have chosen you out of the > world, therefore the world hateth you.  > > > Westcott and Hort / [NA27 variants] εἰ ἐκ τοῦ κόσμου ἦτε, ὁ κόσμος ἂν > τὸ ἴδιον ἐφίλει· ὅτι δὲ ἐκ τοῦ κόσμου οὐκ ἐστέ,...
2018/04/12
[ "https://hermeneutics.stackexchange.com/questions/32641", "https://hermeneutics.stackexchange.com", "https://hermeneutics.stackexchange.com/users/20832/" ]
No, there was no separation of the Godhead at any time during the crucifixion. I believe there has been a great misunderstanding about Christ’s quoting of Psalm 22 on the cross. Jesus quoted Psalm 22:1: > > “My God, My God, why has thou forsaken Me.” > > > Based on this quote, many people have developed all kin...
To answer your question, it is absolutely necessary to treat theological and Christological issue: a) what is the reality of God, His Spirit and His Logos-Son and b) how Jesus, the Logos-Son incarnate in history, is related to the Holy Spirit after the Incarnation? Below I shall address those issues and try eventually ...
25,071,766
You are given a string like: ``` input_string = """ HIYourName=this is not true HIYourName=Have a good day HIYourName=nope HIYourName=Bye!""" ``` Find the most common sub-string in the file. Here the answer is "HiYourName=". Note, the challenging part is that HiYourName= is not a "word" itself in the string i.e. it ...
2014/08/01
[ "https://Stackoverflow.com/questions/25071766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3897793/" ]
Here's a simple brute-force solution: ``` from collections import Counter s = " HIYourName=this is not true HIYourName=Have a good day HIYourName=nope HIYourName=Bye!" for n in range(1, len(s)): substr_counter = Counter(s[i: i+n] for i in range(len(s) - n)) phrase, count = substr_counter.most_common(1)[0] ...
Another brute force without imports: ``` s = """ HIYourName=this is not true HIYourName=Have a good day HIYourName=nope HIYourName=Bye!""" def conseq_sequences(li): seq = [] maxi = max(s.split(),key=len) # max possible string cannot span across spaces in the string for i in range(2, len(maxi)+ 1): # get a...
13,226,986
I need to verify a Text present in the page through WebDriver. I like to see the result as boolean (true or false). Can any one help on this by giving the WebDriver code?
2012/11/05
[ "https://Stackoverflow.com/questions/13226986", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1793816/" ]
Driver.getPageSource() is a bad way to verify text present. Suppose you say, `driver.getPageSource().contains("input");` That doesn't verify "input" is present on the screen, only that "input" is present in the html, like an input tag. I usually verify text on an element by using xpath: ``` boolean textFound = false;...
If you want check only displayed objects(**C#**): ``` public bool TextPresent(string text, int expectedNumberOfOccurrences) { var elements = Driver.FindElements(By.XPath(".//*[text()[contains(.,'" + text + "')]]")); var dispayedElements = 0; foreach (var webElement in elements) ...
8,017,705
When I try to start RMAN I get this error: ``` SQL> rman target=/ SP2-0734: unknown command beginning "rman targe..." - rest of line ignored. SQL> ``` What am I missing?
2011/11/05
[ "https://Stackoverflow.com/questions/8017705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1008100/" ]
You don't run RMAN from SQL\*Plus - you run it from the command line. [Have a look here](http://download.oracle.com/docs/cd/B19306_01/backup.102/b14193/toc.htm#i771020).
You must run the RMAN from command line interface not from the sql plus. The following are the command options. 1). RMAN target / catalog username/password@schema 2.) RMAN connect target /
31,774,643
Here is my `match` table ``` +----------------------------+ |Match_id |team1_id|team2_id | ------------------------------ | 1 | 1 | 2 | +----------------------------+ ``` Teams have severals played mapped by team\_player ``` +------------------+ |team_id |player_id| -------------------- | 1 |...
2015/08/02
[ "https://Stackoverflow.com/questions/31774643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2095267/" ]
Once the `Color` enum is initialized, `RANDOM` will be one specific color - it may be different from execution to execution, but in a single run, it will stay fixed. What you want is to generate a new Color every time you use `RANDOM`. (At least that's how I understood it) One way to do this is using a constant-specif...
The other answers will work, but in Java 8 there's an even nicer way to do it. Have each enum be initialized not with its color, but an [`IntSupplier<Color>`](https://docs.oracle.com/javase/8/docs/api/java/util/function/IntSupplier.html). ``` public class Property { ... Property(IntSupplier rgbSupplier) { ...
8,240,419
I want some kind of utility more like Call Stack which gives me list of all the methods/properies that are executing in the current run, something that works on realtime will be good. Actually i am refactoring my code and wants to keep an eye on things that are not usable or things that should be avoided. I am using F...
2011/11/23
[ "https://Stackoverflow.com/questions/8240419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2720334/" ]
Sounds like you are looking for a .NET profiler. There are several commercial offerings: * RedGate - [ANTS performance profiler](http://www.red-gate.com/products/dotnet-development/ants-performance-profiler/) * jetBrains - [dotTrace](http://www.jetbrains.com/profiler/) Also, see the answer to this SO question - [Wha...
When I'm refactoring code I use the Obsolete-attribute a lot. ``` <Obsolete("Please use the better and faster MyNewSub() instead. This method still work, see info in MyNewSub on how to migrate.")> _ Public Sub MyOldSub() ' code. End Sub ``` This way I get warnings for every function that calls this method. And ever...
1,446,120
I am going over C and have a question regarding `const` usage with pointers. I understand the following code: ``` const char *someArray ``` This is defining a pointer that points to types of char and the `const` modifier means that the values stored in `someArray` cannot be changed. However, what does the following ...
2009/09/18
[ "https://Stackoverflow.com/questions/1446120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/135306/" ]
From [what is the difference between const int\*, const int \* const, int const \*](https://stackoverflow.com/questions/1143262/what-is-the-difference-between-const-int-const-int-const-int-const): > > Read it backwards... > > > > ``` > int* - pointer to int > int const * - pointer to const int > int * const - cons...
Repeating what other users wrote, but I want to provide context. Take these two definitions: ``` void f1(char *ptr) { /* f1 can change the contents of the array named ptr; * and it can change what ptr points to */ } void f2(char * const ptr) { /* f2 can change the contents of the array named ptr; * ...
382,726
I was reading the first law of thermodynamics when it struck me. We haven't been taught differentiation but still, we find it in our chemistry books. Why is small work done always taken as $dW=F \cdot dx$ and not $dW=x \cdot dF$?
2018/01/28
[ "https://physics.stackexchange.com/questions/382726", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/182968/" ]
The answer to your question depends on how we define work. ***Definition***, *A force is said to do work if, when acting, there is a displacement of the point of application in the direction of the force.* In layman language, to do work you need displacement, not just force. In the equation, $dW=x.dF$, we are consi...
$F(x,t)$ can always be expressed as a function of position (and time); however, it is generally *wrong* to write position as a function of force (as well as, $x(F)$ will fail to describe how nature works.) To see why: considering an object being acted by a constant force, such a function is always *multi-valued*, it ...
48,147,071
I would like to **compare different CRM products** [SAP Hybris (C4C) vs. Salesforce] in my work. I've not yet started because currently I have a very basic problem in understanding the difference between SAP Hybris and SAP Hybris C4C (Cloud for Customer). SAP Hybris is divided into Commerce, Marketing, Revenue, Sales,...
2018/01/08
[ "https://Stackoverflow.com/questions/48147071", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
in `mat-step` use `[stepControl]="formName"` and in `.ts` do validation of the form. Using only `linear` won't help. I was doing wrong. I did not use `[stepControl]`
Using @Hypenate's answer, I just wanted to force the user to stay at the current step while the formGroup (connedted to the current step) is INVALID. So I made a css definition in styles.css: ``` .mat-element-notclickable{ pointer-events: none; cursor: not-allowed; opacity: 0.5; color: #cccccc; } ```...
70,816,463
I have 3 different types of items, which i have interfaces of ``` interface TypeA{ name: string; } interface TypeB{ count: number; } interface TypeC{ date: Date; } ``` This items should be rendered in a list of items (in a list all items are from the same type). Depending on the type of the item, a different m...
2022/01/22
[ "https://Stackoverflow.com/questions/70816463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4789317/" ]
I checked your code, it's throwing errors because you're destructuring an array into your component. In your code ``` const renderItem = () => { const sampleData = [ { type: "A", count: 12, }, ]; // incorrectly destructuring sampleData here return <ListItem {...sampleData} />; }; ``` You...
Here is a minimal example of discriminated union usage: ``` interface TypeA { type: "A"; name: string; } interface TypeB { type:"B"; count: number; } export const ListItem = (props: TypeA | TypeB) => { let item = null; switch (props.type) { case "A": item = renderTypeA(props); // TS know this m...
9,547,670
It has been estimated that a specific social network site has the following number of users per month. ``` F(n)= F(n-1)*120% + 100*n where F(0)=0 ``` this means that every month 100 new users are added because of advertisement and 20% more users are added per month due to users inviting people the the social ne...
2012/03/03
[ "https://Stackoverflow.com/questions/9547670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/637142/" ]
Mathematical View ================= instead of 1.2 I'll use `a` and instead of 100 I'll use `b` (a>1,b!=0): ``` F(n) = aF(n-1) + bn ==> F(n) = a (aF(n-2) + bn) + bn = a^2 F(n-2) + ab(n-1)+bn = a^3F(n-2) + a^2 * b * (n-2)+a*b*(n-1)+b*n=... = a^n F(0) + a^(n-1) * b * (n-(n-1)) + .... + bn = 0 + a^...
``` f(n)=af(n-1)+bn =a[af(n-2)+b(n-1)+b(n-1)]=a^2f(n-2)+(a+1)b(n-1) -ab ``` in general f(n) =a^n \* x + n\*y+z now f(1)=a\*x+y+z=1 f(2)=(a^2)\* x+2y+z= f(3)=... We can sole this linear system to get x,y ,z
23,519,091
Using Silverlight 5, RIA services 1.0 and Telerik controls I have a dialog with a button that when clicked goes and runs some service code. The issue is when I double click or triple click it real fast, it keeps calling the service thus getting this error: ``` System.InvalidOperationException: System.InvalidOperation...
2014/05/07
[ "https://Stackoverflow.com/questions/23519091", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This is not an error. A submitChange operation is asynchronous so you have to detect that it is completed before doing something else. One solution could be to block the user from clicking on the button before the operation is completed. Since you are using a Telerik controls, you can use a busy indicator. ``` priva...
We had same problem, and had to change from sending a command to the viewmodel to having a bit of code behind for button click ... ``` /// <summary> /// Workaround for handling double-click from the Map Results button - trying to prevent running the query twice and adding duplicate layers into the Layer Control /// </...
1,416,111
I think about starting from scratch building a small application fullfilling two technical requirements: * should be usable on iPhone * should work offline There are two obvious alternatives here to choose between * A real iPhone application with offline capabilities * A web app using HTML5 offline, Google Gears or ...
2009/09/12
[ "https://Stackoverflow.com/questions/1416111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/109305/" ]
Honestly, it depends what your app is going to do. MobileSafari supports all the HTML5 offline stuff, so you could store data in a clientside SQL database, cache the application clientside, etc... The mobile Gmail app is probably the most notable example of that, giving you full-featured access to your Gmail even when...
I can't tell you too much about HTML apps in general, but I can tell you that [the API](http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIWebView_Class/Reference/Reference.html) for the `UIWebView` is extremely minimal, and of course there is much less you can do than in a native iPhone applicat...
60,724,667
I'm learning RTOS on stm32F411RE board (Cortex-M4). I use MDK uVision v5. I encounter a problem of C code **while loop**. The code in the following is exactly the same in my project and the instructor's project (on Udemy), however, after compiling both project (on my PC), the assembly code look's different. I want to a...
2020/03/17
[ "https://Stackoverflow.com/questions/60724667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7897452/" ]
Since you aren't telling the compiler `semaphore` can change during the execution of this function, your compiler has decided to optimize your code and load the value of semaphore only once and use its copy in the while loop, then only write the result in the end. As it is written now, there's no reason for the compile...
This very well known keil over optimisation bug. Reported many times. Having memory clobber it should read the memory every time. Here is an example how clobbers work ``` #include <stdint.h> unsigned x; volatile unsigned y; int foo() { while(x < 1000); } int bar() { while(x < 1000) asm("":::"memory"); } `...
7,916,871
I want to kill a process using inno setup.i want to check whether the window is open before i start installing the setup. can i do this by searching windows name? please help me with some sample code to kill the process
2011/10/27
[ "https://Stackoverflow.com/questions/7916871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1000471/" ]
The best option is to use a mutex to see if it's still running using `AppMutex`. One way to close it is to find the window handle then just post a simple WM\_CLOSE message. There are other options like the [Files in use extension](http://www.vincenzo.net/isxkb/index.php?title=Files_in_use_extension) and [PSVince](http...
A less complicated method would be to run a [batch file](http://www.jrsoftware.org/iskb.php?runbatchfile) which uses task kill ie: if you wanted to kill notepad before uninstalling ``` taskkill /IM notepad.exe ```
29,952
[The *Rama*, *Orach Chayim* 553](http://he.wikisource.org/wiki/%D7%A9%D7%95%D7%9C%D7%97%D7%9F_%D7%A2%D7%A8%D7%95%D7%9A_%D7%90%D7%95%D7%A8%D7%97_%D7%97%D7%99%D7%99%D7%9D_%D7%AA%D7%A7%D7%A0%D7%92), says: > > The practice is that we do not study [Torah] the day before [the ninth of *Av*](http://en.wikipedia.org/wiki/Tis...
2013/07/15
[ "https://judaism.stackexchange.com/questions/29952", "https://judaism.stackexchange.com", "https://judaism.stackexchange.com/users/170/" ]
These two activities continue to bring pleasure to the person even after they are done. If a person learned properly, he would continue thinking about what he had learned. So too with a trip, a person would think about his joyful experience and derive pleasure from it.
You are not the only one who was perplexed by this halacha as the MB brings several opinions (GR"A, RaSHaL) that did not accept the Rama's ruling and the Biur Halacha (BH) seems to concur with them. The MB gives a reason that Torah study gladdens the heart, While the Magen Avraham says that since it is possible to lea...
42,555,983
I have created a macro to copy data from one sheet and transpose and paste the data to another sheet as so: ``` Sub sbCopyRangeToAnotherSheet() 'Copy the data Sheets("Raw Data").Range("A4:A27").Copy 'Transpose and paste data to new sheet Sheets("Distinct Users").Range("D6:AA6").PasteSpecial Transpose:...
2017/03/02
[ "https://Stackoverflow.com/questions/42555983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1819427/" ]
Use Range objects : ``` Dim SrcRg As Range Dim DestRg As Range Set SrcRg = Sheets("Raw Data").Range("A4:A27") Set DestRg = Sheets("Distinct Users").Range("D6") For i = 1 To 31 'Copy the data SrcRg.Copy 'Transpose and paste data to new sheet DestRg.PasteSpecial Transpose:=True Set SrcRg = SrcRg.Off...
Maybe try using a For loop like so: ``` Sub sbCopyRangeToAnotherSheet() Dim i As Integer Dim rCopy As Range, rPaste As Range Set rPaste = Sheets("Distinct Users").Range("D6:AA6") Set rCopy = Sheets("Raw Data").Range("A4:A27") For i = 0 To 30 'Copy the data rCopy.Offset(rCopy.Rows.Count * i, 0).Copy '...
5,288,834
I've completed some simple MVVM tutorials, but they were super simplified examples. Here is my problem: I have a model class for a person, which contains some variables (firstname, lastname) and lists (education, workplaces). These lists have their own classes. For simple variables I created one viewmodel which impleme...
2011/03/13
[ "https://Stackoverflow.com/questions/5288834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/657391/" ]
If you need to more actions on elements of those collection then you can create separate ViewModels for those classes. Then in general ViewModel you can create ObservableCollection of additional ViewModels. Pseudo code: ``` public class PersonViewModel { public ObservableCollection<EducationViewModel> Education {...
For starters, implementing the list as an `ObservableCollection` on your ViewModel will work fine. There's an [example on MSDN](http://msdn.microsoft.com/en-us/library/ms748365.aspx) to get you started; there are tons of tutorials around too.
203,927
I created a 2010 workflow in SPD 2013 on development machine. Once it was time to go live, I took site collection back up from development and restored it on production so my workflow as well as all InfoPath 2013 forms were moved. Now I have made several changes in workflow as well as forms on development machine. Wh...
2017/01/02
[ "https://sharepoint.stackexchange.com/questions/203927", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/15263/" ]
Access token expires in 12hrs by default in high-trust (when using `TokenHelper.cs`). Session in 20min, but in that case `SharePointContext.cs` should renew it. May be your custom logic affects this somehow. My guess - try to adjust session expiration time to one hour for example (`web.config`): ``` <configurati...
Try to increase your token cache limit and token lifetime. ``` $sts = Get-SPSecurityTokenServiceConfig $sts.CookieLifetime = New-TimeSpan -Minutes 600 $sts.WindowsTokenLifetime = New-TimeSpan -Minutes 600 $sts.MaxApplicationTokenCacheItems = 100000 $sts.MaxLogonTokenCacheItems = 100000 $sts.MaxServiceTokenCacheItems =...