qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
9,351,863
If I want to combine using repositorys per entity and Viewmodels per view how does it work out? Any website tips I could look up? Maby someone could give an easy example? Thanks Best Regards!
2012/02/19
[ "https://Stackoverflow.com/questions/9351863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1208641/" ]
I like the following structure (from the famous [Steven Sanderson's Pro ASP.NET MVC series](https://rads.stackoverflow.com/amzn/click/com/1430234040)): **Domain Project (Business Logic):** * Abstract Folder (repository interfaces) * Concrete Folder (repository implementations) * Entities (EF generated classes) **Web...
Use [**AutoMapper**](https://github.com/AutoMapper/AutoMapper) to copy data from entities to models and vice-versa. This will reduce a lot of 'plumbing' code you will have to write otherwise.
9,351,863
If I want to combine using repositorys per entity and Viewmodels per view how does it work out? Any website tips I could look up? Maby someone could give an easy example? Thanks Best Regards!
2012/02/19
[ "https://Stackoverflow.com/questions/9351863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1208641/" ]
I like the following structure (from the famous [Steven Sanderson's Pro ASP.NET MVC series](https://rads.stackoverflow.com/amzn/click/com/1430234040)): **Domain Project (Business Logic):** * Abstract Folder (repository interfaces) * Concrete Folder (repository implementations) * Entities (EF generated classes) **Web...
I'm not a professional developer but I think Steve Sanderson's model is not the right model for some projects because you are working in your views against the model directly. What happen if you want to show only a few properties and not all of them? Your full model is traveling to the view. I think your views must wo...
9,351,863
If I want to combine using repositorys per entity and Viewmodels per view how does it work out? Any website tips I could look up? Maby someone could give an easy example? Thanks Best Regards!
2012/02/19
[ "https://Stackoverflow.com/questions/9351863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1208641/" ]
Use [**AutoMapper**](https://github.com/AutoMapper/AutoMapper) to copy data from entities to models and vice-versa. This will reduce a lot of 'plumbing' code you will have to write otherwise.
I'm not a professional developer but I think Steve Sanderson's model is not the right model for some projects because you are working in your views against the model directly. What happen if you want to show only a few properties and not all of them? Your full model is traveling to the view. I think your views must wo...
40,303,139
I'll try to simplify the problem as much as I can. Let's say I have 2 scopes ``` $scope.section1 = [ {label: 'label1'}, {label: 'label2'} ]; $scope.section2 = [ {value: 'one'}, {value: 'two} ]; ``` Those scopes are used to generate buttons with ng-repeat ``` <button ng-repeat="item in section1 type="butt...
2016/10/28
[ "https://Stackoverflow.com/questions/40303139", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7048463/" ]
`val()` is a jQuery function which you do not inherently have access to unless you setup Protractor that way. Use `getAttribute('value')` instead, which returns a promise - see the [getAttribute() reference](http://www.protractortest.org/#/api?view=webdriver.WebElement.prototype.getAttribute) So if you are using it in...
Instead of 'enabled' the value = 1 // using TS ``` static myElement = element .all(by.css('input[type="radio"]:checked')) .get(0); expect(this.myElement.getAttribute('value')).toEqual( '1' ); ```
16,768,428
Lets say I have an amount in string format like this: ``` amount = '12,000.00' ``` I want to convert it into a Number (Javascript) or a float. ``` parseFloat(amount) // this gives me 12 as a result Number(amount) // this gives me NaN as a result ``` Other solution I thought was this: ``` parseFloat(amount.replac...
2013/05/27
[ "https://Stackoverflow.com/questions/16768428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1000837/" ]
This is not that easy, as you can't exactly know what's the delimiter for thousands and what for the decimal part Consider "12.000.000" is it `12000.000 === 12000` or `12000000`? But if you would set the requirement that the last delimiter is always the decimal delimiter - meaning if at least one delimiter is given,...
You can get the local decimal delimiter in this manner: ``` 1.1.toLocaleString().substr(1,1) ``` Before parse float, you could make sure the string contains nothing but numbers, possibly a minus sign, and the local decimal delimiter.
16,768,428
Lets say I have an amount in string format like this: ``` amount = '12,000.00' ``` I want to convert it into a Number (Javascript) or a float. ``` parseFloat(amount) // this gives me 12 as a result Number(amount) // this gives me NaN as a result ``` Other solution I thought was this: ``` parseFloat(amount.replac...
2013/05/27
[ "https://Stackoverflow.com/questions/16768428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1000837/" ]
This is not that easy, as you can't exactly know what's the delimiter for thousands and what for the decimal part Consider "12.000.000" is it `12000.000 === 12000` or `12000000`? But if you would set the requirement that the last delimiter is always the decimal delimiter - meaning if at least one delimiter is given,...
The truth is, you'll never know the format. `12,345`. Is that `12345`, or another locale version if `12.345`? However, if you have consistent decimals, then you'd be able to use the [`lastIndexOf`](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/lastIndexOf) function on a comma and...
14,375,527
Yesterday I have a question, just this unanswered. I have a php login and register script. When the users register they get in the database is automatically assigned an ID (auto-increment). This ID will in another table linked to a virtual machine (see Account ID: <http://i47.tinypic.com/2gtr8g1.png>). Now I want in...
2013/01/17
[ "https://Stackoverflow.com/questions/14375527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1983763/" ]
Hope this is where you had problems. ``` $id = 1; $name = 'admin'; $query = "SELECT * FROM `table_name` WHERE id = {$id} "; // for numbers $query = "SELECT * FROM `table_name` WHERE account_name = '{$name}' "; // for strings $query = "SELECT * FROM `table_name` WHERE id = '".$name."'; // this is another way of doing...
If you have defined your 'login' column as unique, then you could retrieve your id like this: ``` select id from users where login='blabla'; ``` You could also use the [mysql\_insert\_id](http://php.net/manual/en/function.mysql-insert-id.php) function, which gives you the last generated ID.
14,375,527
Yesterday I have a question, just this unanswered. I have a php login and register script. When the users register they get in the database is automatically assigned an ID (auto-increment). This ID will in another table linked to a virtual machine (see Account ID: <http://i47.tinypic.com/2gtr8g1.png>). Now I want in...
2013/01/17
[ "https://Stackoverflow.com/questions/14375527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1983763/" ]
Hope this is where you had problems. ``` $id = 1; $name = 'admin'; $query = "SELECT * FROM `table_name` WHERE id = {$id} "; // for numbers $query = "SELECT * FROM `table_name` WHERE account_name = '{$name}' "; // for strings $query = "SELECT * FROM `table_name` WHERE id = '".$name."'; // this is another way of doing...
Mmmm... from what i understand, when user logs in you need to get his id ``` SELECT id FROM account WHERE account_name = "<account name of user>" ``` This will get you the id, next you need information from vm table (as i understand from your question). So using the id you just do ``` SELECT * FROM vm_instance WHER...
53,535,723
IBM has many open source technology stacks in their i-series machines. Does anyone know whether IBM officially provides support for Python language like they do for native RPG/CL language ??
2018/11/29
[ "https://Stackoverflow.com/questions/53535723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9831559/" ]
Officially, IBM does not provide support. <https://www-01.ibm.com/support/docview.wss?uid=nas8N1021450> > > The IBM i Open Source Solutions product is governed by an IBM Agreement for Non-warranted license which states "IBM DOES NOT PROVIDE SUPPORT OF ANY KIND, UNLESS IBM SPECIFIES OTHERWISE. " IBM does not provi...
IBM provides Python 2.7, 3.6, and 3.9 for PASE, the AIX-like compatibility environment. All the [official IBM open source](https://ibmi-oss-docs.readthedocs.io/en/latest/README.html) efforts are focused on PASE because it's easier to port POSIX stuff to it than to the QSYS.LIB environment. The support for the open sou...
46,276,307
``` i = 0 while i < 10: print('print("Hello world '+ str (i*9)+'")') i = i + 1 ``` I was practicing loop and I wonder why I have to put + after `STR(1*9) ?? print('print("Hello world '+ str (i*9)'")')` and Why this code has syntax error? (no plus sign) I tried put code `print(print("Hello world"+str...
2017/09/18
[ "https://Stackoverflow.com/questions/46276307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8625539/" ]
To concatenate two string together you need the `+` operator to tell the python interpreter to specify its `some_string` **plus** `some_other_string`. Alternatively if you dont like using the `+` operator you can use `.format()` like so; ``` while i < 10: print("Hello World {0}".format(i*9)) i = i + 1 ``` T...
A + concatenates strings in python. So you need it. Python does not know how to interpret two variables next to each other without , or + or else between them. '")' is also considered a variable in programming context.
42,258,468
This is my store shape: ``` export default { isRequesting: false, requestError: null, things: [], otherThings: [] } ``` When `things` and `otherThings` are being fetched from a server, `isRequesting` is changed and `requestError` could potentially be changed. Currently, I'm changing these in reducers...
2017/02/15
[ "https://Stackoverflow.com/questions/42258468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5710376/" ]
You are not spreading out reducers. `thingsReducer` is an object that contains reducers and you are spreading out that object. You can make `thingsReducer` a nested reducer if you use `combineReducers`, but I don't see a need for that: ``` const thingsReducer = combineReducers({ things, isRequesting, reque...
At the bottom of your reducer files such as your `things` reducer, you can export a constant like so: ``` export const thing = combineReducers({ things, isRequesting, requestError }); ``` and then in your root reducer, you combine them the same way: ``` const rootReducer = combineReducers({ thingReducer, ot...
22,862,391
I am using **Eclipse Kepler** with **Oracle Enterprise Pack for Eclipse 12.1.2.3** and a Weblogic 12.1.1 server. When setting up the server I get ``` An older version domain is detected. Click here to upgrade it with Upgrade Wizard. ``` I am quite sure that this message is misleading. I have a Weblogic 12 domain bu...
2014/04/04
[ "https://Stackoverflow.com/questions/22862391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3215379/" ]
Contact Form ``` <form method="GET" action="process.php"> <input type="hidden" name="p" id="p" value="<?php echo $_GET['id']; ?>" /> </form> ``` process.php ``` $pageid = $_GET['p']; ``` When you click the link, you wil get something like: www.abc.de/process.php?p=123123 this part makes no sense for me tho: ...
If I understood your question correctly, you are looking for a way to generate a unique (numeric) id for each form you submit? The first thing that comes to mind is to use a time function, which technically could result in duplicates, but in practice will be safe unless you have over 1000 requests per second. ``` $id...
22,862,391
I am using **Eclipse Kepler** with **Oracle Enterprise Pack for Eclipse 12.1.2.3** and a Weblogic 12.1.1 server. When setting up the server I get ``` An older version domain is detected. Click here to upgrade it with Upgrade Wizard. ``` I am quite sure that this message is misleading. I have a Weblogic 12 domain bu...
2014/04/04
[ "https://Stackoverflow.com/questions/22862391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3215379/" ]
You can create uniq id's with this following function in PHP. ``` $up_id = uniqid(); ``` If you just want your random id in Just the letters like string format. You can uset that following function definied. ``` function generateRandomString($length = 5) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzAB...
Contact Form ``` <form method="GET" action="process.php"> <input type="hidden" name="p" id="p" value="<?php echo $_GET['id']; ?>" /> </form> ``` process.php ``` $pageid = $_GET['p']; ``` When you click the link, you wil get something like: www.abc.de/process.php?p=123123 this part makes no sense for me tho: ...
22,862,391
I am using **Eclipse Kepler** with **Oracle Enterprise Pack for Eclipse 12.1.2.3** and a Weblogic 12.1.1 server. When setting up the server I get ``` An older version domain is detected. Click here to upgrade it with Upgrade Wizard. ``` I am quite sure that this message is misleading. I have a Weblogic 12 domain bu...
2014/04/04
[ "https://Stackoverflow.com/questions/22862391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3215379/" ]
You can create uniq id's with this following function in PHP. ``` $up_id = uniqid(); ``` If you just want your random id in Just the letters like string format. You can uset that following function definied. ``` function generateRandomString($length = 5) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzAB...
If I understood your question correctly, you are looking for a way to generate a unique (numeric) id for each form you submit? The first thing that comes to mind is to use a time function, which technically could result in duplicates, but in practice will be safe unless you have over 1000 requests per second. ``` $id...
14,554,826
Is there a way to make up or down arrows appear if there is more text left above the current view or below the current view? It's not very obvious in my Android application that there is more text below the current view but I want the user to know that there is more text below the current view. How do I make arrows app...
2013/01/28
[ "https://Stackoverflow.com/questions/14554826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1676226/" ]
You may overide onScrollChanged which can tell you if your content is off screen In there you can ``` @Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { View view = (View) getChildAt(getChildCount() - 1); int diff = (view.getBottom() - (getHeight() + getScrollY())); if (...
Usually the way to go about this is just to have a drop shadow or **fading edge** on the scroll view, which should be enabled by default. You can set the property by using `android:requiresFadingEdge` in XML. ![Fading edge](https://i.stack.imgur.com/5tQzp.png) If you want arrows then you will have to overlay them you...
83,883
If the PCs are so overwhelmingly more powerful than their foes and it wouldn't make sense for there to be backup / higher level foes around from a story standpoint (no "deus ex machina" for the enemies), I want to just narrate the battle or surrender briefly without the need for rolls. 1. Are there drawbacks to doing ...
2016/07/10
[ "https://rpg.stackexchange.com/questions/83883", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/23099/" ]
I've done similar things, although in 4e rather than 3.5e. I think the technique is broadly applicable, but that 4e is a little more geared for the technique, as I will discuss below. I generally took two approaches to things: 1) In cases where the PCs simply and completely outclassed the opposition, and I deemed th...
In D&D 3.5, the experience awarded for an encounter varies depending on the level of the party and the Encounter Level of the enemies. If the difference between the two is too high, then no experience is rewarded. (Refer to the XP Awards table on DMG pg 38, and the two tables on DMG pg 49). * If the PCs are so overwhe...
50,520,215
I am trying to convert a numpy array ``` np.array([1,3,2]) ``` to ``` np.array([[1,0,0],[0,0,1],[0,1,0]]) ``` Any idea of how to do this efficiently? Thanks!
2018/05/25
[ "https://Stackoverflow.com/questions/50520215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9426587/" ]
Create an bool array, and then fill it: ``` import numpy as np a = np.array([1, 2, 3, 0, 3, 2, 1]) b = np.zeros((len(a), a.max() + 1), bool) b[np.arange(len(a)), a] = 1 ```
Try pandas's get dummy method. ``` import pandas as pd import numpy as np arr = np.array([1 ,3, 2]) df = pd.get_dummies(arr) ``` if what you need is numpy array object, do: ``` arr2 = df.values ```
50,520,215
I am trying to convert a numpy array ``` np.array([1,3,2]) ``` to ``` np.array([[1,0,0],[0,0,1],[0,1,0]]) ``` Any idea of how to do this efficiently? Thanks!
2018/05/25
[ "https://Stackoverflow.com/questions/50520215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9426587/" ]
Create an bool array, and then fill it: ``` import numpy as np a = np.array([1, 2, 3, 0, 3, 2, 1]) b = np.zeros((len(a), a.max() + 1), bool) b[np.arange(len(a)), a] = 1 ```
It is also possible to just select the right values from `np.eye` or the identity matrix: ``` a = np.array([1,3,2]) b = np.eye(max(a))[a-1] ``` This would probably be the most straight forward.
50,520,215
I am trying to convert a numpy array ``` np.array([1,3,2]) ``` to ``` np.array([[1,0,0],[0,0,1],[0,1,0]]) ``` Any idea of how to do this efficiently? Thanks!
2018/05/25
[ "https://Stackoverflow.com/questions/50520215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9426587/" ]
Create an bool array, and then fill it: ``` import numpy as np a = np.array([1, 2, 3, 0, 3, 2, 1]) b = np.zeros((len(a), a.max() + 1), bool) b[np.arange(len(a)), a] = 1 ```
You can compare to `[1, 2, 3]` like so: ``` >>> a = np.array([1,3,2]) >>> np.equal.outer(a, np.arange(1, 4)).view(np.int8) array([[1, 0, 0], [0, 0, 1], [0, 1, 0]], dtype=int8) ``` or equivalent but slightly faster ``` >>> (a[:, None] == np.arange(1, 4)).view(np.int8) ```
42,703,506
I'm using function: numpy.log(1+numpy.exp(z)) for small values of z (1-705) it gives identity result(1-705 {as expected}), but for larger value of z from 710+ it gives infinity, and throw error "runtimeWarning: overflow encountered in exp"
2017/03/09
[ "https://Stackoverflow.com/questions/42703506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2717058/" ]
For large *z* you could use ``` z + log(exp(-z) + 1) ``` which is mathematically but not numerically the same thing. In code: ``` (z + np.log(np.exp(-z) + 1)) if z > 0 else np.log(1 + np.exp(z)) ``` If you need a vectorised version: ``` np.maximum(z, 0) + np.log(np.exp(-np.absolute(z)) + 1) ``` As @Praveen po...
What is happening is that you are overflowing the register such that it is overwriting itself. You have exceeded the maximum value that can be stored in the register. You will need to use a different datatype that will most likely not be compatible with exp(.). You might need a custom function that works with 64-bit In...
21,241,477
This wordcount script I inherited works well, but it just seems redundant to have the same script written twice to handle the wordcount on page load and on keyup. Just seems like it could be cleaner and more efficient if it was written once and used in both places. I'm sure it's simple, but just can't wrap my head ar...
2014/01/20
[ "https://Stackoverflow.com/questions/21241477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/491478/" ]
Bind the `keyup` handler, then trigger it: <http://jsfiddle.net/F9kg5/> ``` $('.wordcount').keyup(function() { //... }).trigger('keyup'); ``` Full code from fiddle: ``` $('.wordcount').keyup(function () { var plural_characters = '', plural_words = '', character_length = $(this).val().leng...
Here's how I'd clean up this code: ``` function wordCount(object) { var plural_characters = ''; var plural_words = ''; var character_length = object.val().length; var word_length = object.val().split(/\b[\s,\.-:;]*/).length; if (character_length != 1) { plural_characters = 's'; } ...
1,327,626
I am trying to install crossover for linux, on my Ubuntu 20.04 Mate installation, but the dependency python-gtk2 is missing. ``` sudo apt-get install python-gtk2 Reading package lists... Done Building dependency tree Reading state information... Done Package python-gtk2 is not available, but is referred to by...
2021/03/27
[ "https://askubuntu.com/questions/1327626", "https://askubuntu.com", "https://askubuntu.com/users/139675/" ]
Ok, I guess I failed to mention having had a previous version of crossover already installed, which turns out was important. Installing using the deb file installer, showed no errors, during install, which made me think it was irrelevant. in any event, I did `sudo apt-get purge crossover`, then ran the binary generic ...
As you are running 20.04, I'm going to assume you are not trying to download <https://download.cnet.com/CrossOver-for-Linux/3000-2094_4-75761258.html>, but that instead you are trying to get <https://linux.softpedia.com/get/Office/Office-Suites/CrossOver-3883.shtml> - if I'm wrong, please let me know. AFAIK, crossover...
6,999,452
I'm using a complex selector, and it works fine in Chrome and Firefox et al. but in Internet Explorer 8 it fails. I haven't tested it in older versions yet. ``` <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'> <html> <head> <title>Title</...
2011/08/09
[ "https://Stackoverflow.com/questions/6999452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/423963/" ]
Here's a workaround: ``` $('span').each(function() { if(this.style.left == "20px" && this.style.width == "100%") { $(this).css({color:'red'}); } }); ``` fiddle: <http://jsfiddle.net/mrchief/RMzuh/16/> Also, notice that `left:20px` will have no effect unless you set `positon:absolute;` or similar.
Instead of the complex selector you could use `.filter()` ``` $('span[style]').filter(function() { return this.style.left === "20px" && this.style.width === "100%"; }).css({ color: 'red' }); ``` **[Updated jsfiddle](http://jsfiddle.net/markcoleman/RMzuh/15/)** *tested in IE9 and IE9 compatibility view (both...
6,999,452
I'm using a complex selector, and it works fine in Chrome and Firefox et al. but in Internet Explorer 8 it fails. I haven't tested it in older versions yet. ``` <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'> <html> <head> <title>Title</...
2011/08/09
[ "https://Stackoverflow.com/questions/6999452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/423963/" ]
Here's a workaround: ``` $('span').each(function() { if(this.style.left == "20px" && this.style.width == "100%") { $(this).css({color:'red'}); } }); ``` fiddle: <http://jsfiddle.net/mrchief/RMzuh/16/> Also, notice that `left:20px` will have no effect unless you set `positon:absolute;` or similar.
I'm personally surprised that style matching the way you're doing it works at all. The presence of one space somewhere could throw it off. When I do getAttribute on the style attribute for those objects, there is a space after the colon and indeed if you put a space in your match string after the colon, your technique ...
6,999,452
I'm using a complex selector, and it works fine in Chrome and Firefox et al. but in Internet Explorer 8 it fails. I haven't tested it in older versions yet. ``` <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'> <html> <head> <title>Title</...
2011/08/09
[ "https://Stackoverflow.com/questions/6999452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/423963/" ]
Here's a workaround: ``` $('span').each(function() { if(this.style.left == "20px" && this.style.width == "100%") { $(this).css({color:'red'}); } }); ``` fiddle: <http://jsfiddle.net/mrchief/RMzuh/16/> Also, notice that `left:20px` will have no effect unless you set `positon:absolute;` or similar.
You can't rely on the content of the style property to be exactly as the string that you use to set it. Internet Explorer normalises the style as `left: 20px; width: 100%;`, so the extra spaces keeps the jQuery selector from working. If you use spaces after the colon in the `style` attribute and in the selector, it wi...
3,145,619
I'm a PhD student looking at software watermarking techniques and I always get asked 'who uses it?' The answer to which I don't know. There is a large amount of academic work on the subject (most notably from Collberg et al.) but very little indication of it's prevalence in industry. Software watermarking involves embe...
2010/06/29
[ "https://Stackoverflow.com/questions/3145619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/379565/" ]
Thats a very interesting question. I would have up-voted you if I got the permission;-). I actually wonderred the same question 4 years ago when I was doing my masters on dynamic software watermarks. I heard from some sources that IBM once won a law suit on copyright cases against some company, where software watermar...
Having worked at three completely different places before, I can say that obfuscation is commonly used - all of them do. Watermarking? Well, I'm only hearing of it now. Anyway, this obviously represents a very small sample size, so I'd like to hear what others have to say too.
3,145,619
I'm a PhD student looking at software watermarking techniques and I always get asked 'who uses it?' The answer to which I don't know. There is a large amount of academic work on the subject (most notably from Collberg et al.) but very little indication of it's prevalence in industry. Software watermarking involves embe...
2010/06/29
[ "https://Stackoverflow.com/questions/3145619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/379565/" ]
Thats a very interesting question. I would have up-voted you if I got the permission;-). I actually wonderred the same question 4 years ago when I was doing my masters on dynamic software watermarks. I heard from some sources that IBM once won a law suit on copyright cases against some company, where software watermar...
The following case is often used as a typical example (Excerpt from the book "Surreptious Software", from Christian Collberg & Jasvir Nagra) : > > IBM sued a rival for theft of their PC-AT ROM. They argued that the defendant’s programmers pushed and popped registers in the same order as in the original code, which w...
3,145,619
I'm a PhD student looking at software watermarking techniques and I always get asked 'who uses it?' The answer to which I don't know. There is a large amount of academic work on the subject (most notably from Collberg et al.) but very little indication of it's prevalence in industry. Software watermarking involves embe...
2010/06/29
[ "https://Stackoverflow.com/questions/3145619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/379565/" ]
The following case is often used as a typical example (Excerpt from the book "Surreptious Software", from Christian Collberg & Jasvir Nagra) : > > IBM sued a rival for theft of their PC-AT ROM. They argued that the defendant’s programmers pushed and popped registers in the same order as in the original code, which w...
Having worked at three completely different places before, I can say that obfuscation is commonly used - all of them do. Watermarking? Well, I'm only hearing of it now. Anyway, this obviously represents a very small sample size, so I'd like to hear what others have to say too.
73,659,577
When updating a state, react does not re-render the screen. Moreover, the use effect is not called. [![enter image description here](https://i.stack.imgur.com/YsA22.gif)](https://i.stack.imgur.com/YsA22.gif) When clicking on the "change" button, react does not seem to want to re-render with the new values. Also, the ...
2022/09/09
[ "https://Stackoverflow.com/questions/73659577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13653917/" ]
The issue here is state mutation with `toEdit[index] = {...toEdit[index], name: "Michel"}`. `toEdit` is a reference to the existing state `identity`. ``` function handleChange(evt) { const toEdit = identity; const index = toEdit.findIndex(predicate => predicate.id = 1); toEdit[index] = {...toEdit[index], name: "...
As @DBS and @secan said, I got confused with the state update. This code works : ```js function handleChange(evt) { const toEdit = [...identity]; // this line const index = toEdit.findIndex(predicate => predicate.id = 1); toEdit[index] = {...toEdit[index], name: "Michel"} console.log({index, toEdit})...
30,179,644
I've done quite a bit of searching here on Stackoverflow on how to solve this problem efficiently, but I still haven't seemed to find exactly what I'm looking for. Basically, I have three columns that I want evenly spaced and centered across my page. However, when I set col-md-4 for all three columns, the end result i...
2015/05/12
[ "https://Stackoverflow.com/questions/30179644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4107391/" ]
It's a late answer but I guess that some people can be interessed by another explanation. Bootstrap "cols" system is not made to decorate but to place elements in pages. If you need to space column contents, you need to wrap your content: ``` <div class="row-fluid"> <div class="col-md-4"> <div class="col-spaced"> ...
A 'hacky' way to do what you want is to give the columns a border that is the same color as the background.
30,179,644
I've done quite a bit of searching here on Stackoverflow on how to solve this problem efficiently, but I still haven't seemed to find exactly what I'm looking for. Basically, I have three columns that I want evenly spaced and centered across my page. However, when I set col-md-4 for all three columns, the end result i...
2015/05/12
[ "https://Stackoverflow.com/questions/30179644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4107391/" ]
Actually, your code already creates spaces between columns, because in bootstrap the column has 15px padding from each side. Your code is working normally, check here: <http://www.bootply.com/H6DQGdZxGy>
You can do something like: ``` [class*="col-"] { padding-right: 15px; padding-left: 15px; } [class*="col-"]:first-child { padding-left: 0px; } [class*="col-"]:last-child { padding-right: 0px; } ``` > > You might add a content to wrap it, otherwise you'll have those rules applied to all columns in your lay...
30,179,644
I've done quite a bit of searching here on Stackoverflow on how to solve this problem efficiently, but I still haven't seemed to find exactly what I'm looking for. Basically, I have three columns that I want evenly spaced and centered across my page. However, when I set col-md-4 for all three columns, the end result i...
2015/05/12
[ "https://Stackoverflow.com/questions/30179644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4107391/" ]
If you use padding and change the background color, you may notice that the colors of the columns don't have much spacing between them. Perhaps a better option would be ``` .col-md-4 { margin-left: 5px; } ```
You can put another div to place your content inside the .col div, as the below example: ``` <div class="container"> <div class="row"> <div class="col-md-4"> <div class="content-wrapper" style="border:1px solid #000;"> <p>Some content here</p> </div> </div> <div class="col-md-4"> ...
30,179,644
I've done quite a bit of searching here on Stackoverflow on how to solve this problem efficiently, but I still haven't seemed to find exactly what I'm looking for. Basically, I have three columns that I want evenly spaced and centered across my page. However, when I set col-md-4 for all three columns, the end result i...
2015/05/12
[ "https://Stackoverflow.com/questions/30179644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4107391/" ]
Actually, your code already creates spaces between columns, because in bootstrap the column has 15px padding from each side. Your code is working normally, check here: <http://www.bootply.com/H6DQGdZxGy>
If you use padding and change the background color, you may notice that the colors of the columns don't have much spacing between them. Perhaps a better option would be ``` .col-md-4 { margin-left: 5px; } ```
30,179,644
I've done quite a bit of searching here on Stackoverflow on how to solve this problem efficiently, but I still haven't seemed to find exactly what I'm looking for. Basically, I have three columns that I want evenly spaced and centered across my page. However, when I set col-md-4 for all three columns, the end result i...
2015/05/12
[ "https://Stackoverflow.com/questions/30179644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4107391/" ]
Actually, your code already creates spaces between columns, because in bootstrap the column has 15px padding from each side. Your code is working normally, check here: <http://www.bootply.com/H6DQGdZxGy>
You have the option to use column offsetting col-md-offset-\*. You wouldn't be able to maintain the spacing of your columns (reduce 4 to 3), but I believe it should somewhat do the job for responsive spacing. Check this out: [twitter bootstrap grid system. Spacing between columns](https://stackoverflow.com/questions/...
30,179,644
I've done quite a bit of searching here on Stackoverflow on how to solve this problem efficiently, but I still haven't seemed to find exactly what I'm looking for. Basically, I have three columns that I want evenly spaced and centered across my page. However, when I set col-md-4 for all three columns, the end result i...
2015/05/12
[ "https://Stackoverflow.com/questions/30179644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4107391/" ]
Actually, your code already creates spaces between columns, because in bootstrap the column has 15px padding from each side. Your code is working normally, check here: <http://www.bootply.com/H6DQGdZxGy>
A 'hacky' way to do what you want is to give the columns a border that is the same color as the background.
30,179,644
I've done quite a bit of searching here on Stackoverflow on how to solve this problem efficiently, but I still haven't seemed to find exactly what I'm looking for. Basically, I have three columns that I want evenly spaced and centered across my page. However, when I set col-md-4 for all three columns, the end result i...
2015/05/12
[ "https://Stackoverflow.com/questions/30179644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4107391/" ]
It's a late answer but I guess that some people can be interessed by another explanation. Bootstrap "cols" system is not made to decorate but to place elements in pages. If you need to space column contents, you need to wrap your content: ``` <div class="row-fluid"> <div class="col-md-4"> <div class="col-spaced"> ...
If you use padding and change the background color, you may notice that the colors of the columns don't have much spacing between them. Perhaps a better option would be ``` .col-md-4 { margin-left: 5px; } ```
30,179,644
I've done quite a bit of searching here on Stackoverflow on how to solve this problem efficiently, but I still haven't seemed to find exactly what I'm looking for. Basically, I have three columns that I want evenly spaced and centered across my page. However, when I set col-md-4 for all three columns, the end result i...
2015/05/12
[ "https://Stackoverflow.com/questions/30179644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4107391/" ]
If you use padding and change the background color, you may notice that the colors of the columns don't have much spacing between them. Perhaps a better option would be ``` .col-md-4 { margin-left: 5px; } ```
You have the option to use column offsetting col-md-offset-\*. You wouldn't be able to maintain the spacing of your columns (reduce 4 to 3), but I believe it should somewhat do the job for responsive spacing. Check this out: [twitter bootstrap grid system. Spacing between columns](https://stackoverflow.com/questions/...
30,179,644
I've done quite a bit of searching here on Stackoverflow on how to solve this problem efficiently, but I still haven't seemed to find exactly what I'm looking for. Basically, I have three columns that I want evenly spaced and centered across my page. However, when I set col-md-4 for all three columns, the end result i...
2015/05/12
[ "https://Stackoverflow.com/questions/30179644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4107391/" ]
You can do something like: ``` [class*="col-"] { padding-right: 15px; padding-left: 15px; } [class*="col-"]:first-child { padding-left: 0px; } [class*="col-"]:last-child { padding-right: 0px; } ``` > > You might add a content to wrap it, otherwise you'll have those rules applied to all columns in your lay...
You can put another div to place your content inside the .col div, as the below example: ``` <div class="container"> <div class="row"> <div class="col-md-4"> <div class="content-wrapper" style="border:1px solid #000;"> <p>Some content here</p> </div> </div> <div class="col-md-4"> ...
30,179,644
I've done quite a bit of searching here on Stackoverflow on how to solve this problem efficiently, but I still haven't seemed to find exactly what I'm looking for. Basically, I have three columns that I want evenly spaced and centered across my page. However, when I set col-md-4 for all three columns, the end result i...
2015/05/12
[ "https://Stackoverflow.com/questions/30179644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4107391/" ]
A 'hacky' way to do what you want is to give the columns a border that is the same color as the background.
You have the option to use column offsetting col-md-offset-\*. You wouldn't be able to maintain the spacing of your columns (reduce 4 to 3), but I believe it should somewhat do the job for responsive spacing. Check this out: [twitter bootstrap grid system. Spacing between columns](https://stackoverflow.com/questions/...
202,569
> > Forgive me if I'm being naive, but, I don't understand why the $x$-coordinate of the Centre of mass is taken as an integral of $x.dm$ and not $m.dx$? > > > I understand the summation part, but how do we convert that into an integral? It could very well be a mathematics question, as the fundamentals of calculus...
2015/08/26
[ "https://physics.stackexchange.com/questions/202569", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/90163/" ]
We integrate $x\, dm$ to say "for every piece of mass $dm$, sum up the amount of mass times the coordinate $x$ of that mass". It's intuitive to integrate over $m$, because every piece of mass has an $x$-coordinate. Likewise, in kinematics, it makes intuitive sense to integrate over $t$ because for every $t$ we have a ...
The center of mass is an average *position* of a set of masses, with the position of each mass having an importance/probability factor directly proportional to the mass. When you find an average of some quantity *Y* which has importance *p* we do the following: $$\langle Y\rangle =\frac{\sum\_j Y\_j p\_j}{\sum\_j p\_j}...
56,007,221
I'm trying to determine if there is a way to switch up what I have below and export it in a comma delimited csv file. The script works fine and returns the data I care about, just not in a usable format. The script gets users in a specific group and loops through the user list pulling additional information for eac...
2019/05/06
[ "https://Stackoverflow.com/questions/56007221", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1904898/" ]
I removed your function because it is not entirely necessary for this process. You can easily modify it to use your function again. I also removed the dsquery and dsget commands because the ActiveDirectory module have commands that can get this information. ``` $members = Get-ADGroupMember "MyGroupName" -recursive | S...
Powershell makes this super easy. Your $members is a PSCollection, so you can literally just pass Process-Members into Export-Csv using a Pipe Operator. ``` Process-Members $members | Export-Csv -Path {Your Desired CSV Location} ``` That should do the trick. Check out the man page here: <https://learn.microsoft.co...
13,135,580
i have a scenario, lets say 3 users review a business of id 10, how can i get all the unique id of the user who review that business and and use that unique id to find another business review which is not equal to 10 ? sample table user\_review: ``` review_id | user_id | business_id | rating | review_date 1 ...
2012/10/30
[ "https://Stackoverflow.com/questions/13135580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1471938/" ]
Try this query: Here is link to sqlfidle with running results <http://sqlfiddle.com/#!2/cd4ea/1> ``` SELECT tblreview.*,tblusers.user_name FROM ( SELECT MAX(tblreview.review_id) review_id , tblreview.user_id FROM ( SELECT DISTINCT user_id ...
``` SELECT t1.* FROM TableName t1 INNER JOIN ( SELECT user_id, business_id, MAX(review_date) review_date FROM TableName WHERE business_id <> 10 GROUP BY user_id, business_id ) t2 ON t1.user_id = t2.user_id AND t1.review_date = t2.review_date AND t1.business_id = t2.business_id ```
13,135,580
i have a scenario, lets say 3 users review a business of id 10, how can i get all the unique id of the user who review that business and and use that unique id to find another business review which is not equal to 10 ? sample table user\_review: ``` review_id | user_id | business_id | rating | review_date 1 ...
2012/10/30
[ "https://Stackoverflow.com/questions/13135580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1471938/" ]
Try this query: Here is link to sqlfidle with running results <http://sqlfiddle.com/#!2/cd4ea/1> ``` SELECT tblreview.*,tblusers.user_name FROM ( SELECT MAX(tblreview.review_id) review_id , tblreview.user_id FROM ( SELECT DISTINCT user_id ...
Try this query - ``` SELECT * FROM ( SELECT * FROM user_review ORDER BY IF(business_id = 10, 1, 0), review_date DESC ) t GROUP BY user_id HAVING COUNT(IF(business_id = 10, 1, NULL)) > 0 AND COUNT(IF(business_id <> 10, 1, NULL)) > 0 +-----------+---------+-------------+--------+----------------+ | review...
37,943,618
I have been challenged with designing a code which validates a GTIN-8 code. I have looked on how to find the equal or higher multiple of a 10 and I have had no success so far, hope you guys can help me! Here is a small piece of code, I need to find the equal or higher multiple of 10. ``` NewNumber = (NewGtin_1 + Gtin...
2016/06/21
[ "https://Stackoverflow.com/questions/37943618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5690245/" ]
If you mean find the smallest multiple of 10 that is greater than or equal to your number, try ``` def round_up_by_10s(num): return -((-num) // 10) * 10 ``` That works for positive and negative numbers, integer or float, in Python 2.x or Python 3.x. It also avoids an if statement and can be written as a one-line...
Generally speaking You can find multiples with the [modulo](https://en.wikipedia.org/wiki/Modulo_operation) operation: ``` if number % 10 == 0: do something ```
37,943,618
I have been challenged with designing a code which validates a GTIN-8 code. I have looked on how to find the equal or higher multiple of a 10 and I have had no success so far, hope you guys can help me! Here is a small piece of code, I need to find the equal or higher multiple of 10. ``` NewNumber = (NewGtin_1 + Gtin...
2016/06/21
[ "https://Stackoverflow.com/questions/37943618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5690245/" ]
If you mean find the smallest multiple of 10 that is greater than or equal to your number, try ``` def round_up_by_10s(num): return -((-num) // 10) * 10 ``` That works for positive and negative numbers, integer or float, in Python 2.x or Python 3.x. It also avoids an if statement and can be written as a one-line...
I'm guessing you what the smallest multiple of 10 that is higher or equal than NewNumber. If that's the case, do: ``` last_digit = NewNumber % 10 bigger = NewNumber - last_digit if last_digit != 0: bigger += 10 ``` Also, you shouldn't use capital letters to start variable names, those are usually used for classes...
37,943,618
I have been challenged with designing a code which validates a GTIN-8 code. I have looked on how to find the equal or higher multiple of a 10 and I have had no success so far, hope you guys can help me! Here is a small piece of code, I need to find the equal or higher multiple of 10. ``` NewNumber = (NewGtin_1 + Gtin...
2016/06/21
[ "https://Stackoverflow.com/questions/37943618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5690245/" ]
If you mean find the smallest multiple of 10 that is greater than or equal to your number, try ``` def round_up_by_10s(num): return -((-num) // 10) * 10 ``` That works for positive and negative numbers, integer or float, in Python 2.x or Python 3.x. It also avoids an if statement and can be written as a one-line...
Trying using this: ``` # method 1 for integers n = NewNumber / 10 * 10 if n < NewNumber: n += 10 # method 2 for floats, decimals import math n = math.ceil(NewNumber / 10) * 10 ```
15,756,235
I have 2 SQL queries like this ``` SELECT TOP 100 PERCENT COUNT(kodeall) AS Total, kodeall, kode, LEFT(kodeall, 1) AS kode1 FROM dbo.data WHERE date BETWEEN '2013/03/01 00:00:00' AND '2013/03/01 23:59:00' AND (kodeall IS NOT NULL) GROUP BY kodeall, kode ORDER BY kode1 ``` and results ``` Tot...
2013/04/02
[ "https://Stackoverflow.com/questions/15756235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2181272/" ]
> > Is Android devices support JDBC. > > > Will Android 2.2 support JDBC. > > > If supported, which Android versions will support JDBC. > > > NO android does not support locally MYSQL database so we can not use JDBC connection frmo android device , its support **only** sqlite database . and if you want to use...
Download [MySQL JDBC Connector 3.0.17](http://downloads.mysql.com/archives.php?p=mysql-connector-java-3.0&v=3.0.17) and add it into you android project build path. ``` import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; i...
15,756,235
I have 2 SQL queries like this ``` SELECT TOP 100 PERCENT COUNT(kodeall) AS Total, kodeall, kode, LEFT(kodeall, 1) AS kode1 FROM dbo.data WHERE date BETWEEN '2013/03/01 00:00:00' AND '2013/03/01 23:59:00' AND (kodeall IS NOT NULL) GROUP BY kodeall, kode ORDER BY kode1 ``` and results ``` Tot...
2013/04/02
[ "https://Stackoverflow.com/questions/15756235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2181272/" ]
Yes. You must remember to put your JDBC connection code in an `AsyncTask`, otherwise you will BURN BURN BURN!
Download [MySQL JDBC Connector 3.0.17](http://downloads.mysql.com/archives.php?p=mysql-connector-java-3.0&v=3.0.17) and add it into you android project build path. ``` import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; i...
15,756,235
I have 2 SQL queries like this ``` SELECT TOP 100 PERCENT COUNT(kodeall) AS Total, kodeall, kode, LEFT(kodeall, 1) AS kode1 FROM dbo.data WHERE date BETWEEN '2013/03/01 00:00:00' AND '2013/03/01 23:59:00' AND (kodeall IS NOT NULL) GROUP BY kodeall, kode ORDER BY kode1 ``` and results ``` Tot...
2013/04/02
[ "https://Stackoverflow.com/questions/15756235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2181272/" ]
> > Is Android devices support JDBC. > > > Will Android 2.2 support JDBC. > > > If supported, which Android versions will support JDBC. > > > NO android does not support locally MYSQL database so we can not use JDBC connection frmo android device , its support **only** sqlite database . and if you want to use...
It sounds like your Mysql installation only allows connections from local host. Update your Mysql config to allow connections from any host. From what I can see java.sql is supported since API-level 1 and I don think the support will be removed any time soon. /Thomas
15,756,235
I have 2 SQL queries like this ``` SELECT TOP 100 PERCENT COUNT(kodeall) AS Total, kodeall, kode, LEFT(kodeall, 1) AS kode1 FROM dbo.data WHERE date BETWEEN '2013/03/01 00:00:00' AND '2013/03/01 23:59:00' AND (kodeall IS NOT NULL) GROUP BY kodeall, kode ORDER BY kode1 ``` and results ``` Tot...
2013/04/02
[ "https://Stackoverflow.com/questions/15756235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2181272/" ]
Yes. You must remember to put your JDBC connection code in an `AsyncTask`, otherwise you will BURN BURN BURN!
It sounds like your Mysql installation only allows connections from local host. Update your Mysql config to allow connections from any host. From what I can see java.sql is supported since API-level 1 and I don think the support will be removed any time soon. /Thomas
15,756,235
I have 2 SQL queries like this ``` SELECT TOP 100 PERCENT COUNT(kodeall) AS Total, kodeall, kode, LEFT(kodeall, 1) AS kode1 FROM dbo.data WHERE date BETWEEN '2013/03/01 00:00:00' AND '2013/03/01 23:59:00' AND (kodeall IS NOT NULL) GROUP BY kodeall, kode ORDER BY kode1 ``` and results ``` Tot...
2013/04/02
[ "https://Stackoverflow.com/questions/15756235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2181272/" ]
Yes. You must remember to put your JDBC connection code in an `AsyncTask`, otherwise you will BURN BURN BURN!
> > Is Android devices support JDBC. > > > Will Android 2.2 support JDBC. > > > If supported, which Android versions will support JDBC. > > > NO android does not support locally MYSQL database so we can not use JDBC connection frmo android device , its support **only** sqlite database . and if you want to use...
15,756,235
I have 2 SQL queries like this ``` SELECT TOP 100 PERCENT COUNT(kodeall) AS Total, kodeall, kode, LEFT(kodeall, 1) AS kode1 FROM dbo.data WHERE date BETWEEN '2013/03/01 00:00:00' AND '2013/03/01 23:59:00' AND (kodeall IS NOT NULL) GROUP BY kodeall, kode ORDER BY kode1 ``` and results ``` Tot...
2013/04/02
[ "https://Stackoverflow.com/questions/15756235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2181272/" ]
> > Is Android devices support JDBC. > > > Will Android 2.2 support JDBC. > > > If supported, which Android versions will support JDBC. > > > NO android does not support locally MYSQL database so we can not use JDBC connection frmo android device , its support **only** sqlite database . and if you want to use...
Yes, you can connect to a database using JDBC in android. Just add this line to your gradle dependency: ``` compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.44' ``` And don't forget to change the version according to your need. After adding this, gradle sync will be taking care of everything, yo...
15,756,235
I have 2 SQL queries like this ``` SELECT TOP 100 PERCENT COUNT(kodeall) AS Total, kodeall, kode, LEFT(kodeall, 1) AS kode1 FROM dbo.data WHERE date BETWEEN '2013/03/01 00:00:00' AND '2013/03/01 23:59:00' AND (kodeall IS NOT NULL) GROUP BY kodeall, kode ORDER BY kode1 ``` and results ``` Tot...
2013/04/02
[ "https://Stackoverflow.com/questions/15756235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2181272/" ]
Yes. You must remember to put your JDBC connection code in an `AsyncTask`, otherwise you will BURN BURN BURN!
Yes, you can connect to a database using JDBC in android. Just add this line to your gradle dependency: ``` compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.44' ``` And don't forget to change the version according to your need. After adding this, gradle sync will be taking care of everything, yo...
83,006
Why a room below the surface (such as basements) can stay cold all the time? How is it able to avoid the high increase of temperature and heat in hot days and periods?
2013/10/31
[ "https://physics.stackexchange.com/questions/83006", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/24900/" ]
Dirt is an exceptionally good insulator. As seasons change, the temperature of dirt 5-10ft underground changes a lot less than the temperature of the air. The deeper you go, the less the change. So, in the summer a basement will be "cool" because the ground surrounding it is cool (relative to outside temperatures), and...
Basements can also be cool due to the moisture in the surrounding ground if near a stream. As the outside ground gets hotter near the surface, moisture is evaporated making the ground cooler. One of the advantages of having a basement with some damp basement corners is that in the hot months the basement is dry and coo...
4,381,999
<http://www.google.com/apps/> > > 25GB email storage per user > > > but in the footnote it says: > > 7.527493 GB of email storage per account > > > It seems a bit precise. What's special about that number that I'm not seeing? I thought maybe it's a phone number (752-749-3000) but no answer.
2010/12/07
[ "https://Stackoverflow.com/questions/4381999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/436745/" ]
It's not special, it's increasing every second or so by a few Bytes or so. Go to <https://www.google.com/accounts/ServiceLogin?service=mail> and see how it increases.
> > What's special about that number that I'm not seeing? > > > 7.527493 is 2.39607544 \* pi. That new magic number, BTW, is 0.8814668939 \* e. And that magic number is 1.33e+33 times Planck's constant in Joule-seconds. I think that's what you might be missing.
2,011,374
``` function check_info(id,value){ var data = $("#"+id+":checked").val(); if(value==1){ if(data == 'on'){ var id_val = id.substring(7); $("#user_g"+id_val).css("display","block"); $(".chkbox_"+id_val).attr("checked","checked"); $("#user_hidden_"+id_val).va...
2010/01/06
[ "https://Stackoverflow.com/questions/2011374", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2185422/" ]
Consider: 1. rephrasing the `if(data == 'on')` as `if ($("#"+id).is(":checked"))` 2. replacing `.attr("checked", "")` with `.removeAttr("checked")` 3. binding the checkbox event with the following, instead of `onclick=` ``` $(function() { $("#gro_id_1").click(function() { check_info(this.id, '1'); });...
I would suggest to `use $("#user_g"+id_val).show()` instead of `$("#user_g"+id_val).css("display","block");` and `use $("#user_g"+id_val).hide()` instead of `$("#user_g"+id_val).css("display","none");`. This is probably not the issue, but this is the more "jQuery Standard" way of doing hiding and showing elements. Al...
1,683,519
I have to create a method which has an ArrayList; I need to remove even numbers from this ArrayList. I have written code for that but there is a logical error which I couldn't identify. Here is my code: ``` static void sortList(){ List <Integer> number=new ArrayList <Integer>(); number.add(11); number.add(...
2009/11/05
[ "https://Stackoverflow.com/questions/1683519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50190/" ]
The problem (as others have mentioned) is that you are modifying the list while you are traversing it. Try adding a "i--;" line inside your "if (even==0)" block. Like this: ``` for (int i=0;i<number.size();i++){ int even=number.get(i)%2; if (even==0){ System.out.println("This is Even Number:"+ number....
``` public class RemoveEvenUsingAL { public static void main(String[] args) { List<Integer> list= new ArrayList<Integer>(); list.add(1); list.add(2); list.add(3); list.add(4); list.add(5); list.add(6); Iterator<Integer> it = list.iterator(); ...
1,683,519
I have to create a method which has an ArrayList; I need to remove even numbers from this ArrayList. I have written code for that but there is a logical error which I couldn't identify. Here is my code: ``` static void sortList(){ List <Integer> number=new ArrayList <Integer>(); number.add(11); number.add(...
2009/11/05
[ "https://Stackoverflow.com/questions/1683519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50190/" ]
The problem (as others have mentioned) is that you are modifying the list while you are traversing it. Try adding a "i--;" line inside your "if (even==0)" block. Like this: ``` for (int i=0;i<number.size();i++){ int even=number.get(i)%2; if (even==0){ System.out.println("This is Even Number:"+ number....
Here's another nifty way of filtering for odd elements. Instead of looping through the collection manually, offload the work to [Apache Commons Collections](http://commons.apache.org/collections/) ``` // apply a filter to the collection CollectionUtils.filter(numbers, new Predicate() { public boolean evaluate(O...
1,683,519
I have to create a method which has an ArrayList; I need to remove even numbers from this ArrayList. I have written code for that but there is a logical error which I couldn't identify. Here is my code: ``` static void sortList(){ List <Integer> number=new ArrayList <Integer>(); number.add(11); number.add(...
2009/11/05
[ "https://Stackoverflow.com/questions/1683519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50190/" ]
Both answers about list indices changing are correct. However, also be aware that removing an item from an ArrayList is slow because it has to actually shuffle all of the following entries down. Instead, I recommend creating a new list containing only the even numbers, and then just throwing away the old list. If you w...
``` public class RemoveEvenUsingAL { public static void main(String[] args) { List<Integer> list= new ArrayList<Integer>(); list.add(1); list.add(2); list.add(3); list.add(4); list.add(5); list.add(6); Iterator<Integer> it = list.iterator(); ...
1,683,519
I have to create a method which has an ArrayList; I need to remove even numbers from this ArrayList. I have written code for that but there is a logical error which I couldn't identify. Here is my code: ``` static void sortList(){ List <Integer> number=new ArrayList <Integer>(); number.add(11); number.add(...
2009/11/05
[ "https://Stackoverflow.com/questions/1683519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50190/" ]
If you remove an entry from the list whilst looping over it, you'll have to adjust your loop index. Don't forget, removing the element reduces the length of the list by one, and effectively "shuffles back" the index of all elements after it.
We can use removeIf default method in ArrayList class . ``` List <Integer> number=new ArrayList <Integer>(); number.add(11); number.add(45); number.add(12); number.add(32); number.add(36); number.removeIf(num -> num%2==0); System.out.println(number); ```
1,683,519
I have to create a method which has an ArrayList; I need to remove even numbers from this ArrayList. I have written code for that but there is a logical error which I couldn't identify. Here is my code: ``` static void sortList(){ List <Integer> number=new ArrayList <Integer>(); number.add(11); number.add(...
2009/11/05
[ "https://Stackoverflow.com/questions/1683519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50190/" ]
If you remove an entry from the list whilst looping over it, you'll have to adjust your loop index. Don't forget, removing the element reduces the length of the list by one, and effectively "shuffles back" the index of all elements after it.
``` public class RemoveEvenUsingAL { public static void main(String[] args) { List<Integer> list= new ArrayList<Integer>(); list.add(1); list.add(2); list.add(3); list.add(4); list.add(5); list.add(6); Iterator<Integer> it = list.iterator(); ...
1,683,519
I have to create a method which has an ArrayList; I need to remove even numbers from this ArrayList. I have written code for that but there is a logical error which I couldn't identify. Here is my code: ``` static void sortList(){ List <Integer> number=new ArrayList <Integer>(); number.add(11); number.add(...
2009/11/05
[ "https://Stackoverflow.com/questions/1683519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50190/" ]
Use an [`Iterator`](http://java.sun.com/javase/6/docs/api/java/util/Iterator.html). It has an `remove()` method which you need. ``` List<Integer> numbers = new ArrayList<Integer>(); numbers.add(11); numbers.add(45); numbers.add(12); numbers.add(32); numbers.add(36); System.out.println("Unsorted List: " + numbers); ...
If you remove an entry from the list whilst looping over it, you'll have to adjust your loop index. Don't forget, removing the element reduces the length of the list by one, and effectively "shuffles back" the index of all elements after it.
1,683,519
I have to create a method which has an ArrayList; I need to remove even numbers from this ArrayList. I have written code for that but there is a logical error which I couldn't identify. Here is my code: ``` static void sortList(){ List <Integer> number=new ArrayList <Integer>(); number.add(11); number.add(...
2009/11/05
[ "https://Stackoverflow.com/questions/1683519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50190/" ]
When you remove something from the list, the indexes of everything after that changes! Specifically, in your implementation 32 is not removed as it comes directly after another even number. I would use an Iterator to walk over the list, and the remove operation on that iterator instead, something like this: ``` for(...
The problem (as others have mentioned) is that you are modifying the list while you are traversing it. Try adding a "i--;" line inside your "if (even==0)" block. Like this: ``` for (int i=0;i<number.size();i++){ int even=number.get(i)%2; if (even==0){ System.out.println("This is Even Number:"+ number....
1,683,519
I have to create a method which has an ArrayList; I need to remove even numbers from this ArrayList. I have written code for that but there is a logical error which I couldn't identify. Here is my code: ``` static void sortList(){ List <Integer> number=new ArrayList <Integer>(); number.add(11); number.add(...
2009/11/05
[ "https://Stackoverflow.com/questions/1683519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50190/" ]
Both answers about list indices changing are correct. However, also be aware that removing an item from an ArrayList is slow because it has to actually shuffle all of the following entries down. Instead, I recommend creating a new list containing only the even numbers, and then just throwing away the old list. If you w...
The problem (as others have mentioned) is that you are modifying the list while you are traversing it. Try adding a "i--;" line inside your "if (even==0)" block. Like this: ``` for (int i=0;i<number.size();i++){ int even=number.get(i)%2; if (even==0){ System.out.println("This is Even Number:"+ number....
1,683,519
I have to create a method which has an ArrayList; I need to remove even numbers from this ArrayList. I have written code for that but there is a logical error which I couldn't identify. Here is my code: ``` static void sortList(){ List <Integer> number=new ArrayList <Integer>(); number.add(11); number.add(...
2009/11/05
[ "https://Stackoverflow.com/questions/1683519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50190/" ]
When you remove something from the list, the indexes of everything after that changes! Specifically, in your implementation 32 is not removed as it comes directly after another even number. I would use an Iterator to walk over the list, and the remove operation on that iterator instead, something like this: ``` for(...
Here's another nifty way of filtering for odd elements. Instead of looping through the collection manually, offload the work to [Apache Commons Collections](http://commons.apache.org/collections/) ``` // apply a filter to the collection CollectionUtils.filter(numbers, new Predicate() { public boolean evaluate(O...
1,683,519
I have to create a method which has an ArrayList; I need to remove even numbers from this ArrayList. I have written code for that but there is a logical error which I couldn't identify. Here is my code: ``` static void sortList(){ List <Integer> number=new ArrayList <Integer>(); number.add(11); number.add(...
2009/11/05
[ "https://Stackoverflow.com/questions/1683519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50190/" ]
When you remove something from the list, the indexes of everything after that changes! Specifically, in your implementation 32 is not removed as it comes directly after another even number. I would use an Iterator to walk over the list, and the remove operation on that iterator instead, something like this: ``` for(...
If you remove an entry from the list whilst looping over it, you'll have to adjust your loop index. Don't forget, removing the element reduces the length of the list by one, and effectively "shuffles back" the index of all elements after it.
16,430,652
what is wrong with the following? ``` <table> <tr> <th> Blah </th> <th colspan="2"> Something </th> </tr> <tr> <td> .. </td> <td colspan="2"> ... </td> </tr> </table> ``` It says **Table column 3established by element th has no cells beginning in it.**
2013/05/08
[ "https://Stackoverflow.com/questions/16430652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1164501/" ]
As the error message says, there is no cell that begins in the third column. It thus violates the HTML table model as defined in HTML5, rather technically in [4.9.12 Processing model](http://www.w3.org/TR/html5/tabular-data.html#processing-model-1). Basically, the point is that you cannot create a column that consists ...
I've validated your HTML code with two doctypes: * HTML5; * XHTML 1.0 Strict. And your document was successfully checked as valid. You should try to revalidate it.
84,368
Is it possible to disable future dates in the Salesforce date picker? If so, how can this be done?
2015/07/22
[ "https://salesforce.stackexchange.com/questions/84368", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/9839/" ]
You can do in a complicated way using visual force and custom date picker. However I feel the best way to write a validation rule upon save to save if the selected date is in future or not, and throw the error respectively.
If VF page is not an option, [This](http://www.codebycody.com/2011/05/fix-for-salesforcecom-date-picker-year.html) can help you out which actually increases the years, you can tweak the code to decrease. But since Salesforce may not support Javascript in sidebar , you might have to combine with [this approach](https://...
46,116,600
currently i am practicing bootstrap and html, i am trying to center my `<h1>` on the navbar , i've tried a lot of ways, even with the css way it didn't work, so here is my image[![screen](https://i.stack.imgur.com/IqMWc.png)](https://i.stack.imgur.com/IqMWc.png) for your reference, i used this code within my HTML, bu...
2017/09/08
[ "https://Stackoverflow.com/questions/46116600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8142284/" ]
Add `flex: 1;` to your anchor element with the e-ticket text and that should work. Check this link for [flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/). ```html <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet"/> <nav class="na...
Using center-block class should work- ``` <a class="nabar center-block" id="nabar" href="#" style="color: #2c3e50; text-align:center;">e-ticket</a> ``` Please find the working demo here- <https://jsbin.com/quqususuda/edit?html,output>
46,116,600
currently i am practicing bootstrap and html, i am trying to center my `<h1>` on the navbar , i've tried a lot of ways, even with the css way it didn't work, so here is my image[![screen](https://i.stack.imgur.com/IqMWc.png)](https://i.stack.imgur.com/IqMWc.png) for your reference, i used this code within my HTML, bu...
2017/09/08
[ "https://Stackoverflow.com/questions/46116600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8142284/" ]
Simply use `mx-auto`... <https://www.codeply.com/go/S2g7bPmHjN> ``` <nav class="navbar navbar-toggleable-md navbar-light bg-faded" style="background-color: #ecf0f1"> <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navba...
Using center-block class should work- ``` <a class="nabar center-block" id="nabar" href="#" style="color: #2c3e50; text-align:center;">e-ticket</a> ``` Please find the working demo here- <https://jsbin.com/quqususuda/edit?html,output>
34,286,492
I'm using Ubuntu 14.04 and PyCharm (the latter is irrelevant I think but...) In my code, an import from the package `six` does not work and I tried updating (the version in usr/lib/python2.7/ is 1.5.2, while I need 1.10) But I'm getting the response: ``` Found existing installation: six 1.5.2 Not uninstalling s...
2015/12/15
[ "https://Stackoverflow.com/questions/34286492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4952564/" ]
I got the same problem with requests lib I got this massage when I tried to upgrade or uninstall requests ``` Not uninstalling requests at /usr/lib/python2.7/dist-packages, owned by OS ``` so what I did and it help I just went to the dist-packages folder and deleted **requests-2.2.1.egg-info file** and then I coul...
`python-six 1.10` will come in *xenial*. Nevertheless, you don't have to upgrade your OS, you can download and install a single package. <http://packages.ubuntu.com/xenial/all/python-six/download>
34,286,492
I'm using Ubuntu 14.04 and PyCharm (the latter is irrelevant I think but...) In my code, an import from the package `six` does not work and I tried updating (the version in usr/lib/python2.7/ is 1.5.2, while I need 1.10) But I'm getting the response: ``` Found existing installation: six 1.5.2 Not uninstalling s...
2015/12/15
[ "https://Stackoverflow.com/questions/34286492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4952564/" ]
Seems like you have two copies installed here. One is in OS directory ( /usr/lib). The other is probably by pip ( /usr/local/lib). You might be able to fix it by uninstall the 1.5.2 using ``` sudo apt-get uninstall .... ``` Then 1.10 in local directory will be used instead.
`python-six 1.10` will come in *xenial*. Nevertheless, you don't have to upgrade your OS, you can download and install a single package. <http://packages.ubuntu.com/xenial/all/python-six/download>
34,286,492
I'm using Ubuntu 14.04 and PyCharm (the latter is irrelevant I think but...) In my code, an import from the package `six` does not work and I tried updating (the version in usr/lib/python2.7/ is 1.5.2, while I need 1.10) But I'm getting the response: ``` Found existing installation: six 1.5.2 Not uninstalling s...
2015/12/15
[ "https://Stackoverflow.com/questions/34286492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4952564/" ]
``` # sudo pip install --upgrade pip ``` When you do the above you get the below error message, ``` Not uninstalling pip at /usr/lib/python2.7/dist-packages, owned by OS ``` but the new pip is actually installed in the /usr/local/lib/python2.7/dist-packages/pip. At this point pip version still shows the pip insta...
`python-six 1.10` will come in *xenial*. Nevertheless, you don't have to upgrade your OS, you can download and install a single package. <http://packages.ubuntu.com/xenial/all/python-six/download>
34,286,492
I'm using Ubuntu 14.04 and PyCharm (the latter is irrelevant I think but...) In my code, an import from the package `six` does not work and I tried updating (the version in usr/lib/python2.7/ is 1.5.2, while I need 1.10) But I'm getting the response: ``` Found existing installation: six 1.5.2 Not uninstalling s...
2015/12/15
[ "https://Stackoverflow.com/questions/34286492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4952564/" ]
I got the same problem with requests lib I got this massage when I tried to upgrade or uninstall requests ``` Not uninstalling requests at /usr/lib/python2.7/dist-packages, owned by OS ``` so what I did and it help I just went to the dist-packages folder and deleted **requests-2.2.1.egg-info file** and then I coul...
Seems like you have two copies installed here. One is in OS directory ( /usr/lib). The other is probably by pip ( /usr/local/lib). You might be able to fix it by uninstall the 1.5.2 using ``` sudo apt-get uninstall .... ``` Then 1.10 in local directory will be used instead.
34,286,492
I'm using Ubuntu 14.04 and PyCharm (the latter is irrelevant I think but...) In my code, an import from the package `six` does not work and I tried updating (the version in usr/lib/python2.7/ is 1.5.2, while I need 1.10) But I'm getting the response: ``` Found existing installation: six 1.5.2 Not uninstalling s...
2015/12/15
[ "https://Stackoverflow.com/questions/34286492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4952564/" ]
I got the same problem with requests lib I got this massage when I tried to upgrade or uninstall requests ``` Not uninstalling requests at /usr/lib/python2.7/dist-packages, owned by OS ``` so what I did and it help I just went to the dist-packages folder and deleted **requests-2.2.1.egg-info file** and then I coul...
``` # sudo pip install --upgrade pip ``` When you do the above you get the below error message, ``` Not uninstalling pip at /usr/lib/python2.7/dist-packages, owned by OS ``` but the new pip is actually installed in the /usr/local/lib/python2.7/dist-packages/pip. At this point pip version still shows the pip insta...
73,406,779
When searching how to attach an event listener to a dynamically loaded div [the accepted answer](https://stackoverflow.com/a/34896387/9013718) seems to be event delegation. I did not find another suggested way when HTML is added with `insertAdjacentHTML`. I am adding divs to the DOM like follows: ```js document.getEl...
2022/08/18
[ "https://Stackoverflow.com/questions/73406779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9013718/" ]
You can use [`Element.closest`](https://developer.mozilla.org/en-US/docs/Web/API/Element/closest) to retrieve the element you need. ```js document.getElementById('container').insertAdjacentHTML( 'beforeend', `<div class="card"> <div class="card-header">Card header content</div> <div class="card-body"> <h2>Ca...
You can try create the cards and assign listener to them in this way, then use `this` instead of `e.target`: ```js const cardElement = document.createElement('div') cardElement.classList.add('card') cardElement.insertAdjacentHTML( 'beforeend', ` <div class="card-header">Card header content</div> <div class="card...
73,406,779
When searching how to attach an event listener to a dynamically loaded div [the accepted answer](https://stackoverflow.com/a/34896387/9013718) seems to be event delegation. I did not find another suggested way when HTML is added with `insertAdjacentHTML`. I am adding divs to the DOM like follows: ```js document.getEl...
2022/08/18
[ "https://Stackoverflow.com/questions/73406779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9013718/" ]
You can use [`Element.closest`](https://developer.mozilla.org/en-US/docs/Web/API/Element/closest) to retrieve the element you need. ```js document.getElementById('container').insertAdjacentHTML( 'beforeend', `<div class="card"> <div class="card-header">Card header content</div> <div class="card-body"> <h2>Ca...
I'm just expanding a bit on @KooiInc's answer, all credit and upvotes should go to KooiInc... `.closest()` is a *great* tool for event delegation. I think the concept can be demonstrated more clearly by putting in a second card. I've added a `cardId` so it can be clearly seen in the console output which card was found...
73,406,779
When searching how to attach an event listener to a dynamically loaded div [the accepted answer](https://stackoverflow.com/a/34896387/9013718) seems to be event delegation. I did not find another suggested way when HTML is added with `insertAdjacentHTML`. I am adding divs to the DOM like follows: ```js document.getEl...
2022/08/18
[ "https://Stackoverflow.com/questions/73406779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9013718/" ]
You can try create the cards and assign listener to them in this way, then use `this` instead of `e.target`: ```js const cardElement = document.createElement('div') cardElement.classList.add('card') cardElement.insertAdjacentHTML( 'beforeend', ` <div class="card-header">Card header content</div> <div class="card...
I'm just expanding a bit on @KooiInc's answer, all credit and upvotes should go to KooiInc... `.closest()` is a *great* tool for event delegation. I think the concept can be demonstrated more clearly by putting in a second card. I've added a `cardId` so it can be clearly seen in the console output which card was found...
11,520,410
Summary: It just doesn't draw outside of the initial form size. I can scale down, just not scale up, it get cropped off. Description if Summary isn't clear enough: Therefore if my form is initially size 1000,800. My image drawn will never be larger than 1000,800 after scaling. It will be cropped off, if I scaled the...
2012/07/17
[ "https://Stackoverflow.com/questions/11520410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1522591/" ]
Your *mapDrawer* object is the problem although it is impossible to see from the inadequate snippet. It is no doubt a Graphics object that you created early, maybe in the form's Load event. It has a clipping region that was based on the size of the form at that time. If you then make the form larger by resizing it, you...
My best guess is that you need to redraw the image when the Form is repainted: ``` private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; g.DrawImage(map1, new RectangleF(0, 0, ImageSizeX * scale, ImageSizeY * scale), new RectangleF(0, 0, ImageSizeX, ImageSizeY), ...
3,131,755
I have this string: ``` $str = '<div class="defaultClass">...</div>'; ``` how do I append 'myClass' next to 'defaultClass' ?
2010/06/28
[ "https://Stackoverflow.com/questions/3131755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/376947/" ]
The "class" attribute is just a space separated list of classes. ``` $str = '<div class="defaultClass myClass">...</div>'; ``` Or you could hack it together like this: ``` $str = '<div class="defaultClass">...</div>'; $str = str_replace('class="defaultClass', 'class="myClass defaultClass', $str); //Result: <div cla...
``` $str = '<div class="defaultClass ' . $myclass . '">...</div>'; ``` This assumes myClass is variable
3,131,755
I have this string: ``` $str = '<div class="defaultClass">...</div>'; ``` how do I append 'myClass' next to 'defaultClass' ?
2010/06/28
[ "https://Stackoverflow.com/questions/3131755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/376947/" ]
The "class" attribute is just a space separated list of classes. ``` $str = '<div class="defaultClass myClass">...</div>'; ``` Or you could hack it together like this: ``` $str = '<div class="defaultClass">...</div>'; $str = str_replace('class="defaultClass', 'class="myClass defaultClass', $str); //Result: <div cla...
I would take a look at a system Called SimpleDom! Heres a small example! ``` // Create DOM from string $html = str_get_html('<div class="defaultClass"><strong>Robert Pitt</strong></div>'); $html->find('div', 1)->class = 'SomeClass'; $html->find('div[id=hello]', 0)->innertext = 'foo'; echo $html; // Output: <div id...
3,131,755
I have this string: ``` $str = '<div class="defaultClass">...</div>'; ``` how do I append 'myClass' next to 'defaultClass' ?
2010/06/28
[ "https://Stackoverflow.com/questions/3131755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/376947/" ]
The "class" attribute is just a space separated list of classes. ``` $str = '<div class="defaultClass myClass">...</div>'; ``` Or you could hack it together like this: ``` $str = '<div class="defaultClass">...</div>'; $str = str_replace('class="defaultClass', 'class="myClass defaultClass', $str); //Result: <div cla...
With native [DOM](http://de2.php.net/manual/en/book.dom.php): ``` $dom = new DOMDocument; $dom->loadHTML('<div class="defaultClass">...</div>'); $divs = $dom->getElementsByTagName('div'); foreach($divs as $div) { $div->setAttribute('class', $div->getAttribute('class') . ' some-other-class'); } echo $dom-...
3,131,755
I have this string: ``` $str = '<div class="defaultClass">...</div>'; ``` how do I append 'myClass' next to 'defaultClass' ?
2010/06/28
[ "https://Stackoverflow.com/questions/3131755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/376947/" ]
I would take a look at a system Called SimpleDom! Heres a small example! ``` // Create DOM from string $html = str_get_html('<div class="defaultClass"><strong>Robert Pitt</strong></div>'); $html->find('div', 1)->class = 'SomeClass'; $html->find('div[id=hello]', 0)->innertext = 'foo'; echo $html; // Output: <div id...
``` $str = '<div class="defaultClass ' . $myclass . '">...</div>'; ``` This assumes myClass is variable
3,131,755
I have this string: ``` $str = '<div class="defaultClass">...</div>'; ``` how do I append 'myClass' next to 'defaultClass' ?
2010/06/28
[ "https://Stackoverflow.com/questions/3131755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/376947/" ]
With native [DOM](http://de2.php.net/manual/en/book.dom.php): ``` $dom = new DOMDocument; $dom->loadHTML('<div class="defaultClass">...</div>'); $divs = $dom->getElementsByTagName('div'); foreach($divs as $div) { $div->setAttribute('class', $div->getAttribute('class') . ' some-other-class'); } echo $dom-...
``` $str = '<div class="defaultClass ' . $myclass . '">...</div>'; ``` This assumes myClass is variable
3,131,755
I have this string: ``` $str = '<div class="defaultClass">...</div>'; ``` how do I append 'myClass' next to 'defaultClass' ?
2010/06/28
[ "https://Stackoverflow.com/questions/3131755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/376947/" ]
With native [DOM](http://de2.php.net/manual/en/book.dom.php): ``` $dom = new DOMDocument; $dom->loadHTML('<div class="defaultClass">...</div>'); $divs = $dom->getElementsByTagName('div'); foreach($divs as $div) { $div->setAttribute('class', $div->getAttribute('class') . ' some-other-class'); } echo $dom-...
I would take a look at a system Called SimpleDom! Heres a small example! ``` // Create DOM from string $html = str_get_html('<div class="defaultClass"><strong>Robert Pitt</strong></div>'); $html->find('div', 1)->class = 'SomeClass'; $html->find('div[id=hello]', 0)->innertext = 'foo'; echo $html; // Output: <div id...
49,265,327
I'm new using MVC C# on web applications...and I am having troubles deleting a row in the database...the result is an "HTTP Error 400.0 - Bad Request" I'm not get this error when tables have just 1 primary keys. Controller: ``` // GET: DocenteCursoes/Delete/5 public ActionResult Delete(string curso, string docen...
2018/03/13
[ "https://Stackoverflow.com/questions/49265327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8005059/" ]
**A RestHighLevelClient instance needs a REST low-level client builder to be built as follows**: ``` RestHighLevelClient client = new RestHighLevelClient( RestClient.builder( new HttpHost("localhost", 9200, "http"), new HttpHost("localhost", 9201, "http"))); ``` **Create an...
If you know how to insert documents through API then this way will much more easy for you to do anything similar API (DELETE,POST,PUT...) First, you will need RestHighLevelClient and all you have to do ``` String index = "/s3-upload-2022.10.04/_doc/2"; <-- Your path Request request = new Request("POST", index); <-- Y...
185,868
I have recently installed MacPorts. Whenever I try to install anything, however, I get an error of the following format: ``` m2214:~ speyer$ sudo port install xfig Password: ---> Computing dependencies for xfigError: Internal error: port lookup failed: too many nested evaluations (infinite loop?) Error: Status 1 enco...
2010/09/08
[ "https://superuser.com/questions/185868", "https://superuser.com", "https://superuser.com/users/48725/" ]
I've done this in the past with good success. We had a ton of white box computers with exactly the same hardware, and several spare hard drives. There were at least 2 of the drives that had the same symptoms you describe, and we are able to take the boards off the bad drives, connect boards from fresh drives, and every...
It's possible to swap controller cards from one disk to another, provided the disks are the same model, capacity, revision, firmware, etc. You should make sure that the model numbers on the disk labels are exactly the same, although I've never damaged a drive by doing this. You'll probably need a Torx T8 bit to do it....
185,868
I have recently installed MacPorts. Whenever I try to install anything, however, I get an error of the following format: ``` m2214:~ speyer$ sudo port install xfig Password: ---> Computing dependencies for xfigError: Internal error: port lookup failed: too many nested evaluations (infinite loop?) Error: Status 1 enco...
2010/09/08
[ "https://superuser.com/questions/185868", "https://superuser.com", "https://superuser.com/users/48725/" ]
Yeah, if you have another identical drive, the swap should work. Bear in mind, though, that you might end up exposing the platters in doing so... and if you do that, kiss your data goodbye. I would suggest sending the drive to a data recovery service (google for a local service). It won't be cheap, but you could easily...
It's possible to swap controller cards from one disk to another, provided the disks are the same model, capacity, revision, firmware, etc. You should make sure that the model numbers on the disk labels are exactly the same, although I've never damaged a drive by doing this. You'll probably need a Torx T8 bit to do it....
185,868
I have recently installed MacPorts. Whenever I try to install anything, however, I get an error of the following format: ``` m2214:~ speyer$ sudo port install xfig Password: ---> Computing dependencies for xfigError: Internal error: port lookup failed: too many nested evaluations (infinite loop?) Error: Status 1 enco...
2010/09/08
[ "https://superuser.com/questions/185868", "https://superuser.com", "https://superuser.com/users/48725/" ]
I've done this in the past with good success. We had a ton of white box computers with exactly the same hardware, and several spare hard drives. There were at least 2 of the drives that had the same symptoms you describe, and we are able to take the boards off the bad drives, connect boards from fresh drives, and every...
bear in mind with either solution, you will want to have a drive ready and able to do a complete mirror. As you don't know what the problem is or how long the drive will last or whether it will power up on a second attempt, you want to be ready to move that data off.
185,868
I have recently installed MacPorts. Whenever I try to install anything, however, I get an error of the following format: ``` m2214:~ speyer$ sudo port install xfig Password: ---> Computing dependencies for xfigError: Internal error: port lookup failed: too many nested evaluations (infinite loop?) Error: Status 1 enco...
2010/09/08
[ "https://superuser.com/questions/185868", "https://superuser.com", "https://superuser.com/users/48725/" ]
Yeah, if you have another identical drive, the swap should work. Bear in mind, though, that you might end up exposing the platters in doing so... and if you do that, kiss your data goodbye. I would suggest sending the drive to a data recovery service (google for a local service). It won't be cheap, but you could easily...
bear in mind with either solution, you will want to have a drive ready and able to do a complete mirror. As you don't know what the problem is or how long the drive will last or whether it will power up on a second attempt, you want to be ready to move that data off.
13,522,188
I want the user when he/she clicks a button for a value from an array to be inserted into one of five div boxes. The code has no errors on firebug but when I click the button nothing happens. What's wrong with my code. Here is the jsfiddle example <http://jsfiddle.net/fHHnq/13/> Here is the relevant js code... ``` va...
2012/11/23
[ "https://Stackoverflow.com/questions/13522188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1509401/" ]
You're incorrectly assigning classes and your HTML uses `-`, but your JavaScript is using `_` for class names. Here is the working jsfiddle: <http://jsfiddle.net/fHHnq/16/>
In your html you are using " class-1 " and in your javascript you are using " $('.class\_' + number)" which will result class\_1. so there is mismatch in class-1 and class\_1
43,845,837
I have two arrays `x=[1,2,3,4]` and `y=[1,0,0,1]` describing 2D points (x,y). I want to know how many elements have `x>2` **and** `y==1`. What is the most simple way to do this (without any loops)? Is it possible to do something like `x[x>2]`, but for two conditions?
2017/05/08
[ "https://Stackoverflow.com/questions/43845837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7533694/" ]
Assuming these are numpy arrays, since your `x[x>2]` is numpy syntax, you just need the and (`&`) operator: ``` meet_cond = (x > 2) & (y == 1) how_many = meet_cond.sum() which_x = x[meet_cond] which_y = y[meet_cond] ```
If `x` and `y` belong together as points, you might want to pack them into a `np` 2D array: ``` >>> import numpy as np >>> x = np.array([1, 2, 3, 4]) >>> y = np.array([1, 0, 0, 1]) >>> xy = np.array([x, y]).T >>> xy[(x > 2) & (y == 1)] array([[4, 1]]) >>> xy[(xy[:, 0] > 2) & (xy[:, 1] == 1)] array([[4, 1]]) >>> np.cou...
26,144,446
I understand that my issue is that jQuery is trying to parse the body of the response as json, but the body is undefined, and thus throws an error. I cannot change the response. This is the default response from Jenkins servers. It sends a 201, 404, or 500 in the header, which I would like to handle. my ajax: ``` $...
2014/10/01
[ "https://Stackoverflow.com/questions/26144446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4099324/" ]
You can have specific callbacks for status codes such as: ``` $.ajax({ ... statusCode: { 201: function() { /* I received a 201 */ }, 404: function() { /* I received a 404 */ }, 500: function() { /* I received a 500 */ } } }); ``` This is listed in [the documentation](http://api.jquery.com/jq...
The status code determines which of the functions (i.e. `complete` ,`error`, or `success` ) that jQuery will fire. So, try this: ``` $.ajax({ type: 'POST', url: url, dataType: 'text', complete: function(response) { console.log(response); }); ``` In the future, this will allow you to ...
26,144,446
I understand that my issue is that jQuery is trying to parse the body of the response as json, but the body is undefined, and thus throws an error. I cannot change the response. This is the default response from Jenkins servers. It sends a 201, 404, or 500 in the header, which I would like to handle. my ajax: ``` $...
2014/10/01
[ "https://Stackoverflow.com/questions/26144446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4099324/" ]
You can have specific callbacks for status codes such as: ``` $.ajax({ ... statusCode: { 201: function() { /* I received a 201 */ }, 404: function() { /* I received a 404 */ }, 500: function() { /* I received a 500 */ } } }); ``` This is listed in [the documentation](http://api.jquery.com/jq...
Just use the `complete` handler - it will run after `success` or `error` have been called. Either way, for both `complete` and `error`, the first parameter is a [`jqXHR`](http://api.jquery.com/Types/#jqXHR) object, which has a `status` property which will give you the status of the response. ``` $.ajax({ type: 'PO...
26,144,446
I understand that my issue is that jQuery is trying to parse the body of the response as json, but the body is undefined, and thus throws an error. I cannot change the response. This is the default response from Jenkins servers. It sends a 201, 404, or 500 in the header, which I would like to handle. my ajax: ``` $...
2014/10/01
[ "https://Stackoverflow.com/questions/26144446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4099324/" ]
You can have specific callbacks for status codes such as: ``` $.ajax({ ... statusCode: { 201: function() { /* I received a 201 */ }, 404: function() { /* I received a 404 */ }, 500: function() { /* I received a 500 */ } } }); ``` This is listed in [the documentation](http://api.jquery.com/jq...
If I well mean this, u want check a respons from server (201, 200, 500): maybe use `.awlways()` ``` $.ajax({ type: 'POST', url: url, dataType: 'text', always: function(status){ alert(status); } }); ``` or u can use a `getAllResponseHeaders()` on xhr object ?
26,144,446
I understand that my issue is that jQuery is trying to parse the body of the response as json, but the body is undefined, and thus throws an error. I cannot change the response. This is the default response from Jenkins servers. It sends a 201, 404, or 500 in the header, which I would like to handle. my ajax: ``` $...
2014/10/01
[ "https://Stackoverflow.com/questions/26144446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4099324/" ]
You can have specific callbacks for status codes such as: ``` $.ajax({ ... statusCode: { 201: function() { /* I received a 201 */ }, 404: function() { /* I received a 404 */ }, 500: function() { /* I received a 500 */ } } }); ``` This is listed in [the documentation](http://api.jquery.com/jq...
You can use `statusCode` ``` $.ajax({ type: 'POST', url: url, statusCode: { 200: function (response) { alert('200'); }, 201: function (response) { alert('201'); }, 404: function (response) { alert('400'); } }, success: function () { alert...
37,667,031
Recently I started learning Laravel by following the Laravel From Scratch cast(<https://laracasts.com/series/laravel-5-from-scratch>). Right now I'm trying to add additional functionality to the registration form(starting with error feedback) and I already ran into a problem. Is there a (native) way to check wether t...
2016/06/06
[ "https://Stackoverflow.com/questions/37667031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2002064/" ]
I think you want to achieve this: ``` if( old('name') ){ // name has been submitted if( $errors->first('name') ){ // there is at least an error on it // add error class }else{ // has been submitted without errors // add valid class } } ``` That in a input field is something like this: ``` <input name=...
Rick, You can validate you should have a look at the validate function in Laravel. You can validate the input you sent in and when there are errors send them back into your view. For examples look at the url: <https://laravel.com/docs/5.1/validation> Hope this helps.
40,253,448
I am using text analysis with Azure ML. So in my python script I want to create a bag of word model and then calculate TFIDF of each words. For that I am using gensim model, It's not working on Azure ML. So is there any options for me?
2016/10/26
[ "https://Stackoverflow.com/questions/40253448", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5915270/" ]
You have to use the ":valid" pseudo-class to accomplish your task. This is a working code for your situation: ``` <!-- CSS --> <style> /* select the #sadFace preceded by a valid input */ input:valid ~ #sadFace { display: none; } </style> <!-- html --> <label for...
The selector you're using (`#sad.required`) refers to an element that has an `id='sad'` and `class='required'`. I'm assuming you mean to refer to the child `img` element of every `input` that is required; you should use `input[required] #sad` as your selector if that is the case. You should note that setting the requi...
40,253,448
I am using text analysis with Azure ML. So in my python script I want to create a bag of word model and then calculate TFIDF of each words. For that I am using gensim model, It's not working on Azure ML. So is there any options for me?
2016/10/26
[ "https://Stackoverflow.com/questions/40253448", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5915270/" ]
You have to use the ":valid" pseudo-class to accomplish your task. This is a working code for your situation: ``` <!-- CSS --> <style> /* select the #sadFace preceded by a valid input */ input:valid ~ #sadFace { display: none; } </style> <!-- html --> <label for...
$('#pass').keyup(function(){ ``` if($(this).val()!='') $('#show').hide() //or may be with an effect else $('#show').show() ``` });
36,944,929
I made a program and did a `.application` file. Then I kept doing changes to the code in Visual Studio and now I want to go back to the same code that I had but the only thing close to that code is that `.application` program.
2016/04/29
[ "https://Stackoverflow.com/questions/36944929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5835345/" ]
Use version control so you do not find yourself in this situation in the future Since you are in this situation, JetBrains dotPeek is a free software that will decompile .NET assemblies, <http://jetbrains.com/decompiler>
An `.application` file is a text (xml) file. It loads the `.exe` file from an external location into something of a cache. I use task manager -> process -> properties to identify the physical `.exe` location and use my preferred decompiler on that.