qid
int64
10
74.7M
question
stringlengths
15
26.2k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
27
28.1k
response_k
stringlengths
23
26.8k
1,481,124
I setup catching hotkey on alt+printscreen. It catches perfectly but there is nothing in the buffer - no image. How can I get the image from Clipboard.GetImage() after catching hotkey? Here is the the code. ``` using System; using System.Runtime.InteropServices; using System.Collections.Generic; using System.Componen...
2009/09/26
[ "https://Stackoverflow.com/questions/1481124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/276640/" ]
Make sure the XML that you download from last.fm is gzipped. You'd probably have to include the correct HTTP header to tell the server you support gzip. It would speed up the download but eat more server resources with the ungzipping part. Also consider using asynchronous downloads to free server resources. It won't n...
I think there's a limit of 1 API call per second. I'm not sure this policy is being enforced through code, but it might have something to do with it. You can ask the Last.fm staff on IRC at [irc.last.fm](http://irc://irc.last.fm) #audioscrobbler if you believe this to be the case.
42,730,632
I tried to update ng-model value as result of $http.get call but it's not updated. Here is my code. **main.js** ``` angular.module('app', []) .controller('mainCtrl', ['$http', function($http) { var main = this; main.show = true; $http({ method: 'GET', url: 'api url' }) .then(fu...
2017/03/11
[ "https://Stackoverflow.com/questions/42730632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7129790/" ]
The way you are making your http calls are wrong. First in the controller: ``` .controller('mainCtrl', ['$http', function($http) ... ``` In the controller first http should be passed as string: `'$http'`. Asynchronous calls are made in the following way: ``` var promise = $http({ method : 'POST', ...
Set main.show initial value to false ``` main.show =false; ``` Also define the ng-app value in HTML tag
26,154,497
I am making a comma separated "tag" type system, and I want the tags to scroll left to right, then go to the next line if the next tag would cause that line to be wider than the max width of the container. I get different results if I use `<span>` or `<div>` ``` <span class="tag"><span class="tagspan" ></span></span...
2014/10/02
[ "https://Stackoverflow.com/questions/26154497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1615776/" ]
You can use float:left to your tag elements instead of the container and drop the display:inline-flex attribute which results in a line break if your tags reach the end of the line. Edit: change the outer span elements to divs for that effect. // thanks Gary ;)
This is more related to `CSS` styling than `JavaScript` code, I think I got it working just tweaking two classes in your `CSS` code: ``` span { vertical-align:middle; display: inline-flex; word-break: keep-all; } #container { text-align: left; display: block; min-width:400px; max-width:400px; height:10...
5,684,811
in a div, have elements (not necessarily 2nd generation) with attribute `move_id`. First, would like most direct way of fetching first and last elements of set tried getting first and last via: ``` var first = div.querySelector('[move_id]:first'); var last = div.querySelector('[move_id]:last'); ``` this bombs bec...
2011/04/16
[ "https://Stackoverflow.com/questions/5684811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/662063/" ]
`:last` is not part of the css spec, this is jQuery specific. you should be looking for [`last-child`](https://www.w3.org/TR/selectors-3/#last-child-pseudo) ``` var first = div.querySelector('[move_id]:first-child'); var last = div.querySelector('[move_id]:last-child'); ```
You can get the first and last element directly. ```js //-- first element console.log( document.querySelector("#my-div").querySelectorAll( "p" )[0] ); //-- last element console.log( document.querySelector("#my-div").querySelectorAll( "p" )[document.querySelector("#my-div").querySelectorAll( "p" ).length-1] ); ``` ```...
35,129,038
For syntax highlighting of Python in Python, I'm using the "keywords" module to get a list of the keywords (for, in, raise etc.). But how can I get a list of essential built-in functions? I.E. the ones listed here: <https://docs.python.org/2/library/functions.html> (I want to do it programmatically of course, in case...
2016/02/01
[ "https://Stackoverflow.com/questions/35129038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/423420/" ]
`dir(builtins)` is not enough, simply because [`builtins`](https://docs.python.org/3/library/builtins.html) module also exposes exceptions and warnings, as well as `False`, `True`, `None` and lots of other constants and "internal" functions. You could test the type of the object ``` import builtins # __builtin__ in P...
You can get a list of the builtins functions in python typing the following: ``` print dir(__builtins__) ```
7,531,172
I'm starting a project and i've decided to use Django. My question is regarding to the creation of the database. I've read the tutorial and some books and those always start creating the models, and then synchronizing the DataBase. I've to say, that's a little weird for me. I've always started with the DB, defining th...
2011/09/23
[ "https://Stackoverflow.com/questions/7531172", "https://Stackoverflow.com", "https://Stackoverflow.com/users/198212/" ]
Triggers, views, and stored procedures aren't really a part of the Django world. It can be made to use them, but it's painful and unnecessary. Django's developers take the view that business logic belongs in Python, not in your database. As for indexes, you can create them along with your models (with things like `db_...
Mostly we don't write SQL (e.g. create index, create tables, etc...) for our models, and instead rely on Django to generate it for us. It is absolutely okay to start with designing your app from the model layer, as you can rely on Django to generate the correct database sql needed for you. However, Django does provi...
48,269,248
I want to use XGBoost for online production purposes (Python 2.7 XGBoost API). In order to be able to do that I want to control and **limit the number of threads used by XGBoost** at the *predict* operation. I'm using the *sklearn* compatible regressor offered by XGBoost (xgboost.XGBRegressor), and been trying to use ...
2018/01/15
[ "https://Stackoverflow.com/questions/48269248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5524815/" ]
Answer: Standard set\_params with nthread fails, but when using `regr._Booster.set_param('nthread', 1)` I was able to limit XGBoost to using a single thread. As mentioned above the env variable `OMP_NUM_THREADS=1` works as well.
Currently `n_jobs` can be used to limit threads at predict time: `model._Booster.set_param('n_jobs', 2)` *More info* Formerly (but now deprecated): `model._Booster.set_param('nthread', 2)`
1,548,446
How can I know if a TIFF image is in the format CCITT T.6(Group 4)?
2009/10/10
[ "https://Stackoverflow.com/questions/1548446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can use this (C#) code example. It returns a value indicating the compression type: 1: no compression 2: CCITT Group 3 3: Facsimile-compatible CCITT Group 3 4: CCITT Group 4 (T.6) 5: LZW ``` public static int GetCompressionType(Image image) { int compressionTagIndex = Array.IndexOf(image.Property...
You can run `identify -verbose` from the [ImageMagick](http://en.wikipedia.org/wiki/ImageMagick) suite on the image. Look for "Compression: Group4" in the output.
5,369,632
Right now in my game I'm drawing true type fonts like this: ``` for(int i = linesSkipped; i <= maxitems + linesSkipped; ++i) { if(i >= (int)textRows.size()) { break; } paintargs.graphics()->drawText(AguiPoint(textX - 2, textY - 2 + (i * getFont().getLineHeigh...
2011/03/20
[ "https://Stackoverflow.com/questions/5369632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/146780/" ]
Which API are you using? Is that GDI+? You can draw the outlines at more locations before drawing the inside: ``` (x-2, y-2) (x, y-2) (x+2,y-2) (x-2, y ) (x+2,y ) (x-2, y+2) (x, y+2) (x+2,y+2) ``` Or you can see if your graphics API has something like paths. With paths, you tell the graphics library you ...
You need to draw the text in all corners! What you're doing is drawing in the top-left corner and in the bottom-right corner, which is respectively `X=-2, Y=-2` and `X=2, Y=2`. What you need to do, is to draw them in the bottom-left and the top-right corner too, which would be respectively `X=-2, Y=2` and `X=2, Y=-2`.
42,925,288
I have this **real code** to show and hide two divs depending on device type: **Problem**: in Android the #div-desktop is shown. * I need to show only div#div-mobile on mobile devices * I need to show only div#div-desktop on desktop devices CSS ``` @media screen and (min-width: 0px) and (max-width: 700px) {...
2017/03/21
[ "https://Stackoverflow.com/questions/42925288", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1121218/" ]
**EDIT** After seeing your site, you need to add: ``` <meta name="viewport" content="width=device-width, initial-scale=1"> ``` --- You can just use `min-width` Also, don't use `width/height` html tags in `img` use CSS instead --- ```css img { max-width: 100% } #div-desktop { display: none; } @media s...
this line only find the size resolution of the user system and gives to your css code `<meta name="viewport" content="width=device-width, initial-scale=1.0">`
11,687,038
I want to add a static function to a class in EcmaScript 5 JavaScript. My class definition looks as follows: ``` var Account = {}; Object.defineProperty(Account, 'id', { value : null }); ``` And I would create a new instance like this: ``` var theAccount = Object.create(Account); theAccount.id = 123456; ``` ...
2012/07/27
[ "https://Stackoverflow.com/questions/11687038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1557495/" ]
For ES 5 if you want static methods: ``` // A static method; this method only // exists on the class and doesn't exist // on child objects Person.sayName = function() { alert("I am a Person object ;)"); }; // An instance method; // All Person objects will have this method Person.prototype.setName = function(...
You seem to have some different things mixed up. The prototype is going to be shared fallback properties. If you want to define a static (I assume by what you're doing you mean non-writable property?) you can use defineProperty in the constructor. ``` function Account(){ Object.defineProperty(this, 'id', { value...
17,848
Is there any way I, as a **viewer**, can change the aspect ratio of a video where the uploader got it wrong? It's driving me mad! Can't believe YouTube doesn't have anything for me to fix this... Does it? --- **Edit:** is there perhaps a program for viewing YouTube videos outside of the browser that has the feature? ...
2010/01/14
[ "https://webapps.stackexchange.com/questions/17848", "https://webapps.stackexchange.com", "https://webapps.stackexchange.com/users/12388/" ]
At long last, [YouTube Center](https://addons.mozilla.org/en-us/firefox/addon/youtube-center/), a Firefox addon, enables me to do this! ![enter image description here](https://i.stack.imgur.com/cEvNW.png)
this issue is SOLVED. Just add a code to your video youtube tags in order to choose the ratio aspect. Please check out [this video](http://www.youtube.com/watch?v=MFPcAIM8fB0) to find some examples:
5,124,441
I have a `div` (`div1`) that has its position, width, height, everything all set, and it is set externally, so I can't know ahead of time what those values are. Inside and at the top of `div1` is another `div` (`div2`). I want `div2` to float on the right of `div1` without affecting the following information in `div1`...
2011/02/26
[ "https://Stackoverflow.com/questions/5124441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/562697/" ]
If I understand correctly: First, apply `position: relative` to your `div1`. As it "won't work" when you have both `float: right` and `position: absolute` on your `div2`, you should replace the `float: right` rule with `right: 0`.
with just relative positioning? ``` <div style="height:300px;width:300px;position:relative;background-color:red"> <div style="height:100px;width:100px;position:relative;float:right;background-color:yellow"> </div> ```
27,920,669
I am surprised that the following code when input into the Chrome js console: ``` {} instanceof Object ``` results in this error message: > > Uncaught SyntaxError: Unexpected token instanceof > > > Can anyone please tell me why that is and how to fix it?
2015/01/13
[ "https://Stackoverflow.com/questions/27920669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/536299/" ]
`{}`, in that context, is a *block*, not an object literal. You need change the context (e.g. by wrapping it in `(` and `)`) to make it an object literal. ``` ({}) instanceof Object; ```
If you try this: ``` var a = {} a instanceof Object ``` outputs `true`, which is the expected output. However, in your case ``` {} instanceof Object ``` The above doesn't outputs true. The latter **isn't** the same as the first one. In the first case, we create an object literal, while in the second case we do...
201,743
I am currently learning about TDD and trying to put it into practice in my personal projects. I have also used version control extensively on many of these projects. I am interested in the interplay of these two tools in a typical work flow, especially when it comes to the maxim to keep commits small. Here are some exa...
2013/06/16
[ "https://softwareengineering.stackexchange.com/questions/201743", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/61509/" ]
It is my understanding of the world that one commits to mark a point that it may be desirable to return to. The point a which a test fails (but compiles) is definitely one such point. If I were to wander off in the wrong direction trying to make a test pass, I would want to be able to revert the code back to the starti...
For *code reviews*, especially regarding bug fixes, I like to see that a test failed before the fix was implemented. So I'd actually encourage to commit and push **your** branch so that I can be assured that: 1. the test actually failed 2. the problem is actually fixed with the next commit If both happens in only one...
9,484,571
I have this code so far: ``` private class DownloadWebPageTask extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... theParams) { String myUrl = theParams[0]; String myEmail = theParams[1]; String myPassword = thePara...
2012/02/28
[ "https://Stackoverflow.com/questions/9484571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/731255/" ]
You might want to switch to [`HttpURLConnection`](http://developer.android.com/reference/java/net/HttpURLConnection.html). According to [this article](http://android-developers.blogspot.com/2011/09/androids-http-clients.html) its API is simpler than `HttpClient`'s and it's better supported on Android. If you do choose ...
The version of Apache's `HttpClient` shipped with Android is [based on an old, pre-BETA version of `HttpClient`](https://hc.apache.org/httpcomponents-client-4.3.x/android-port.html). Google has [long recommended against using it](http://android-developers.blogspot.se/2011/09/androids-http-clients.html) and [removed it ...
23,757,820
``` function changeBGG1() { var a = $('#vbox').css("backgroundColor"); if (a == "#800000") { $('#vbox').css("webkitAnimation", 'Red2Green 2s'); $('#vbox').css("backgroundColor", '#004C00'); } } ``` i know that there is an error in the condition check, but i dnt know how to avoid it a...
2014/05/20
[ "https://Stackoverflow.com/questions/23757820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3648908/" ]
In CSS, background colours are generally returned in `rgb(...)` format, *but not always*. If there's transparency involved, it'll be `rgba(...)` format. Some browsers (especially older ones) will use `#RRGGBB` format. Long story short, you *cannot* rely on the value of `backgroundColor` for any kind of comparison. Us...
Try this :) ``` $.fn.getHexBackgroundColor = function() { var rgb = $(this).css('background-color'); rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); function hex(x) {return ("0" + parseInt(x).toString(16)).slice(-2);} return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]); } function changeBGG1() {...
38,104,600
I was wondering if it is possible to change the position of a column in a dataframe, actually to change the schema? Precisely if I have got a dataframe like `[field1, field2, field3]`, and I would like to get `[field1, field3, field2]`. I can't put any piece of code. Let us imagine we're working with a dataframe wit...
2016/06/29
[ "https://Stackoverflow.com/questions/38104600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6529357/" ]
The [spark-daria](https://github.com/mrpowers/spark-daria) library has a `reorderColumns` method that makes it easy to reorder the columns in a DataFrame. ``` import com.github.mrpowers.spark.daria.sql.DataFrameExt._ val actualDF = sourceDF.reorderColumns( Seq("field1", "field3", "field2") ) ``` The `reorderColum...
**Spark Scala Example:** Let's assume a you have a dataframe `demo_df` and it has following column set: `id, salary, country, city, firstname, lastname` and you want to rearrange its sequence. **demo\_df** [![demo_df_screenshot](https://i.stack.imgur.com/YMgHh.png)](https://i.stack.imgur.com/YMgHh.png) Sele...
47,049,524
I was told to use proxy pattern in my program which is not that clear to me. I have some issues with `Proxy &operator*()` , I don't know what should I return there to get a value of current index in file. I had this before and it worked: ``` int &operator*() { return ptr->getValue(index); } ``` But I was told...
2017/11/01
[ "https://Stackoverflow.com/questions/47049524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8866446/" ]
Returning a proxy requires of you to return a proxy **object**. You attempt to return a reference to such an object, but it doesn't exit. And we cannot bind a proxy reference to an integer. The fix is simple, just return a new object by value: ``` Proxy operator*() { return Proxy(ptr); } ```
Try this ``` Proxy &operator*() { // How to do that? return *this; } ``` It avoid you to create another new Proxy
7,715,760
I've bound a command to a button on a Ribbon control. The CanExecute method on the button gets called as expected but clicking on the button doesn't cause the Execute method to be called. The `CanExecute` sets the `CanExecute` property to `true` - the button in question is enabled and clickable. Has anyone else seen t...
2011/10/10
[ "https://Stackoverflow.com/questions/7715760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/280780/" ]
This usually happens if the parameters dont match in type correctly... are you binding `CommandParameter` of one type and accepting a different type parameter in the Command.Execute() call?
Fixed this by wrapping the `RoutedCommands` in a [`RelayCommand`](http://msdn.microsoft.com/en-us/magazine/dd419663.aspx#id0090051). I have no idea why that worked, but assuming there's a problem in the other team's assembly.
24,573,548
i need to run new-installed program from command prompt on windows 7 like it is posibble for notepad calc or some other windows-basic program... How i can do that? I tryed to use enviroment variables but i fell in stuck with it. Is there a way for something like this ?
2014/07/04
[ "https://Stackoverflow.com/questions/24573548", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3097635/" ]
try like this command start c:\"Program Files"\VideoLAN\VLC\vlc.exe or you can use "c:\Program Files\VideoLAN\VLC\vlc.exe" quote must need for the the file/folder name which is having space
So according to the comments to your question, you now managed to start your program from whereever you are by including it's path to the %path% variable. Your new error "Unable to run package setup. Failed to load module. ImportErorr: No module named Package setup" comes from your program, which fails to load some of...
2,010,895
I am trying to get the jquery getJSON function to work. The following seems very simple yet it doesn't work. ``` $("#edit-item-btn").live('click', function() { var name = this.id; $.getJSON("InfoRetrieve", { theName : name }, function(data) { alert(name); }); }); ```
2010/01/06
[ "https://Stackoverflow.com/questions/2010895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/69803/" ]
Shouldn't you be doing alert(data)?
Have you tried using Firebug or Chrome Developer Tools to see what requests are being made? Does a file called `InfoRetrieve` exist in the current path of your site? What does it return?
6,601,042
I have 3 text inputs for a phone number - phone\_ac, phone\_ex, phone\_nm - i.e. 999 555 1212 I can use jquery to validate each individually and give 3 error messages: ``` "Phone number (area code) is required." "Phone number (exchange) is required." "Phone number (last 4 digits) is required." ``` Is there a way to...
2011/07/06
[ "https://Stackoverflow.com/questions/6601042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/618157/" ]
This should do the job. You didn't really link to cURL before. ``` build: $(SOURCES) $(CXX) -o $(OUT) $(INCLUDE) $(CFLAGS) $(LDFLAGS) $(LDLIBS) $(SOURCES) ``` Notice the *added* `$(LDLIBS)`. Oh, I should add that basically what happens is that you throw overboard the built-in rules of GNU make (see output of `m...
You are missing slashes at the start of the paths below ``` -I/usr/local/include -L/usr/local/lib ```
103,089
Can a Trojan horse hide its activity from [TCPView](https://technet.microsoft.com/en-us/library/bb897437.aspx)? I've done a little research before asking, but I still can't find the answer for this. I know that a Trojan horse can hide from the Windows [Task Manager](http://en.wikipedia.org/wiki/Windows_Task_Manager) ...
2015/10/19
[ "https://security.stackexchange.com/questions/103089", "https://security.stackexchange.com", "https://security.stackexchange.com/users/89602/" ]
It's absolutely possible that someone is developing malware which is capable of hiding packets from sniffers. As most sniffers on Windows systems depend on `WinPCAP` as a capture driver, it would for example be possible to manipulate the drivers to hide specific packets that are traveling the wire. This is why I use ...
Anything can be manipulated in Windows with skilled reverse engineering. An generic [RAT](https://en.wikipedia.org/wiki/Remote_administration_software) hiding TCP from Wireshark is extremely unlikely, but it's possible. Don't just rely on your antivirus software (AV) as they are very unreliable and don't have very good...
1,699,451
I am using `SHA1` so i want to convert the output of this `SHA1` to integer
2009/11/09
[ "https://Stackoverflow.com/questions/1699451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/206672/" ]
This question is hard to answer without the full context, but i'll give it a try. What i've been forced to do a few times is this: 1. Check out a fresh copy Backup my WC 2. Delete all .svn directories in my WC 3. Overwrite the fresh copy in (1) with my WC files. 4. Commit Other techniques are (after making a backup ...
FWIW, I wound up using this: ``` find . -name ".svn" -type d -exec rm -rf {} \; ``` to remove all the .svn files and re-importing. I wasn't losing any history, really, so that seemed easiest.... Several of the other answers here seem viable, as well.
9,210,187
i get the following error when trying to run my spring 3.1.0 MVC app via Tomcat 7: > > The matching wildcard is strict, but no declaration can be found for > element 'mvc:annotation-driven'. > > > Here is my mvc-config.xml ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/s...
2012/02/09
[ "https://Stackoverflow.com/questions/9210187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/444668/" ]
You need this in your schema location: ``` http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd ```
@jonney The missing library is spring-webmvc. Maven dependency : org.springframework spring-webmvc ${spring.version}
13,632
My German teacher told me that the email I sent her contained a threat. What I wrote was "Allerdings komme ich morgen." She didn't tell me why, just asked me to research about this, but I can't find anything on the Internet. Can someone please explain why she felt threatened? Here's the whole exchange: > > First ema...
2014/06/24
[ "https://german.stackexchange.com/questions/13632", "https://german.stackexchange.com", "https://german.stackexchange.com/users/8701/" ]
It depends on the context. If you wrote > > Ich kann heute leider nicht kommen. Allerdings komme ich morgen. > > > then there is absolutely no threat. You say that you can't come today, however you'll come tomorrow. On the other hand, in > > Ob ich morgen komme? Allerdings komme ich morgen. > > > it means "...
"Allerdings" means "Indeed" and is an affirmation. ("Das ist Dir wohl wichtig." -- "Allerdings ist mit das wichtig!") It depends on the context if you see it as a threat, but I usually would not.
13,306,670
I am using Bootstrap from twitter. What I want is to make a prepended text, and input field and a button, but I want my input field have the max available width so that the right edge of the submit button was near the right edge of the well. From the bootstrap documentation there is the **.input-block-level** class tha...
2012/11/09
[ "https://Stackoverflow.com/questions/13306670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1811899/" ]
I was looking for something similar and this solution from <https://gist.github.com/mattjorn/5020957> worked for me - add `.input-block-level` to your outer div, e.g., `<div class="input-prepend input-append input-block-level">` and then extend the bootstrap CSS like this: ``` .input-prepend.input-block-level { d...
may be use for `div class="input-prepend input-append"` additional style `margin-right` result for your code: ``` <div class="well"> <div class="input-prepend input-append" style="margin-right: 108px;"> <span class="add-on">Some text</span> <input class="input-block-level" type="text" name="xxx" v...
20,981,075
How can I write a query to find all records in a table that have a null/empty field? I tried tried the query below, but it doesn't return anything. ``` SELECT * FROM book WHERE author = 'null'; ```
2014/01/07
[ "https://Stackoverflow.com/questions/20981075", "https://Stackoverflow.com", "https://Stackoverflow.com/users/892302/" ]
As far as I know you cannot do this with `NULL`. As an alternative, you could use a different empty value, for example the empty string: `''` In that case you could select all books with an empty author like this (assuming the author column is appropriately indexed): ``` SELECT * FROM book WHERE author = ''; ```
If **your\_column\_name** in **your\_table** is a text data type then following should work, ``` SELECT * FROM your_table WHERE your_column_name >= '' ALLOW FILTERING; ```
7,397,078
I have to display a set of data in the following manner: ![Data Listing](https://i.stack.imgur.com/iYRvH.png) Which ASP.NET 3.5 control best matches my requirement? If one matches, could you please give me an idea about how to format it to view like the image?
2011/09/13
[ "https://Stackoverflow.com/questions/7397078", "https://Stackoverflow.com", "https://Stackoverflow.com/users/441343/" ]
This is official documentation of libpq. <http://www.postgresql.org/docs/8.1/static/libpq.html>
You can try third-party C++ libraries for database connectivity like [SOCI](http://soci.sourceforge.net/)
57,300,501
I have a couple of Specflow's features file which contain multiple scenarios and I want to execute them against multiple environments (DEV, TEST, and SIT). So, my question here is - what is the best way to pass environment specific data from feature file to step definition. As you can see in the example below employee...
2019/08/01
[ "https://Stackoverflow.com/questions/57300501", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2524202/" ]
If you can't create on demand each time, here is another way. Create a data.cs file. ``` public class EnvData { public EnvData() { { defaultEmail = "test@gmail.com"; defaultPassword = "MyPass123"; } if(ConfigurationManager.AppSettings["Env"] == "Test") ...
Since you are already passing the environment in the step, I would personally pass that value to a database object constructor that switches the connection string from your app.config based on the constructor input. Example using Entity Framework: ``` public void WhenSearchEmployee (string EmployeeName, string Employ...
194,184
I'd like to know how to emulate the ICANON behavior of ^D: namely, trigger an immediate, even zero-byte, read in the program on the other end of a FIFO or PTY or socket or somesuch. In particular, I have a program whose specification is that it reads a script on stdin up until it gets a zero byte read, then reads input...
2015/04/03
[ "https://unix.stackexchange.com/questions/194184", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/109074/" ]
As far as I know, systemd won't deal with this particularly well. As I understand it, you want to override the behavior of `sshd.service`, right? Luckily for you, systemd is designed for this kind of thing. Simply put your service definition in `/etc/systemd/system/ssh.service`, execute `systemctl daemon-reload` to re...
Others have answered this question, however no one pointed out that you cannot create symbolic links to units that live in a user's home directory. They must live outside of it. Even if its owned by root, configured for 644 permissions, it will not work. Must be outside of /home. @evandrix pointed out that you can use...
119,914
I prepare myself for ielts speaking test on these days and my topic is "what do you think about friendship?". In this case, I'm talking about people that I met in summer in different country. > > It wasn't important where they are from > > > It wasn't important where are they from. > > > Can you tell me which ...
2017/02/19
[ "https://ell.stackexchange.com/questions/119914", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/49463/" ]
> > It was not important where they **were** from. > > > Since you are not **asking** about their homeland or the city they live in, you need to use the assertive form. (In interrogative form, the question would end with question mark "?", so you have to use the first one.) Also, since you used the past "was" yo...
I'm going to nitpick a bit. You should use "where they are from," as this is perfectly normal in speech. But technically, it is incorrect to end a sentence with a preposition like "from." A strictly correct usage would be something like, "it doesn't mater from which country they come," although so few people use this r...
4,288,367
Hy, I am currently trying to make a first person game.what i was able to do was to make the camera move using the function gluLookAt(), and to rotate it using glRotatef().What I am trying to to is to rotate the camera and then move forward on the direction i have rotated on, but the axes stay the same,and although i ha...
2010/11/26
[ "https://Stackoverflow.com/questions/4288367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/521765/" ]
This requires a bit of vector math... Given these functions, the operation is pretty simple though: ``` vec rotx(vec v, double a) { return vec(v.x, v.y*cos(a) - v.z*sin(a), v.y*sin(a) + v.z*cos(a)); } vec roty(vec v, double a) { return vec(v.x*cos(a) + v.z*sin(a), v.y, -v.x*sin(a) + v.z*cos(a)); } vec rotz(...
`gluLookAt` is defined as follows: ``` void gluLookAt(GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY, GLdouble upZ ); ``` The camera is located at the `eye` position and looking in the direction...
32,664,939
This code is to print the series of prime number up to given limit but when I am trying to execute this,it goes into infinite loop. ``` import java.io.*; class a { public static void main(String s[]) throws IOException { int count=1; String st; System.out.println("how many prime no. do ...
2015/09/19
[ "https://Stackoverflow.com/questions/32664939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5352896/" ]
After correction i got the series of prime numbers. ``` import java.io.*; class a { public static void main(String s[]) throws IOException { int count=1,count1=0; String st; System.out.println("how many prime no. do you want"); BufferedReader obj= new BufferedReader (new InputSt...
``` import java.util.*; class Prime { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("enter the no of prime nos want: "); int n2 = sc.nextInt(); int flag = 1 ; int count = 0 ; for (int i =2; i<99999;i++ ) { for (int j=2; j<i;j++ ...
58,909,540
**Specifications:** Laravel Version: 5.4 PHP Version: 7.0.9 Composer version 1.9.0 XAMP **Description:** *In Connection.php line 647:* SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (SQL: create table `users` (`id` int unsigned not null auto\_increment primary key, `name` varc...
2019/11/18
[ "https://Stackoverflow.com/questions/58909540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8100732/" ]
> > Try to add the following condition before **Schema::create()** > > > ``` if (!Schema::hasTable('users')) { Schema::create('users',...) } ```
Check your migration table if the "User" Table is recorded there, delete it and then do a single migration using this artisan command ``` php artisan migrate:refresh --path=/database/migrations/fileName.php ``` Or Do reset the migration using the following and then migrate again ``` php artisan migrate:reset ```
6,486,888
I need help with the following code that requires me to: * Declare 3 `double` type variables, each representing one of three sides of a triangle. * Prompt the user to input a value for the first side, then * Set the user’s input to the variable you created representing the first side of the triangle. * Repeat the last...
2011/06/26
[ "https://Stackoverflow.com/questions/6486888", "https://Stackoverflow.com", "https://Stackoverflow.com/users/816538/" ]
As your professor suggested, you should look at: <http://en.wikipedia.org/wiki/Triangle#Types_of_triangles> You should also look at: <http://www.teacherschoice.com.au/maths_library/trigonometry/solve_trig_sss.htm> Algorithm: ``` Solve for all angles, a1, a2, a3 (see the article above) If you can't find a solution:...
To complete this program you will need the following: Make sure input is valid. In this case, input must be greater than 0. You could catch your input using a loop like ``` while (invar <= 0) { cout<<"Enter length"<<endl; cin>>invar; if (invar <= 0) { cout<<"invalid...
61,822,117
I've tried [this](https://linuxconfig.org/how-to-install-viber-on-ubuntu-20-04-focal-fossa-linux) description. Installation using snap was successfull, but after configuring Viber, the following error message came: ``` Qt: Session management error: None of the authentication protocols specified are supported sh: 1: xd...
2020/05/15
[ "https://Stackoverflow.com/questions/61822117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3576961/" ]
The location of the libssl package was not correct. Visit the <http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/> site, and download one of the libssl file. At the moment I visited, there was a **libssl1.0.0\_1.0.2n-1ubuntu5.3\_amd64.deb** file, I've downloaded. And after it: ``` sudo dpkg -i libssl1.0.0_1.0....
To fix the Snap, you need to allow it permission to use the audio systems. There is a command line way to do it (snap connections) but I used the Software app, found the Viber snap and clicked "Permissions".
35,997,541
I'm using Hibernate 5.1.0.Final with ehcache and Spring 3.2.11.RELEASE. I have the following `@Cacheable` annotation set up in one of my `DAO`s: ``` @Override @Cacheable(value = "main") public Item findItemById(String id) { return entityManager.find(Item.class, id); } ``` The item being returned has a number of ...
2016/03/14
[ "https://Stackoverflow.com/questions/35997541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1235929/" ]
Take a look at a [similar question](https://stackoverflow.com/questions/34763402/proper-cache-usage-in-spring-hibernate). Basically, your cache is not a Hibernate second-level cache. You are accessing a lazy uninitialized association on a detached entity instance, so a `LazyInitializationException` is expected to be th...
I used simple type cache with this config as below: ``` spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true spring.jpa.open-in-view=true spring.cache.type=simple ```
20,542,369
I am building a news website where one of the views is a webview of articles. I had installed `push woosh` but when i send out notifications with URLs in them tapping the URL opens the web page in the native browser, is there any way i can set it so that the pages open in the webview in the app?
2013/12/12
[ "https://Stackoverflow.com/questions/20542369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2016026/" ]
Here is what I did to test my code using Mockito and Apache HttpBuilder: **Class under test:** ``` import java.io.BufferedReader; import java.io.IOException; import javax.ws.rs.core.Response.Status; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods....
In your unit test class you need to mock `defaultHttpClient`: ``` @Mock private HttpClient defaultHttpClient; ``` Then you tell mockito (for example in `@Before` method) to actually create your mocks by: ``` MockitoAnnotations.initMocks(YourTestClass); ``` Then in your test method you define what `execute()` meth...
37,520,248
Can I access [Cloud Foundry REST API](https://apidocs.cloudfoundry.org/237/) on Bluemix? If yes, how can I access it (cannot find any documentation)?
2016/05/30
[ "https://Stackoverflow.com/questions/37520248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4890411/" ]
You can access the Cloud Foundry REST API on Bluemix as you would normally do with CF. In addition to that, if you need it and you are already familiar with *cf curl* you can take a look at the *bluemix curl* command. For example if you want to retrieve the information for all organizations of the current account: ```...
In order to access CF API you have to get the authentication token. Then add it to each request in the headers. ``` oauthTokenResponse = requests.post( f'https://login.ng.bluemix.net/UAALoginServerWAR/oauth/token?grant_type=password&client_id=cf', data={'username': <your username>, 'password': <your password>, 'cl...
51,797,719
I started hazelcast server using ``` java -jar hazelcast-3.10.1/lib/hazelcast-3.10.1.jar ``` which started server on ``` Members {size:1, ver:1} [ Member [127.0.0.1]:5701 - f7cf5a82-c89c-4341-8e72-0f446df422ad this ] ``` after that I started mancenter as below ``` java -jar hazelcast-management-center...
2018/08/11
[ "https://Stackoverflow.com/questions/51797719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9766007/" ]
You can't, the connection is initiated from the Hazelcast Server to the Hazelcast Management Center, so the server has to have the management server URL enabled when it starts. See <http://docs.hazelcast.org/docs/management-center/3.10.2/manual/html/index.html#change-url>
As Neil said, the cluster members initiate the connection back to the Management Center and the Management Center URL needs to be set in the members before they start. Reasons for this design are both performance and security related. If you really need to have the Man Center url dynamic though, you can usually achiev...
11,323,617
Today I found an article where a `const` field is called *compile-time constant* while a `readonly` field is called *runtime constant*. The two phrases come from 《Effective C#》. I searched in MSDN and the language spec, find nothing about *runtime constant*. No offensive but I don't think *runtime constant* is a prope...
2012/07/04
[ "https://Stackoverflow.com/questions/11323617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/323924/" ]
I believe that author means the following: Consider example: ``` public class A { public const int a = Compute(); private static int Compute(){ /*some computation and return*/ return some_computed_value; } } ``` this, **will not** compile, as you have to have consta...
A readonly variable can only be changed in its constructor and can be used on complex objects. A constant variable cannot be changed at runtime, but can only be used on simple types like Int, Double, String. Runtime constant is somewhat accurate, but confuses the issue, there are very explicit differences between a con...
296,020
Mac OS X has the `Darwin 10.6.0` Kernel, and Ubuntu has the `Linux 2.6` Kernel, so in Windows what is it called?
2011/06/12
[ "https://superuser.com/questions/296020", "https://superuser.com", "https://superuser.com/users/70695/" ]
Well, it tends to be Microsoft Windows Version [6.1.7601] for windows 7 - the main change should be the numbers which are MajorVersion.MinorVersion.Build. Vista was 6.0.xxxx, and XP was 5.1.2600 for SP3. You can find this with the 'ver' command
Windows: * Windows 7 - Click Start or the Windows logo -> right click Computer -> then click Properties. Look in System. * Windows Vista and Windows Server 2008 - Click Start or the Windows logo depending on what you have -> then click Control Panel -> System and Maintenance -> System. You could also try Clicking Star...
189,430
I am learning python and want to improve my skills in it. So could someone advice of how to improve the code below (this is a simple programming problem taken from one of the web sites). I feel like my code is not really Pythonic. **Problem:** Using the Python language, have the function `LetterChanges(str)` take the ...
2018/03/12
[ "https://codereview.stackexchange.com/questions/189430", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/163005/" ]
Instead of having those `if`s you could use a translation table to speed things up (see [`str.maketrans`](https://docs.python.org/3/library/stdtypes.html#str.maketrans) and [`str.translate`](https://docs.python.org/3/library/stdtypes.html#str.translate)). ``` import string def _build_translation_table(): ascii_vo...
Here are some improvements that I'd make (supposing that your code is using Python 2.x): * I'd indent the code so that it'll be a multiple of four * There's no reason to make the vowels a `Set()`. A string should work just fine as strings are iterable in python * rename the `str` argument to something else as that's a...
63,833,194
I'm trying to find all of the top players "arena pts" (the in game competative point system) from this website: `https://www.epicgames.com/fortnite/competitive/en-US/hype-leaderboard?sessionInvalidated=true` I'm using requests to get the information and bs4 to sort through it, but I'm having trouble using bs4. Here's ...
2020/09/10
[ "https://Stackoverflow.com/questions/63833194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13905088/" ]
You wont able to do it using requests lib, because the page is asking api for those stats, which can be found in browser console "network" tab ``` import requests from bs4 import BeautifulSoup page = requests.get('https://www.epicgames.com/fortnite/competitive/en-US/hype-leaderboard?sessionInvalidated=true') soup = Be...
This is a problem that would require using selenium, since the table is loaded dynamically with Javascript. Bs4 can only work, and would work in your case, if the data were already loaded. What is happening is that when requests gets the page, there are indeed no td.asdt-points elements. you can see that by using: ```...
27,582,145
``` #include<stdio.h> int main(void) { int x = 3; float y = 3.0; if (x == y) printf("x and y are equal\n"); else printf("x and y are not equal\n"); return 0; } ``` As per the mathematics, both are equal! How does the compiler recognize both are equal? **(I am totally new to ...
2014/12/20
[ "https://Stackoverflow.com/questions/27582145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4344438/" ]
int x=3 ; The above variable x is stored as normal binary format i.e. 0000 0011, because of int float y=3.0 ; the above variable y is stored in IEEE 754 floating point format. i.e the value y is stored in a memory location with three different groups with sign bit, exponent and mantissa here compiler will generate a...
The compiler will convert one of the two variables to the other type, let's say y to int, now both are of same type and can be compare. The next step is an internal subtraction of both value and a test for the ZERO flag. If both values are equal, the subtraction result will 0 which causes the ZERO flag to be set.
3,995,492
I have no clue how to do this, I manage to get I get that $11^{36} \equiv 1 \hspace{0.1cm} \text{mod} (13)$ but I can't get anywhere from there.
2021/01/22
[ "https://math.stackexchange.com/questions/3995492", "https://math.stackexchange.com", "https://math.stackexchange.com/users/841487/" ]
If $11^{36}=1$ in $\Bbb Z/13$, then $11^{35}=11^{-1}$. But since $6\cdot 11=66=1$ in $\Bbb Z/13$, we have $11^{-1}=6$. Here I just write $a=b$ in the ring $\Bbb Z/n$ for $a\equiv b\bmod n$, so that we see it a bit easier. For $n=13$, $\Bbb Z/n$ is a field and all nonzero elements have an inverse.
What were your efforts ? However, if you proved that $11^{36} \equiv 1 \hspace{0.1cm} (13)$ then you have that $11^{35}\cdot 11 \equiv 1 \hspace{0.1cm}(13)$. In this line it is written that $11^{35}$ is the inverse of $11$ by definition, by uniqueness you only have to prove that $6$ does the same job, i.e $6 \cdot 11 \...
404,301
In a Debian server, and after intallation and removal of SquirrelMail (with some downgrade and upgrade of php5, mysql...) the MySQL extension of PHP has stopped working. I have php5-mysql installed, and when I try to connect to a database through php-cli, i connect successfully, but when I try to connect from a web se...
2012/07/03
[ "https://serverfault.com/questions/404301", "https://serverfault.com", "https://serverfault.com/users/126927/" ]
This probably isn't a configuration issue. I'm not familiar with how things are done in Debian (regarding upgrading/downgrading PHP) but it seems the PHP used by Apache and the PHP CLI are in fact using different PHPs. You can verify this by doing a `phpinfo()` from browser and a `php -i` on the commandline. If Apache...
Assuming that webserver PHP is running as mod\_php, the 2 most likely causes are: 1) the permissions on the php.ini file or the .so file do not allow the webserver uid access to the file(s) 2) the webserver is running chroot You can easily test this from PHP using 'is\_readable' and, in the case of php.ini use file\...
19,587,945
I'm having some trouble understanding how OOP, Abstract Classes and lists. My current project is in Processing - Just for prototyping of course. My problem is that I've a list of objects with some of the same variables. So I created an abstract class for them and then a list of all the objects (Abstract class as list)...
2013/10/25
[ "https://Stackoverflow.com/questions/19587945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2919214/" ]
How would you expect the compiler to know that it *is* a `Truck`? You've declared a list of vehicles. Imagine if you were using `list.get(0)` instead of `list.get(3)` - then the value would be a reference to a `Motorcycle`, not a `Truck`. You can fix this by casting: ``` ((Truck) vehicles.get(3)).dropLastTrailer(); ...
Dumb fix: cast ``` ((Truck)vehicles.get(3)).dropLastTrailer(); ``` but that's kind of dangerous. How do you know whether that element in a list is indeed a truck? Better: ``` Vehicle v = vehicles.get(3); if (v instanceof Truck) { // then we can safely cast ((Truck)v).dropLastTrailer(); } ```
341,661
What application do the same what [shazam](http://www.shazam.com/music/web/getshazam.html) or [soundhound](http://www.soundhound.com/) does on android? [Shazam](https://en.wikipedia.org/wiki/Shazam_%28service%29) for windows and MacOs, I don't like wine, plus it is commercial. You can verify about 2-5 songs and must p...
2013/09/05
[ "https://askubuntu.com/questions/341661", "https://askubuntu.com", "https://askubuntu.com/users/187795/" ]
OK so it is a little bit of a hack. First go to: 1. [Directly to the flash program on the Midomi site](http://www.midomi.com/objects/midomiLandingVoiceSearch.swf) This will be annoying probably because you cant click on the accept microphone button because adobe is annoying. Using `Tab` you can move around but it st...
Just discovered MusicBrainz Picard, you can just easily install it with `sudo apt-get install picard`. It creates an audio ID of your song and looks it up in a database, did help me a lot.
47,692,263
I need to make a script do a specific action on first loop iteration. ``` for file in /path/to/files/*; do echo "${file}" done ``` I want this output: ``` First run: file1 file2 file3 file4 ... ```
2017/12/07
[ "https://Stackoverflow.com/questions/47692263", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9053600/" ]
A very common arrangement is to change a variable inside the loop. ``` noise='First run: ' for file in /path/to/files/*; do echo "$noise$file" noise='' done ```
You can create an array with the files, then remove and keep the first element from this array, process it separately and then process the remaining elements of the array: ``` # create array with files files=(/path/to/files/*) # get the 1st element of the array first=${files[0]} # remove the 1st element of from arra...
7,596,632
All, Im having the age old problem with character encoding... I have a mySQL DB with a field set to `utf8_unicode_ci`. My PHP page as the header entry `<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />`. When I use a simple form to POST data with Cyrillic characters to the DB, e.g. 'гыдлпоо', the c...
2011/09/29
[ "https://Stackoverflow.com/questions/7596632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/404335/" ]
Try using [mysql\_set\_charset](http://php.net/manual/en/function.mysql-set-charset.php)() function before fetching data from database.
Do this right after mysql\_connect() and mysql\_select\_db(): ``` mysql_query("SET NAMES 'utf8'"); ```
10,904
I am really confused about this and wanted to share/learn. I was talking with one of my Canadian friends with whom I would like to hang out, about a song and I wanted to say: > > "What a good song is this!" (i don't know if it needs to end with "!" > or "?") > > > But something within me said it's not a good us...
2013/10/01
[ "https://ell.stackexchange.com/questions/10904", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/2726/" ]
*Morning* is a common English word, as you know. *Forenoon*, on the other hand, is so rare that I'm not sure many native speakers of English will even **recognize** the word. How rare is it? To find out, I searched [*the Corpus of Contemporary American English (COCA)*](http://corpus.byu.edu/coca/?c=coca&q=33239565) fo...
I am a British, native speaker of English, living in Denmark. I like the word 'forenoon' and sometimes use it, particularly in writing. I do not regard it as archaic, but I may however be influenced in this by Danish, a language I speak every day and fluently. In Danish, we distinguish between 'morgen' (morning) and 'f...
42,657,214
I want to run an existing MEAN Stack Project. The steps I am following are first I am running `npm install` and then `npm run typings -- install` because I can't see any typings folder. But I am getting these errors. ``` npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "typings" "--" "install" npm ERR! ...
2017/03/07
[ "https://Stackoverflow.com/questions/42657214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2243996/" ]
Or you can also use your `Controller` to display such view. By this you'll write your routes more cleaner. Let's say we have an `AdminController` that handles all admin processes and functions. Put your `dashboard.blade.php` inside `views/admin` directory. The route: ``` Route::get('/admin', 'AdminController@index');...
Just keep 'blade' in view file name if you don't plan to use controller, e.g.: ``` resources/views/admin/index.blade.php ```
17,648,551
I need to replace a file on a zip using iOS. I tried many libraries with no results. The only one that kind of did the trick was zipzap (<https://github.com/pixelglow/zipzap>) but this one is no good for me, because what really do is re-zip the file again with the change and besides of this process be to slow for me, a...
2013/07/15
[ "https://Stackoverflow.com/questions/17648551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1792699/" ]
After getting a response from SagePay I have found the following important notes: * You can use Form/Server/Direct integration interchangeably on the same vendor's account, without needing to change settings or register anything * The 4020 error genuinely is an IP restriction error and is not masquerading another erro...
You have to add your IP address into SagePay control panel. Other suggestions: * You can double-check your IP address at www.whatismyip.com and compare which what you added, * Make sure that your address didn't change since you added it (e.g. you have dynamic addressing), * Check if your Apache user is configured to ...
19,159,195
OK, So PHP has a built-in [getopt()](http://php.net/manual/en/function.getopt.php) function which returns information about what program options the user has provided. Only, unless I'm missing something, it's completely borked! From the manual: > > The parsing of options will end at the first non-option found, anythi...
2013/10/03
[ "https://Stackoverflow.com/questions/19159195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/424221/" ]
Starting with PHP 7.1, `getopt` supports an optional by-ref param, `&$optind`, that contains the index where argument parsing stopped. This is useful for mixing flags with positional arguments. E.g.: ``` user@host:~$ php -r '$i = 0; getopt("a:b:", [], $i); print_r(array_slice($argv, $i));' -- -a 1 -b 2 hello1 hello2 A...
The following may be used to obtain any arguments following command line options. It can be used before or after invoking PHP's `getopt()` with no change in outcome: ``` # $options = getopt('cdeh'); $argx = 0; while (++$argx < $argc && preg_match('/^-/', $argv[$argx])); # (no loop body) $arguments = array_slice($ar...
16,619,015
I have this on welcome.jsp ```html <c:set var="pgTitle" value="Welcome"/> <jsp:include page="/jsp/inc/head.jsp" /> ``` And this in head.jsp: ```html <title>Site Name - ${pgTitle}</title> ``` But the variable is blank, and the output is merely ``` Site Name - ``` I have read many articles, and I cannot figure ...
2013/05/17
[ "https://Stackoverflow.com/questions/16619015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1684311/" ]
This is because the `pgTitle` variable is set in page scope. Check it [here](http://www.tutorialspoint.com/jsp/jstl_core_set_tag.htm)(sorry I can't get an official documentation for this). If you want to make this work, you have to set the variable in request scope at least. To set your variable in request scope, use ...
One way is to pass variables to an include via query params: ``` <jsp:include page="/WEB-INF/views/partial.jsp?foo=${bar}" /> <jsp:include page="/WEB-INF/views/partial.jsp"> <jsp:param name="foo" value="${bar}" /> <jsp:param name="foo2" value="${bar2}" /> </jsp:include> ``` You can then access those params ...
15,985,498
I am developing iPad app, in which am using a `UITabBarController`. How do I customize the space between the items? I tried this code, but it is not working: ``` self.window.rootViewController = self.tabContoroller; [tabContoroller setFrame:CGRectMake(0,-10, 1038, 54)]; ``` ![enter image description here](ht...
2013/04/13
[ "https://Stackoverflow.com/questions/15985498", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2190083/" ]
For iOS 7 and above, you can now use the property `itemSpacing` in combination with `itemPositioning` set to `UITabBarItemPositioningCentered`
I just create a subclass of the tabbar and rewrite the layoutSubviews. There is a property call [titlePositionAdjustment](https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UITabBarItem_Class/#//apple_ref/occ/instp/UITabBarItem/selectedImage). We can add space by changing the position.
26,235,907
I want to load a struct with 3 values into a struct with only 2 values. ``` typedef struct { double x; double y; } twod; typedef struct { double x; double y; double z; } threed; ``` The 2nd struct contains arrays of coordinates for the 3d plane. The goal is to just load the `x` and...
2014/10/07
[ "https://Stackoverflow.com/questions/26235907", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3901898/" ]
No, of course it's not directly possible since it won't fit. But you can copy the fields manually, of course: ``` twod atwod; threed athreed; athreed.x = 1.0; athreed.y = 2.0; athreed.z = 3.0; atwod.x = athreed.x; atwod.y = athreed.y; ``` You can make scary assumptions and use `memcpy()` but it won't be worth it....
You'd do it simply with the = operator: ``` threed a = {1.0, 2.0, 3.0}; twod b; b.x = a.x; b.y = a.y; ```
20,727,268
I have one archive file that contains multiple subfolders in it. For example : `C:\Documents and Settings\Owner\Desktop\Macro\Intermediación Financiera\2013\12\BCO_Ind.zip` In the **BCO\_Ind.zip** contains this subfolder `scbm\2013\09\fileThatIWant.xls` These subfolder are different for each archive file although it...
2013/12/22
[ "https://Stackoverflow.com/questions/20727268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2851376/" ]
There are two different types of array to consider: * `[D` is a **primitive** double array, equivalent to Java `double[]` * `[Ljava.lang.Double;` is an array of `Double` **references**, equivalent to Java `Double[]`. (the odd notation is because this is the internal representation of these types in Java bytecode... i...
The double-array is unboxed. When you access an item from the array, Clojure automatically boxes it, unless you access it using a type-hinted function expecting that type.
1,214
I have a 2 node cluster (NODE-A & NODE-B) with 2 SQL instances spread between them. INST1 prefers NODE-A, INST2 prefers NODE-B. INST1 started generating errors then, failed over to NODE-B. Migrating INST1 back to NODE-A generates the connection errors after it logs a "Recovery is complete." message. Win 2008 R2 Ent. ...
2011/02/14
[ "https://dba.stackexchange.com/questions/1214", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/247/" ]
I expect the way to do this is with [SSIS](http://msdn.microsoft.com/en-us/library/ms141026.aspx), connecting over your existing ODBC. It's tailor-made for pulling data from diverse sources into SQL Server, for subsequent consumption by, for example, [SSRS](http://msdn.microsoft.com/en-us/library/ms159106.aspx). My adv...
Knight's Microsoft Business Intelligence 24-Hour Trainer is a book DVD combo. This is another good place to get started in Microsoft BI.
428,085
I want to score DNA sequence ``` A = 1 T = 2 C = 3 G = 4 ``` --- My input is ``` ATGGCGATTGA AGCTTAGCCAG AGCTTAGGGAA ``` --- My output should be ``` seq_number 1 has score = 28 seq_number 2 has score = 28 seq_number 3 has score = 27 ``` --- edited my input is .txt file
2018/03/04
[ "https://unix.stackexchange.com/questions/428085", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/269005/" ]
``` sed -e 's/A/./g' -e 's/T/../g' \ -e 's/C/.../g' -e 's/G/..../g' file | awk '{ printf("seq_number %d has score = %d\n", NR, length) }' ``` Output: ``` seq_number 1 has score = 28 seq_number 2 has score = 28 seq_number 3 has score = 27 ``` The `sed` command replaces each base by a number of dots that repre...
well, since this question is getting answered anyway, here's some `perl/ruby` one-liners ``` $ perl -MList::Util=sum0 -lne 'print "seq_number $. has score = ", sum0 split //, tr/ATCG/1234/r' ip.txt seq_number 1 has score = 28 seq_number 2 has score = 28 seq_number 3 has score = 27 $ ruby -ne 'puts "seq_number #{$.} ha...
126,279
I am using 74LS154 4 to 16 decoder [Link to \*.pdf here](http://www.ti.com/lit/ds/symlink/sn74154.pdf). It has two ACTIVE LOW 'ENABLE' pins at the input. What is the use of two ENABLE input pins is the question. Most of the 74 series IC's used in the lab has two ENABLE pins..
2014/08/23
[ "https://electronics.stackexchange.com/questions/126279", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/51876/" ]
It's just simply to reduce the "glue logic" needed to implement the device. It's simple enough to just tie the one input to low and to use the other pin as a single input and this gives more flexibility in implementation. If you look at the package you realize that without the extra /enable that package would have an ...
That's interesting that they would have two active-low enable pins and no active-high enable pins. I'm not entirely sure what you would need that for. I suppose it acts like a free AND or OR gate on the enable input, depending on how you want to look at it, which could be uselful in some applications. However, the 3 to...
34,809,874
I'm trying to create an multidimensional and associative array. I'm tried a PHP-like syntax but it doesn't work. How to solve? ``` var var_s = ["books", "films"]; var_s["books"]["book1"] = "good"; var_s["books"]["book2"] = "bad"; var_s["films"]["films1"] = "bad"; var_s["films"]["films2"] = "bad"; ```
2016/01/15
[ "https://Stackoverflow.com/questions/34809874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5576116/" ]
Use objects: ``` var var_s = {"books":{}, "films": {}}; var_s["books"]["book1"] = "good"; -> {books: {book1: "good"}, films: {}} ```
You want object literal syntax: ``` var_s = { books: { book1: "good", book2: "bad" }, films: { film1: "good", film2: "bad" } } ``` Retrieving a value: ``` var myBook = var_s.books.book1 ``` Setting: ``` var_s.books.book3 = "terrible" ``` I recommend reading [You ...
56,372,471
Can I ask if is this is the only way to check if a variable is false in VB.net? here is my code ``` if a = true and b = true and c = true then msgbox("ok") else if a= true and b = true and c = false then msgbox("c has errors") else if a= true and b = false and c = true then msgbox("b has errors") else ...
2019/05/30
[ "https://Stackoverflow.com/questions/56372471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1801763/" ]
It's more for the code review section, but I give the answers anyway... For my aesthetics it is ugly to write `If (a = True) Then` or `If (a = False) Then`, I would rather use `If (a) Then` and `If (Not a) Then`. In your code, if a + b have errors, nothing happens, as this case is not handled. A Rolls-Royce implement...
My approach would be to put the Booleans in an array. The loop through checking for the value = False. The index of the False values are added to lstIndexes. ``` Dim lstIndexes As New List(Of Integer) Dim bools = {a, b, c} For i = 0 To bools.Length - 1 If Not bools(i) Then lstIndexes.A...
18,513,780
I have SMS API that supports JSON AND XML via HTTP protocal, what it does it it receives SMS request from clients in either JSON or XML format and forward it to MNO using [Kannel SMS Gateway](http://www.kannel.org/ "Kannel SMS Gateway"). Now I have the client whose requirement is that he want to connect to us via SMPP ...
2013/08/29
[ "https://Stackoverflow.com/questions/18513780", "https://Stackoverflow.com", "https://Stackoverflow.com/users/577446/" ]
Well I managed to create SMPP server using [Shorty Nodejs SMPP client and server](https://github.com/Roave/shorty "Shorty")
WELL to get you started with some ground too information refer this [LINKS which will help](http://www.activexperts.com/sms-component/smpp-specifications/introduction/) [THE HOW TO U were asking for](http://www.activexperts.com/sms-component/howto/smpp-send/php/)
2,781,570
Basically, what the title says. I have several properties that combine together to really make one logical answer, and i would like to run a server-side validation code (that i write) which take these multiple fields into account and hook up to only one validation output/error message that users see on the webpage. I ...
2010/05/06
[ "https://Stackoverflow.com/questions/2781570", "https://Stackoverflow.com", "https://Stackoverflow.com/users/220064/" ]
You can add those validation messages into the ModelState errors and display them on client side using Jquery/JavaScript. If your action method return JsonResult then return the errors as JsonResult else set the errors into ViewData and then access and display them at the client side. You can add the custom errors in...
You can add an validation attribute to the class: <http://msdn.microsoft.com/en-us/magazine/ee336030.aspx> However I haven't been able to test this myself.
360
I would like to use my Raspberry Pi as a file server (NAS/SMB). Will I be able to attach a SATA/RAID controller?
2012/06/16
[ "https://raspberrypi.stackexchange.com/questions/360", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/35/" ]
Since the chip does not have SATA support. Your only option is to connect a SATA HD enclosure through the USB port.
To build a custom SATA controller for the GPIO pins would not be a simple job, but may happen, one day. Then the Pi could be used as a NAS. A NAS device would also be a great solution as the Network port is faster than USB.
8,646,441
I have a String and I want to get the words before and after the " - " (dash). How can I do that? example: String: ``` "First part - Second part" ``` output: ``` first: First part second: Second part ```
2011/12/27
[ "https://Stackoverflow.com/questions/8646441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1068827/" ]
Easy: use the [`String.split`](http://java.xiruibin.com/String.html#split%28java.lang.String%29) method. **Example :** ``` final String s = "Before-After"; final String before = s.split("-")[0]; // "Before" final String after = s.split("-")[1]; // "After" ``` Note that I'm leaving error-checking and white-space tri...
use [`indexOf()`](http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/String.html#indexOf%28java.lang.String%29) and [`substring()`](http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/String.html#substring%28int,%20int%29) method of `String` class, for the example given you can also use [`split()`](http://docs.o...
12,544,249
longtime listener, first time caller. I need to use Node as a *client* to connect to a realtime data stream that uses long polling and do stuff with each item as the data is received. I've found plenty of info on using Node as a long polling server, but not as the client. I know how to use the "Request" module to lo...
2012/09/22
[ "https://Stackoverflow.com/questions/12544249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/985688/" ]
I basically revised your whole setup. Tested under PostgreSQL 9.1.5. ### DB schema * I think that your table layout has a major logical flaw (as also pointed out by @Catcall). I changed it the way I suspect it should be: Your last table `measurement_data_value` (which I renamed to `measure_val`) is supposed to sav...
It seems from the numbers that you are being hit by timing overhead. You can verify this by using [pg\_test\_timing](http://www.postgresql.org/docs/9.2/static/pgtesttiming.html) or adding `timing off` to your explain parameters (both are introduced in PostgreSQL version 9.2). I can approximately replicate your results ...
91,916
I have a small DC gear motor which spools a plastic line. Once I've engaged the motor to tighten the line, I want to lock it in place so that the line doesn't unspool. I would then like it to remain in this position mechanically so that I do not have to apply holding current. When I'm ready to release the line, I'd the...
2013/11/26
[ "https://electronics.stackexchange.com/questions/91916", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/33266/" ]
A common way of doing this is with a [self-locking worm drive](http://www.brighthubengineering.com/machine-design/65703-what-is-a-self-locking-worm-gear-how-does-it-work/) The worm drive has a gear ratio that provides high mechanical advantage and depending on the helix angle of the gear, the output can't backdrive the...
You want a DC motor with a mechanical brake. You can electrically brake (permanent magnet) motors by shorting the contacts together, but the braking force of this isn't very strong for small motors. For your cord application, I'd look into some sort of clamp applied to the cord itself with a servo. Especially if it's...
21,355,285
To start things off, here is my code: ``` .header{ width: 100%; height: 10%; background-color: #FF4545; } .headertext{ font-family: 'Duru Sans', sans-serif; font-size: 65px; float:left; margin-top: 0px; margin-bottom: 0px; } .headermenu{ font-family: 'Duru Sans', sans-serif; font-s...
2014/01/25
[ "https://Stackoverflow.com/questions/21355285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Create a new Helper file and put these two methods in you helper. ``` public static function globalXssClean() { // Recursive cleaning for array [] inputs, not just strings. $sanitized = static::arrayStripTags(Input::get()); Input::merge($sanitized); } public static function arrayStripTags($array) { $r...
There is also another package for XSS filter for laravel which can be downloaded [here](https://github.com/waiylgeek/laravel-xss-cleaner) Usage Example: Simple form code snippet ``` {{Form::open(['route' => 'posts.store'])}} {{Form::text('title')}} {{Form::textarea('body')}} {{Form::submit('Post')}} {{Form::close()}...
15,351,634
In essence, I am coding an algorithm that involves summing all numbers in a big array, each of which takes a parameter. And I have a bunch of parameters to run. To me, the summing of all numbers can be a good candidate of leveraging fork/join in Java, and running the algorithm with different parameter can be effectivel...
2013/03/12
[ "https://Stackoverflow.com/questions/15351634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2159018/" ]
I would remove the unwanted records by creating a query as follows: **Replace:** ``` Set MailList = db.OpenRecordset("MyEmailAddresses") ``` **With:** ``` Dim qd As DAO.QueryDef Set qd = db.CreateQueryDef("") qd.SQL = "SELECT * FROM MyEmailAddresses WHERE email IS NOT NULL And Len(Trim(email)) > 0 And OptOut <> 1"...
I'm not 100% certain this is correct because I'm rusty in VBA. You'll need to make sure the fields are named correctly because I took a guess. Jump to ``` If (MailList("email") <> "" AND MailList("opt_out") <> 1) Then ``` and make sure that it has the correct fields. Second, when you do ``` db.OpenRecordset(...
73,729
I ask because of noting how chapter 1 of Romans deals with the person of Christ – who he is – while not dealing with what he has done to save sinners until chapter 3. Could this be significant? I read the following comments in a magazine yesterday: > > “The evangel of God, (which he had promised afore by his prophets...
2022/01/20
[ "https://hermeneutics.stackexchange.com/questions/73729", "https://hermeneutics.stackexchange.com", "https://hermeneutics.stackexchange.com/users/25449/" ]
This evangel that was promised before is concerning God's Son. It shows he is like all men, a union of two elements flesh, and spirit. As to his flesh he was a descendent of David, but as to His spirit, He was from God. > > For as the Father has life in Himself, so also He has granted the Son to have life in Himself....
The “**Who**” of the Savior and the “**What-He-Did-for-Saving**” are completely inseparable, for we know the first through the second, that is to say, we empirically observe His words and deeds, and through Holy Spirit understand that He is God and cannot be anybody less than God, but also, not identifiable with God th...
62,419
I asked a professor to write a reference letter for me and he agreed to it; however, the deadline is coming up and he has yet to submit the letter. As I am not experienced with the process, I wanted to ask if, based on your experience, it is typical for professors to delay submitting references to the last minute.
2016/01/28
[ "https://academia.stackexchange.com/questions/62419", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/47154/" ]
I cannot speak for the US, but in the UK the submission of the reference is not too time critical and becomes relevant only after shortlisting. However, be careful not to nag the prof too often. You seem to know that the prof hasn't submitted it - if you speak to them in person, you can ask them about it. I would exp...
A deadline means two things: 1) you may not submit after it; 2) you need not submit (too) ahead of it. The importance of the latter cannot be overstated when you're juggling with many such deadlines.
36,185,914
I am trying to reproduce the [Long-term Recurrent Convolutional Networks paper.](http://arxiv.org/abs/1411.4389) I have used their [given code](https://github.com/LisaAnne/lisa-caffe-public/tree/lstm_video_deploy). And followed their instructions and generated the single frame model. But when trying to train the LSTM ...
2016/03/23
[ "https://Stackoverflow.com/questions/36185914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2527680/" ]
I know I am a bit late, hope my answer helps someone in future. I too faced the same error. The problem was with scikit-image version. I was using some version newer than scikit-image 0.9.3. Following line ``` processed_image = transformer.preprocess('data_in',data_in) ``` uses scikit-image library functions being i...
I encounter the same question. I adapt several places in `sequence_input_layer.py` and it works well for me at now: 1. I change line 95 and remove `%i` at the end since I don't know what it is used for. i.e., change `frames.append(self.video_dict[key]['frames'] %i)` to `frames.append(self.video_dict[key]['fram...
32,510,904
I would like to conjoin elements inside a vector into some vectors which are inside a parent vector. ``` example: ;; I have a vector [["1" "2" "3"] ["4" "5"]] ;; and another vector ["6" "7"] ``` I did this: ``` (map (fn [row] (conj row ["6" "7"])) [["1" "2" "3"] ["4" "5"]]) ;;=> (["1" "2" "3" ["6" "7"]]...
2015/09/10
[ "https://Stackoverflow.com/questions/32510904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5065320/" ]
Your original code is very close. `conj` adds each element you pass. So you basically just lacked an `apply`: ``` user=> (map (fn [row] (apply conj row ["6" "7"])) [["1" "2" "3"] ["4" "5"]]) (["1" "2" "3" "6" "7"] ["4" "5" "6" "7"]) ```
I think the following is a bit simpler solution. It uses the `glue` function from [the Tupelo Core library](https://github.com/cloojure/tupelo), along with a `for` statement: ``` (ns xyz (:require [tupelo.core :as tc].... (def data [ [1 2 3] [4 5] ] ) (tc/spyx (for [curr-vec data] (tc/glue curr-vec [6 7] ))...
79,146
Is it feasible that we have a layer of API simply for the reason so that people in the team don't have to understand the actual implementation of the individual components each of us are working on? I had this thought because I started to find that some times when working a project with a team of people (I am new to ...
2011/05/25
[ "https://softwareengineering.stackexchange.com/questions/79146", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/26189/" ]
Think of it this way: When a brand-spanking-new developer joins the team, you're going to assign him to a given area of the project. Wouldn't you like him to be able to get up to speed on *that section* of the project so he can complete his assignment, or do you want him to spend three months learning the whole massive...
I think it would be overloading "API" to say you need to do that here, but certainly focusing on the public interfaces that will integrate and co-maintaining test cases are very helpful things to do up front. This way we literally have a conversation that goes like this "these are the methods I expect your classes to p...
37,778
My friend didn't know that an agent gave him a fake work permit. He was not stopped at the Calcutta Airport and was cleared to board the Emirates Plane to Dubai. After reaching Dubai Airport T-3, the immigration officer said the visa is not matching on their system and he was deported on the first Emirates plane back ...
2014/10/22
[ "https://travel.stackexchange.com/questions/37778", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/20282/" ]
Typically, at the point of departure, it is only the airline that checks if the person to fly has the necessary documentation to enter the country of destination. They may or may not have access to systems to verify the validity of the visa - but this is also not their task to do. All they need to check is if they the ...
Immigration officers from the country you are leaving usually do not care much. I guess some might do something if they notice a problem but checking whether you are likely to get in trouble later on is not their mission. Note that some countries don't have any formal immigration check on exit… Airlines everywhere do ...
5,917,304
I would like to know when a interface has been disabled. If I go into the windows manager and disable one of the 2 enabled connections, GetIfTable() only returns status about 1 interface, it no longer sees the disconnected one. (Returns 1 table) How can I get something to return that the disabled **interface still e...
2011/05/06
[ "https://Stackoverflow.com/questions/5917304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52256/" ]
I think you would just need to read the registry. For example, this is a snippet found on the web of what things should look like: ``` [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{1E6AF554-25FF-40FC-9CEE-EB899472C5A3}\Connection] "PnpInstanceID"="PCI\\VEN_14E4&DEV_...
The IP\_ADAPTER\_ADDRESSES structure hold an OperStatus member. See [MSDN documentation](http://msdn.microsoft.com/en-us/library/aa366058%28v=vs.85%29.aspx) I think it can be used to detect disabled NICs. I didn't try. Here is a test code: ``` ULONG nFlags= 0; if (WINVER>=0x0600) // flag...
594,080
I use *Kali Linux* as a virtual machine in *VMware Workstation Player* with *Windows 10 Home* as host. The *Player* has the option to pick a *Windows* folder to be used as a shared folder. I set this up, it says it's enabled, but in *Kali Linux* this shared folder should be present in `/mnt/hgfs`. `/mnt` exists, but is...
2020/06/20
[ "https://unix.stackexchange.com/questions/594080", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/418924/" ]
Both *stackprotector's* AND *petoetje59's* answer helped with this issue. 1. `cd /mnt/hgfs` 2. **If the folder is missing** --> `sudo mkdir hgfs` 3. `sudo vim /etc/fstab` 4. Enter `vmhgfs-fuse /mnt/hgfs fuse defaults,allow_other 0 0` at the end of the file and save 5. `sudo reboot now` 6. `ls /mnt/hgfs` 7. The Shared ...
The short of it is below, but here's a little [ten minute video](https://www.youtube.com/watch?v=bUDup4RibEs) that goes through a good step by step process. Even if the hgfs folder was present, it would be empty. The host has made the files available to the vm, but the vm still needs to be told about their presence. T...
29,888,850
I'm plotting a bar chart using MPAndroid chart. Now all my bars have the same color but I want different colors for the bars based on Y axis values, like if value >100. color = red, like in the picture below. Is that possible? someone please help me. ![enter image description here](https://i.stack.imgur.com/AW5C1.png)...
2015/04/27
[ "https://Stackoverflow.com/questions/29888850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2067264/" ]
You can find out the documentation about setting colors in MPAndroidChart from [this link](https://github.com/PhilJay/MPAndroidChart/wiki/Setting-Colors) ``` LineDataSet setComp1 = new LineDataSet(valsComp1, "Company 1"); // sets colors for the dataset, resolution of the resource name to a "real" color is done i...
**Update** form [m4n3k4](https://stackoverflow.com/a/31851986/8926845) answer ``` public class MyBarDataSet extends BarDataSet { public MyBarDataSet(List<BarEntry> yVals, String label) { super(yVals, label); } @Override public int getColor(int index) { if(getEntryForIndex(index).ge...
8,750,986
I've been learning IoC, Dependency Injection etc. and enjoying the process. The benefits of decoupling and programming to interfaces are, to me, a no-brainer. However, I really don't like binding myself to a specific framework like Unity or Autofac or Windsor - because I'm still learning and haven't yet decided which ...
2012/01/05
[ "https://Stackoverflow.com/questions/8750986", "https://Stackoverflow.com", "https://Stackoverflow.com/users/479971/" ]
> > A DI Container should only be referenced from the [Composition Root](http://blog.ploeh.dk/2011/07/28/CompositionRoot.aspx). > All other modules should have no reference to the container. > > > -Mark Seemann (author of [Dependency Injection in .NET](http://manning.com/seemann/)) In other words, you should onl...
As some other folks have mentioned, prefer constructor injection. This will solve many of your problems. If your classes have direct dependencies on the IoC container itself, it tends to be a variant of using the service locator (anti-)pattern. In this particular case, isolate which types are being resolved via the se...
16,210,558
Here is what i want to do. I want to store de data from a Http response, headers and data. I figured an easy way to do this would be to store the response and the data as a pair. The data is fetched from a LRU-cache. The LRU cache takes a key(string) and the pair. The HTTPResponse is in the form of a POCO C++ HTTPRespo...
2013/04/25
[ "https://Stackoverflow.com/questions/16210558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1641868/" ]
``` cout << ((string*)tmp.second()).c_str(); ^^ ``` you are casting to a `string*`. It should be just `string` (or nothing at all) because the `second` of `pair<HTTPResponse,string>` is just a `string`. and second is a just member not a member function so it should be `tmp.second` --- ``` cout << ...
`second` is a memeber value not function defined in standard as 20.3.2 Class template pair ========================== > > namespace std { > > template > > struct pair { > > typedef T1 first\_type; > > typedef T2 second\_type; > > T1 first; > > T2 second; > > > thus correct usage of seco...
38,198
`celsius = (5.0/9.0) * (fahr-32.0);` Is it just a development choice that the C developers decided upon or is there a reason to this? I believe a float is smaller than a double, so it might be to prevent overflows caused by not knowing what decimal format to use. Is that the reason, or am I overlooking something?
2008/09/01
[ "https://Stackoverflow.com/questions/38198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572/" ]
``` celsius = (5.0/9.0) * (fahr-32.0); ``` In this expression, `5.0`, `9.0`, and `32.0` are `double`s. That's the default type for a floating-point constant - if you wanted them to be `float`s, then you would use the `F` suffix: ``` celsius = (5.0F/9.0F) * (fahr-32.0F); ``` Note that if `fahr` was a `double`, then...
The reason that the expression is cast to double-precision is because the literals specified are double-precision values by default. If you specify the literals used in the equation as floats, the expression will return a float. Consider the following code (Mac OS X using gcc 4.01). ``` #include <stdio.h> int main() ...
6,586,302
I want to add some space to the right of an `<input type="text" />` so that there's some empty space on the right of the field. So, instead of ![](https://i.imgur.com/jCdxV.jpg), I'd get ![](https://i.imgur.com/Bhyvc.jpg). So, same behavior just some empty space to the right. I've tried using `padding-right`, but th...
2011/07/05
[ "https://Stackoverflow.com/questions/6586302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/515160/" ]
You can provide padding to an input like this: HTML: ``` <input type=text id=firstname /> ``` CSS: ``` input { width: 250px; padding: 5px; } ``` however I would also add: ``` input { width: 250px; padding: 5px; -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */ -moz-box-si...
``` <input class="form-control search-query input_style" placeholder="Search…" name="" title="Search for:" type="text"> .input_style { padding-left:20px; } ```
20,117,290
My local machine is not connected to internet. However, I have a server on local network which I can connect via SSH. This server is directly connected to internet. I do not have the admin privileges on the server, so I cannot install a browser on it. However, I can download web pages on it using wget. I was wondering ...
2013/11/21
[ "https://Stackoverflow.com/questions/20117290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1164609/" ]
This problem happens to me after SDK updates when I am using any device based directly on the default Device definitions. Furthermore: any new virtual device created with the default device definitions (Nexus 7, Nexus S, etc) gives directly the same error. My solution is to duplicate these definitions: 1. In Android...
the answer by @coderazzi is correct, but those who are new to intellij and are facing problems in finding appropriate settings here's some images 1. Open AVD Settings![](https://i.stack.imgur.com/OSewD.jpg) 2. Open Device Definitions and select any device definitions eg. Nexus S ![](https://i.stack.imgur.com/vtmwo.jpg...
31,652,572
With my compiler, `c` is 54464 (16 bits truncated) and `d` is 10176. But with `gcc`, `c` is 120000 and `d` is 600000. What is the true behavior? Is the behavior undefined? Or is my compiler false? ``` unsigned short a = 60000; unsigned short b = 60000; unsigned long c = a + b; unsigned long d = a * 10; ``` Is there...
2015/07/27
[ "https://Stackoverflow.com/questions/31652572", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5160343/" ]
First, you should know that in C the standard types do not have a specific precision (number of representable values) for the standard integer types. It only requires a **minimal** precision for each type. These result in the following **typical bit sizes**, the [standard](http://port70.net/~nsz/c/c11/n1570.html#6.2.6....
In C the types `char`, `short` (and their unsigned couterparts) and `float` should be considered to be as "storage" types because they're designed to optimize the storage but are not the "native" size that the CPU prefers and they **are never used for computations**. For example when you have two `char` values and pla...
39,245,755
I have a div with 3 images : ```css .main_block { width: 800px; } .main_block: before, .main_block: after { overflow: hidden; content: ""; display: table; } .main_block: after { clear: both; } .inner_block { display: inline-block; float: left; padding-left: 20px } .inner_block img {...
2016/08/31
[ "https://Stackoverflow.com/questions/39245755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/679099/" ]
I use flexbox for this: `display:flex` is the key here is the [code](https://jsfiddle.net/MaciejWojcik/bk1wdmpb/) ```css .main_block { width: 100%; display:flex; justify-content:space-between; } .inner_block { display: inline-block; margin: 0 auto; } ``` ```html <div class="main_blo...
I think it works .main\_block { width: 800px; margin: 0 auto }
3,343,292
Let $J\_{0,1}:=[0,1]$. Let's start with the construction of the Cantor set. > > **Step 1.** We remove the central open interval $I\_{0,1}=\big(\frac{1}{3},\frac{2}{3}\big)$. We denote with $J\_{1,1}:=\big[0,\frac{1}{3}\big]$ and with $J\_{1,2}:=\big[\frac{2}{3},1\big]$. > > > We define $K\_1:=J\_{1,1}\cup J\_{1,2}...
2019/09/03
[ "https://math.stackexchange.com/questions/3343292", "https://math.stackexchange.com", "https://math.stackexchange.com/users/554978/" ]
The tool that unlocks a lot of powerful intuition about this type of constructions is called **coding**. You can find a very thorough introduction (together with its applications to the Cantor set and other dynamical systems settings) in Chapter 7 of [A First Course in Dynamics](https://www.cambridge.org/core/books/fir...
You can define the Cantor set recursively. What I mean is that you take the interval $[0,1]$, divide it in 3 equal parts $[0,1/3]$, $[1/3,2/3]$ and $[2/3,1]$ and consider the rightmost an the leftmost. They are interval just as the initial $[0,1]$, so in each of them you can repeat the same operations. With this slight...
48,524,870
I am passing a component as a prop. This is defined as below. ``` export type TableProps<T> = { contents: T[], loadContents: () => Promise<T[]> }; ``` This works fine, but I'd like to update this definition to say, at least above props should exist, but to allow additional props. Is there a definition I can u...
2018/01/30
[ "https://Stackoverflow.com/questions/48524870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/168012/" ]
You can try something like this: ```js interface IDummy { value: string; propName: string; [key: string]: any; } ``` What this will do is, it will force you to pass `value` and `propName` properties in object but you can have any other properties. [Sample](https://www.typescriptlang.org/play/#src=interface%20...
May be this could help. ``` type MyInterface ={| x: number |}; type Props = {| ...MyInterface, ...{| y: number |} |} ```
22,518,586
I want to play a bit with the recently released Java 8 on OS X Mavericks, but have problems configuring the `compiler compliance level` to anything beyond `1.7`. I tried this with a recent Luna build (4.4.0M6) as well as with Kepler (4.3 SR2), patched with [this](http://download.eclipse.org/eclipse/updates/4.3-P-build...
2014/03/19
[ "https://Stackoverflow.com/questions/22518586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/305532/" ]
I think I got it right now. I just re-installed the patch from [here](http://download.eclipse.org/eclipse/updates/4.3-P-builds/) and now `1.8` is shown as compiler level. I think while the "About" dialog showed me that the patch was installed, it probably wasn't done properly, because it updated other plugins / the ID...
I had some problems getting Java SE 8 to work in Eclipse too. I followed the [Instructions in the Eclipse wiki](https://wiki.eclipse.org/JDT/Eclipse_Java_8_Support_For_Kepler) for the Eclipse Kepler SR2 (4.3.2) version. After that, I could choose version 1.8 instead of 1.7, which solved the problem. The instructions s...
380,629
Is there an extension, custom user stylesheet, etc. that will disable or revert the customization of scrollbars in Webkit based browsers like Google Chrome? I like the plain, native scrollbars but I cannot seem to find a combination of CSS to make them come back once they have been styled by CSS.
2012/01/20
[ "https://superuser.com/questions/380629", "https://superuser.com", "https://superuser.com/users/114552/" ]
I took @bumfo's answer, and fixed this security issue on chrome: <https://stackoverflow.com/questions/49161159/uncaught-domexception-failed-to-read-the-rules-property-from-cssstylesheet> If you paste this in your console, you'll get your scroll bars back: ``` for (var sheetI = 0; sheetI < document.styleSheets.length;...
As discussed [here](https://www.reddit.com/r/userstyles/comments/qjwlet), it does not seem feasible to reset Chrome scrollbars with CSS, but you can always override them. ```css /* Adjust as desired */ *::-webkit-scrollbar { all: initial !important; width: 15px !important; background: #d8d8d8 !important; ...
7,796
I'm working on a project to detect a road sign from the Image. Consider the sample image below: ![enter image description here](https://i.stack.imgur.com/j5YjB.jpg) I'm using a heuristic search to detect the road sign within an image. Basically, I want some weak features (colour, shape, zero symmetry within road sign...
2013/02/09
[ "https://dsp.stackexchange.com/questions/7796", "https://dsp.stackexchange.com", "https://dsp.stackexchange.com/users/3527/" ]
You could take a look at recent publications by Segvic et al, I know they have been working on the problems of traffic sign detection. The basic idea was to use the Viola-Jones framework for object detection, which was later improved by adding some temporal and spatial constraints. If I remember correctly, they achiev...
I think something worthy for you to have a try is the pixel co-occurrence model. Roughly speaking, this is something based on pixel intensities. So you can quickly skip all unlikely positions and concentrate on those interested ones. Search for articles about skin models. Meanwhile, there are some HAAR orthogonal pro...
51,851,998
I have query returning few rows. There is column with consecutive numbers and nulls in it. For example, it has values from 1-10 then 5 nulls, then from 16-30 and then 10 nulls, then from 41-45 and so on. I need to update that column or create another column to create groupId for consecutive columns. Meaning as per ...
2018/08/15
[ "https://Stackoverflow.com/questions/51851998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1094183/" ]
This was a fun one. Here is the solution with a simple table that contains just integers, but with gaps. ``` create table n(v int) insert n values (1),(2),(3),(5),(6),(7),(9),(10) select n.*, g.group_no from n join ( select row_number() over (order by low.v) group_no, low.v as low, min(high.v) as high from n as low j...
Typical island & gap solution ``` select col, grp = dense_rank() over (order by grp) from ( select col, grp = col - dense_rank() over (order by col) from yourtable ) d ```
2,725,579
$$ \begin{cases} 2x^2-4y^2-\frac{3}{2}x+y=0 \\ 3x^2-6y^2-2x+2y=\frac{1}{2} \end{cases} $$ I multiplied the first with $-6$ and the second with $4$ and get two easier equations: $9x-6y=0 \land -8x+8y=2 $ and out of them I get that $x=\frac{1}{2}$ and that $y=\frac{3}{4}$ but when I put it back into the original syste...
2018/04/06
[ "https://math.stackexchange.com/questions/2725579", "https://math.stackexchange.com", "https://math.stackexchange.com/users/478783/" ]
If $2x^2-4y^2-\frac32x+y=0$ and $3x^2-6y^2-2x+2y=\frac12$, then$$3\times(2x^2-4y^2-\frac32x+y)-2\times(3x^2-6y^2-2x+2y)=-1;$$in other words, $-\frac x2-y=-1$. So, replace $y$ with $1-\frac x2$ in the first equation, and you'll get a quadratic equation whose roots are $-3$ and $1$. So, the solutions of the system are $\...
It looks like you took the two scaled equations $$-12x^2+24y^2+9x-6y = 0 \\ 12x^2-24y^2-8x+8y=2$$ and then simply lopped off the common quadratic parts to produce two linear equations that are entirely unrelated to the original system. Once you’ve scaled the two equations so that the coefficients of their squared terms...
4,425,400
I'm looking for an expression that will cause the interpreter to exit when it is evaluated. I've found lots of implementation-specific ones but none in the HyperSpec, and I was wondering if there were any that I wasn't seeing defined in the specification. I've found that `(quit)` is recognized by both CLISP and SLIME,...
2010/12/13
[ "https://Stackoverflow.com/questions/4425400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/306257/" ]
As far as I know, this is not covered by the Spec, and you will have to use the implementation-specific solutions, or maybe try and look if someone has already written a trivial-quit lib (or start one on [CLiki](http://www.cliki.net)). If you only care about interactive use, `,q` in SLIME will always do the right thin...
There is an [ASDF library called shut-it-down](http://verisimilitudes.net/2017-12-30) that provides a `quit` function that works by just having cases for the common CL implementations.
33,755
I'm rather pleased with my latest attempt to remind my 4 year old to ask for things nicely - if she asks/demands something without saying "please" then I ask her to count to 10 and ask again. It seems effective, and she even seems to quite enjoy it, but I wonder if there are any downsides I hadn't thought about?
2018/04/25
[ "https://parenting.stackexchange.com/questions/33755", "https://parenting.stackexchange.com", "https://parenting.stackexchange.com/users/7304/" ]
There's an awful lot of things going on here, goodness me. > > Right now, she's a single-parent. She rarely takes action because of work, due to tiredness and partying. She only has time for her during weekend. I told her about it. > > > First of all- this is awful. I won't go into an opinion-based view here, but...
I really like SnyperBunny's answer. I would like to add: Go outside. Nature. Parks. Sports. Music Lessons. Let her expierience real life adventures. Back at home you could use these adventures in your night time routine. Talk to her about what you did this day and what was funny, beautiful, nice, scary and so on. What...
12,322,414
Since this question is from a user's (developer's) perspective I figured it might fit better here than on Server Fault. I'd like an ASP.NET hosting that meets the following criteria: * The application seemingly runs on a single server (so no need to worry about e.g. session state or even static variables) * There is ...
2012/09/07
[ "https://Stackoverflow.com/questions/12322414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/220230/" ]
``` //#region Test //#endregion ``` That works in Android Studio & IntelliJ.
Dart does not support regions as part of the language specification. However, many IDE tools offer this feature using formatted comments. See the answer below identifying Android Studio and IntelliJ as two such examples.