title
stringlengths
15
150
body
stringlengths
38
32.9k
label
int64
0
3
Spark-Csv Write quotemode not working
<p>I am trying to write a DataFrame as a CSV file using Spark-CSV (<a href="https://github.com/databricks/spark-csv" rel="noreferrer">https://github.com/databricks/spark-csv</a>)</p> <p>I am using the command below</p> <pre><code>res1.write.option("quoteMode", "NONE").format("com.databricks.spark.csv").save("File") </code></pre> <p>But my CSV file is always written as</p> <p>"London"<br> "Copenhagen"<br> "Moscow"</p> <p>instead of</p> <p>London<br> Copenhagen<br> Moscow </p>
0
Click event doesnt work in safari mobile for some HTML content
<p>In my web app, there is a separate navbar for mobile devices. I want this navbar to collapse when the menu button is clicked or anywhere else in the site is clicked. It already works in any mobile browser but not it safari mobile (In safari also, for home page it works but not in other pages). In other pages, there are some html generated dynamically. It seems that the click event doesn't work for those content. I'd really appreciate a solution for this problem. the code is as follows. I've tried 'body', $(document), window instead of $('html'). It doesn't for them also.</p> <pre><code>$('html').click(function(event) { var clickover = $(event.target); var $navbar = $(".navbar-collapse"); var _opened = $navbar.hasClass("in"); if (_opened === true &amp;&amp; !clickover.hasClass("navbar-toggle")) { $navbar.collapse('hide'); } }); </code></pre> <p>I've also tried what is mentioned in <a href="http://www.danwellman.co.uk/fixing-jquery-click-events-for-the-ipad/" rel="nofollow">Fixing jQuery Click Events for the iPad</a>. But the code mentioned in there doesn't trigger at all. The code I've tried for this as belows.</p> <pre><code>var ua = navigator.userAgent, event = (ua.match(/iPad/i)) ? "touchstart" : "click"; $('body').bind(event, function(e) { var clickover = $(event.target); var $navbar = $(".navbar-collapse"); var _opened = $navbar.hasClass("in"); if (_opened === true &amp;&amp; !clickover.hasClass("navbar-toggle")) { $navbar.collapse('hide'); } </code></pre> <p>}</p> <p>I'd really appreciate an answer for my question (I was working on this for more than a day but didn't find a solution). </p>
0
How to use Spring Data / JPA to insert into a Postgres Array type column?
<p>Say I have a postgres table like so:</p> <pre><code>CREATE TABLE sal_emp ( name text, pay_by_quarter integer[], schedule text[][] ); </code></pre> <p>Would I even be able to use Spring Data to insert into the columns <code>pay_by_quarter</code> or <code>schedule</code> ? If possible, how would this look as a Repository and Entity ? I haven't been able to find any documentation or examples addressing this, possibly because of how it overlaps with the more common use-case, inserting into multiple tables as one-to-many relations. Speaking of which, I fully intend to use the Postgresql <code>array</code> datatype and no relational tables.</p>
0
R check row for row if a combination exists in another dataframe
<p>I have two data frames (df1 and df2) in R with different information except for two columns, a person number (pnr) and a drug name (name). Row for row in df1, I want to check, if the combination of pnr and name exists somewhere in df2. If this combination exists, I want "yes" in a another column in df1. If not a "no".</p> <pre><code>df1 pnr|drug|...|check ---|----|---|----- 1 | 1 |...| no 1 | 2 |...| yes 2 | 2 |...| yes 3 | 2 |...| no ..... df2 pnr|drug|...| ---|----|---| 1 | 2 |...| 2 | 2 |...| .... </code></pre> <p>For example, I want check, if the row combination pnr=1 &amp; drug=1 exists in df2 (no), pnr=1 &amp; drug=2 (yes) etc. And then place a "yes" or "no" in the check column in df1</p> <p>I have tried the following <code>for</code> statement without luck. It does place a "yes or "no" in the "check" column, but it doesn't do it correctly</p> <pre><code>for(index in 1:nrow(df1)){ if((df1[index,]$pnr %in% df2$pnr)&amp;(df1[index,]$name %in% df2$name)){ check_text="yes"}else{check_text="no"} df1$check=check_text } </code></pre> <p>I have a sense that I should be using <code>apply</code>, but I haven't been able to figure that out. Do any of you have an idea how to solve this?</p>
0
cannot find the declaration of element 'linearlayout'
<p>I am new to Android and learning with a book.But here comes the problem. When I decided to add a folder named layout_larger and copied the file named <code>activity_one_page_or_two.xml</code> to <code>layout_larger</code>, unfortunately I occurred the <code>error : Error:(4, 43) cvc-elt.1.a: Cannot find the declaration of element LinearLayout</code>.No idea why it comes. Anyone could give me a hand?</p> <p><img src="https://i.stack.imgur.com/WdBd6.png" alt="Enter image description here"></p> <p><img src="https://i.stack.imgur.com/QdyNk.png" alt="Enter image description here"></p>
0
How to auto generate primary key ID properly with Hibernate inserting records
<p>I have a Member entity class whose primary key is defined as:</p> <pre><code> @Id @GeneratedValue private Long id; </code></pre> <p>I pre-loaded two records into database with Hibernate when I starts the application:</p> <pre><code>insert into Member (id, name, email, phone_number) values (0, 'John Smith', '[email protected]', '2125551212') insert into Member (id, name, email, phone_number) values (1, 'Mary Smith', '[email protected]', '2025551212') </code></pre> <p>Now the MySql database has two records:</p> <pre><code>select * from Member; +----+---------------------------+------------+--------------+ | id | email | name | phone_number | +----+---------------------------+------------+--------------+ | 0 | [email protected] | John Smith | 2125551212 | | 1 | [email protected] | Mary Smith | 2025551212 | </code></pre> <p>+----+---------------------------+------------+--------------+</p> <p>Now, in my member registration page, when I submit a request to register a new member, I received this error message:</p> <pre><code>Caused by: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '1' for key 'PRIMARY' </code></pre> <p>I figured that it because the auto-generated key always starts with '1', but in the database, it already has two records, so the primary key '1' will be duplicate.</p> <p>My question is, how to create the primary key properly, given a number of existing records in the table? If I don't use the </p> <pre><code>@GeneratedValue </code></pre> <p>annotation, then I always have to find out what's the next key from the database table before insertion.</p> <p>Is there a best way to handle this situation, which seems very common? </p> <p>EDITED: As suggested, I used the Stragey:</p> <pre><code>@Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; </code></pre> <p>What's strange is that, if there are two existing records in the table as below:</p> <pre><code>select * from English; +----+------------+---------+--------+ | id | sentence | source | status | +----+------------+---------+--------+ | 1 | i love you | unknown | 0 | | 2 | i like you | unknown | 0 | +----+------------+---------+--------+ </code></pre> <p>after I register a new record into the table, the new ID starts with 4, not 3, as below. </p> <pre><code>select * from English; +----+----------------+---------+--------+ | id | sentence | source | status | +----+----------------+---------+--------+ | 1 | i love you | unknown | 0 | | 2 | i like you | unknown | 0 | | 4 | I have a book. | Unknown | 0 | +----+----------------+---------+--------+ 3 rows in set (0.00 sec) </code></pre> <p>What might cause this? </p>
0
JavaScript stop script if a condition is not met
<p>I have a javascript file to which I send a parameter </p> <pre><code> &lt;script lang="en" src="/test/load.js" &gt;&lt;/script&gt; </code></pre> <p>In the file I have script similar to this:</p> <pre><code> ! function() { some code var lag = ( script.getAttribute( 'lang' ) == null || script.getAttribute( 'lang' ) == '' ) ? exit : script.getAttribute( 'lang' ); </code></pre> <p>The idea is that I do not want to execute the code after the one quoted above in case that parameter 'lang' is missing or is an empty string. How can I do that, I tried using</p> <pre><code> exit </code></pre> <p>or</p> <pre><code> break </code></pre> <p>but they do not work for me.</p>
0
How do you import macros in submodules in Rust?
<p>I have the following directory structure</p> <ul> <li><code>/main.rs</code></li> <li><code>/lib.rs</code></li> <li><code>/tutorial/mod.rs</code></li> <li><code>/tutorial/foo.rs</code></li> </ul> <p>In <code>foo.rs</code> I need to use a macro from the glium library, <code>implement_vertex!</code>. If I put <code>#[macro_use] extern crate glium;</code> at the head of <code>foo.rs</code>, I get a <code>error: an `extern crate` loading macros must be at the crate root</code>. I also get a <code>error: macro undefined: 'implement_vertex!'</code></p> <p>There is also a <code>lib.rs</code> that is the crate root of the tutorial modules. I needed to put <code>#[macro_use]</code> there. Does this create 2 crate roots if I have both <code>main.rs</code> and <code>lib.rs</code>?</p> <p>What is the correct way to import macros in a submodule?</p>
0
Retrofit 2 + Rxjava handling error
<p>So i already receive a token from the Json when the login is made without problems, and receive the hash</p> <p>But when the response from the server is a error, i cannot get the Json message ({message:"Error : wrong email} " because in the onError we only get as argument a Throwable and not a model class like in on</p> <p>how can i get a json message from server onError??</p> <pre><code>final Observable&lt;TokenResponse&gt; observable = Service.login(userCredentials); observable.subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Subscriber&lt;TokenResponse&gt;() { String error=""; @Override public void onCompleted() { mLoginView.whenLoginSucess(); } @Override public void onError(Throwable e) { if (e instanceof HttpException) { HttpException exception = (HttpException) e; Response response = exception.response(); Converter&lt;ResponseBody, ErrorFromServer&gt; converter = new GsonConverterFactory() .responseBodyConverter(ErrorFromServer.class, Annotation[0]); ErrorFromServer error = converter.convert(response.errorBody()); } mLoginView.errorText(error); e.printStackTrace(); } @Override public void onNext(TokenResponse tokenResponse) { SharedPreferences.Editor editor = sharedP.edit(); editor.putString("hash", tokenResponse.getToken()); editor.commit(); //getString return key value "hash" if there is no value, returns null hash = sharedP.getString("hash",null); } }); </code></pre> <p>TokenResponse code</p> <pre><code>public class TokenResponse { @SerializedName("hash") @Expose private String token; @SerializedName("message") @Expose private String message; public String getMessage() {return message;} public String getToken() { return token; } </code></pre> <p>}</p>
0
Android : ZXingScannerView by - me.dm7.barcodescanner:zxing:1.9 Does not ScanQR Code
<p>I Am using a <a href="https://github.com/dm77/barcodescanner" rel="nofollow noreferrer">https://github.com/dm77/barcodescanner</a> to scan QR Code. but it does not scan QR Code at all (handleResult never gets called). When I Focus camera on QR Code it does not scan code. </p> <p>Here is my activity.</p> <pre><code> package education.qrexample; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.Toast; import com.google.zxing.Result; import me.dm7.barcodescanner.zxing.ZXingScannerView; public class MainActivity extends AppCompatActivity implements ZXingScannerView.ResultHandler{ private ZXingScannerView mScannerView; @Override public void onCreate(Bundle state) { super.onCreate(state); mScannerView = new ZXingScannerView(this); // Programmatically initialize the scanner view setContentView(mScannerView); mScannerView.setResultHandler(this); // Register ourselves as a handler for scan results. mScannerView.startCamera(); // Start camera on resume// Set the scanner view as the content view } @Override public void onResume() { super.onResume(); } @Override public void onPause() { super.onPause(); mScannerView.stopCamera(); // Stop camera on pause } @Override public void handleResult(Result rawResult) { Toast.makeText(this,rawResult.getText(),Toast.LENGTH_LONG); } } </code></pre> <p>My Gradle</p> <pre><code>apply plugin: 'com.android.application' android { compileSdkVersion 24 buildToolsVersion "24.0.1" defaultConfig { applicationId "education.qrexample" minSdkVersion 15 targetSdkVersion 24 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:24.0.0' compile 'me.dm7.barcodescanner:zbar:1.9' compile 'me.dm7.barcodescanner:zxing:1.9' } </code></pre> <p>I already have a permission to access a Camera in mainfests file. Not sure What is missing. </p>
0
ARFF to CSV multiple files conversions
<p>Anyone successfully tried to convert many ARFF files to CSV files from windows Command line.</p> <p>I tried to use <code>weka.core.converters.CSVSaver</code> but it works for a single file only.</p> <p>Can it be done for multiple files?</p>
0
SQL query of Haversine formula in SQL server
<p>I am trying to get drivers who visited certain area from SQL server 2014 database. The table is named DriverLocationHistory.</p> <p>Here is the sql query I used : </p> <pre><code>SELECT id, ( 6371 * acos( cos( radians(37) ) * cos( radians( latitude ) ) * cos( radians( Longitude ) - radians(-122) ) + sin( radians(37) ) * sin(radians(latitude)) ) ) AS distance FROM DriverLocationHistory HAVING distance &lt; 5 ORDER BY distance </code></pre> <p>When I execute the query I get this error : </p> <pre><code>Msg 207, Level 16, State 1, Line 7 Invalid column name 'distance'. </code></pre>
0
ffmpeg concat: "Unsafe file name"
<p>Trying to convert a bunch of mts-files into a big mp4-file:</p> <pre><code>stephan@rechenmonster:/mnt/backupsystem/archive2/Videos/20151222/PRIVATE/AVCHD/BDMV$ ~/bin/ffmpeg-git-20160817-64bit-static/ffmpeg -v info -f concat -i &lt;(find STREAM -name '*' -printf "file '$PWD/%p'\n") -deinterlace -r 25 -s hd720 -c:v libx264 -crf 23 -acodec copy -strict -2 ~/tmp/Videos/20151222.mp4 ffmpeg version N-81364-gf85842b-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.4.1 (Debian 5.4.1-1) 20160803 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --enable-librtmp --enable-libmfx --enable-libzimg --cc=gcc-5 libavutil 55. 28.100 / 55. 28.100 libavcodec 57. 53.100 / 57. 53.100 libavformat 57. 46.101 / 57. 46.101 libavdevice 57. 0.102 / 57. 0.102 libavfilter 6. 51.100 / 6. 51.100 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 1.100 / 2. 1.100 libpostproc 54. 0.100 / 54. 0.100 [concat @ 0x56054a0] Unsafe file name '/mnt/backupsystem/archive2/Videos/20151222/PRIVATE/AVCHD/BDMV/STREAM' /dev/fd/63: Operation not permitted </code></pre> <p>Any ideas what goes wrong here? What does the term "unsafe file" mean in this context?</p>
0
What are the best Cache practices in ehcache or spring cache for spring MVC?
<p>Planning to implement cache mechanism for static data in spring web based application, can any one explain which is the best and how it works?</p> <ul> <li>EhCache</li> <li>Spring Cache</li> </ul>
0
Alternative to event.srcElement.id
<p>Currently I have a function that works perfectly for IE, Chrome and Safari in order to get the ID name of a textbox I'm placing a focus on within a Gridview.</p> <pre><code>function onTextFocus() { alert(event.srcElement.id); } </code></pre> <p>The function is called upon during a RowDataBound for the gridview:</p> <pre><code>protected void ItemGridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ((TextBox)e.Row.FindControl("txtQuantity")).Attributes.Add("onfocus", "onTextFocus();"); } } </code></pre> <p>However it doesn't work for Firefox as it doesn't recognize srcElement. So I'm looking for an alternative that would work for all browsers. After scouring Google I came up with these alternatives but I either get an undefined error or ReferenceError. Any ideas why?</p> <pre><code>function onTextFocus() { alert(this.id); alert(event.currentTarget.id); alert(event.target.id); alert(event.currentTarget); alert(event.target); alert($(this).attr('id')); alert($(obj).attr("id")); alert($(this).id); alert($(this).get(0).id); alert($(this).prop("id")); } </code></pre>
0
Android Constraint Layout Programmatically?
<p>In iOS I'm a big fan of deleting the storyboard and using the Cartography framework to lay everything out in code. This is stolen from Cartography's github:</p> <pre><code>constrain(view1, view2) { view1, view2 in view1.width == (view1.superview!.width - 50) * 0.5 view2.width == view1.width - 50 view1.height == 40 view2.height == view1.height view1.centerX == view1.superview!.centerX view2.centerX == view1.centerX view1.top &gt;= view1.superview!.top + 20 view2.top == view1.bottom + 20 } </code></pre> <p>Is there any equivalent at all for Android? It seems like the new Constraint Layout is a step in the right direction but I would like to do it programmatically.</p>
0
Updating messages with inline keyboards using callback queries
<p>I want to update message in chat with inline keyboard but can't understand how to receive a <em>inline_message_id</em> or if it only for inline queries how I can determine <em>chat_id</em> and <em>message_id</em> for using it on <a href="https://pythonhosted.org/python-telegram-bot/telegram.bot.html" rel="nofollow">editMessageText(*args, **kwargs)</a> in class <em>telegram.bot.Bot</em>?</p> <p>my code example (part of it):</p> <pre><code>#!/usr/bin/python import telegram from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, InlineQueryHandler, CallbackQueryHandler tokenid = "YOUR_TOKEN_ID" def inl(bot, update): if update.callback_query.data == "k_light_on": #func for turn on light res = k_light.on() bot.answerCallbackQuery(callback_query_id=update.callback_query.id, text="Turning on light ON!") bot.editMessageText(inline_message_id=update.callback_query.inline_message_id, text="Do you want to turn On or Off light? Light is ON") #hardcoded vars variant #bot.editMessageText(message_id=298, chat_id=174554240, text="Do you want to turn On or Off light? Light is ON") elif update.callback_query.data == "k_light_off": #func for turn on light res = k_light.off() bot.answerCallbackQuery(callback_query_id=update.callback_query.id, text="Turning off light OFF!") bot.editMessageText(inline_message_id=update.callback_query.inline_message_id, text="Do you want to turn On or Off light? Light is ON") #hardcoded vars variant #bot.editMessageText(message_id=298, chat_id=174554240, text="Do you want to turn On or Off light? Light is OFF") else: print "Err" def k_light_h(bot, update): reply_markup = telegram.InlineKeyboardMarkup([[telegram.InlineKeyboardButton("On", callback_data="k_light_on"), telegram.InlineKeyboardButton("Off", callback_data="k_light_off")]]) ddd = bot.sendMessage(chat_id=update.message.chat_id, text="Do you want to turn On or Off light?", reply_markup=reply_markup) if __name__ == "__main__": # updater = Updater(token=tokenid) ### Handler groups dispatcher = updater.dispatcher # light k_light_handler = CommandHandler('light', k_light_h) dispatcher.add_handler(k_light_handler) # errors updater.dispatcher.add_error_handler(error) updater.start_polling() # Run the bot until the user presses Ctrl-C or the process receives SIGINT, # SIGTERM or SIGABRT updater.idle() </code></pre> <p>When I run it I have an error:</p> <pre><code>telegram.ext.dispatcher - WARNING - A TelegramError was raised while processing the Update. root - WARNING - Update ... ... caused error "u'Bad Request: message identifier is not specified'" </code></pre> <p>I checked var <em>update.callback_query.inline_message_id</em> and it was empty. When I tried <em>bot.editMessageText</em> with hardcoded vars <em>chat_id</em> and <em>message_id</em> it worked well.</p> <p>Do I need save in DB (for all users) vars <em>chat_id</em> and <em>message_id</em> when they run command /light and then when they press inline button I need read from DB this value or I can use some simpler method for editing messages?</p>
0
ASP.Net Core maxUrlLength
<p>Is there a way to set a maxUrlLength configuration value in Asp.Net Core? I see how this is done in web.config in earlier versions of the framework, for example:</p> <p><a href="https://stackoverflow.com/questions/8245843/how-do-i-increase-the-maxurllength-property-in-the-config-in-asp-net-mvc-3">How do I increase the maxUrlLength property in the config in asp.net MVC 3?</a></p> <p>However, this doesn't seem to work in ASP.Net Core....</p>
0
How to remove a subset of a data frame in Python?
<p>My dataframe df is 3020x4. I'd like to remove a subset df1 20x4 out of the original. In other words, I just want to get the difference whose shape is 3000x4. I tried the below but it did not work. It returned exactly df. Would you please help? Thanks.</p> <pre><code>new_df = df.drop(df1) </code></pre>
0
How to enable-disable input type="text" when select value from dropdown list
<p>I have a drop-down list) and one is input type="text". what i want if i select value{2,3} from drop down list not first value then input type will be disabled and if i select again first value then it will be enable.</p>
0
how to create nxn matrix/array in javascript?
<p>I want to create an array or matrix with non-fixed number of rows like <br></p> <pre><code>var matrix=[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]] </code></pre> <p>how can i do that?</p>
0
swift ios add infinite scroll pagination to uitableview
<p>I wonder if tableview has any built-in function to add infinite scroll/pagination.</p> <p>Right now my VC looks like this:</p> <pre><code>var data: JSON! = [] override func viewDidLoad() { super.viewDidLoad() //Init start height of cell self.tableView.estimatedRowHeight = 122 self.tableView.rowHeight = UITableViewAutomaticDimension self.tableView.delegate = self self.tableView.dataSource = self savedLoader.startAnimation() //Load first page loadSaved(1) } func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int { return data.count } func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("aCell") as! SavedTableViewCell let info = data[indexPath.row] cell.configureWithData(info) return cell } func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { performSegueWithIdentifier("WebSegue", sender: indexPath) tableView.deselectRowAtIndexPath(indexPath, animated: false) } </code></pre> <p>I fetch my data using <strong>loadSaved(1)</strong> by giving the function the current page I want to load. The function makes a API request using alomofire then populate the <strong>var data: JSON! = []</strong> with the data that should be displayed</p> <p>So what I want to do is when I scroll to the bottom of the tableview <strong>loadSaved(2)</strong> should be called loading more data into the tableview</p>
0
'CGPointMake' is unavailable in swift
<p>I have a Gradient class which I am trying to convert to Swift 3 but I get the following error</p> <blockquote> <p>'CGPointMake' is unavailable in swift</p> </blockquote> <p>for </p> <pre><code>func configureGradientView() { let color1 = topColor ?? self.tintColor as UIColor let color2 = bottomColor ?? UIColor.black as UIColor let colors: Array &lt;AnyObject&gt; = [ color1.cgColor, color2.cgColor ] let layer = self.layer as! CAGradientLayer layer.colors = colors layer.startPoint = CGPointMake(startX, startY) layer.endPoint = CGPointMake(endX, endY) } </code></pre> <p>Can anyone help me out with what I can use instead of <code>CGPointMake</code> </p> <p>Here's the full class; </p> <pre><code>@IBDesignable public class XGradientView: UIView { @IBInspectable public var topColor: UIColor? { didSet { configureGradientView() } } @IBInspectable public var bottomColor: UIColor? { didSet { configureGradientView() } } @IBInspectable var startX: CGFloat = 0.0 { didSet{ configureGradientView() } } @IBInspectable var startY: CGFloat = 1.0 { didSet{ configureGradientView() } } @IBInspectable var endX: CGFloat = 0.0 { didSet{ configureGradientView() } } @IBInspectable var endY: CGFloat = 0.0 { didSet{ configureGradientView() } } public class func layeredClass() -&gt; AnyClass { return CAGradientLayer.self } public required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder)! configureGradientView() } override init(frame: CGRect) { super.init(frame: frame) configureGradientView() } public override func tintColorDidChange() { super.tintColorDidChange() configureGradientView() } func configureGradientView() { let color1 = topColor ?? self.tintColor as UIColor let color2 = bottomColor ?? UIColor.black as UIColor let colors: Array &lt;AnyObject&gt; = [ color1.cgColor, color2.cgColor ] let layer = self.layer as! CAGradientLayer layer.colors = colors layer.startPoint = CGPointMake(startX, startY) layer.endPoint = CGPointMake(endX, endY) } } </code></pre>
0
Extract string within parentheses - PYTHON
<p>I have a string "Name(something)" and I am trying to extract the portion of the string within the parentheses! </p> <p>Iv'e tried the following solutions but don't seem to be getting the results I'm looking for. </p> <pre><code>n.split('()') name, something = n.split('()') </code></pre>
0
Observable with Async Pipe in template is not working for single value
<p>I have a component that asks my service for an Observable object (that is, the underlying http.get returns one single object).</p> <p>The object (an observable) is used in conjunction with an async pipe in my template. Unfortunately, I get an error:</p> <blockquote> <p>Cannot read property 'lastname' of null</p> </blockquote> <p>I have been breaking my head on this one. A similar type of code works correctly on a list of objects (in conjunction with *ngFor).</p> <pre class="lang-html prettyprint-override"><code>&lt;li&gt;{{(person | async)?.lastname}}&lt;/li&gt; </code></pre> <p>Method in my service:</p> <pre class="lang-js prettyprint-override"><code>getPerson(id: string): Observable&lt;Person&gt; { let url = this.personsUrl + &quot;/&quot; + id; return this.http.get(url, {headers: new Headers({'Accept':'application/json'})}) .map(r =&gt; r.json()) .catch(this.handleError); //error handler } </code></pre> <p>In my component:</p> <pre class="lang-js prettyprint-override"><code>//... imports omitted @Component({ moduleId: module.id, selector: 'app-details-person', templateUrl: 'details-person.component.html', styleUrls: ['details-person.component.css'], }) export class DetailsPersonComponent implements OnInit, OnDestroy { person: Observable&lt;Person&gt;; sub: Subscription; constructor(private personService: PersonService, private route: ActivatedRoute) { } ngOnInit() { this.sub = this.route.params.subscribe(params =&gt; { let persId = params['id']; this.person = this.personService.getPerson(persId); }); } ngOnDestroy(): void { this.sub.unsubscribe(); } } </code></pre> <p>Apparently the observable is/returns a null object value in the pipe. I have checked if I am really getting a nonempty Observable from my service and I can confirm that there exists an (underlying) object returned from my service.</p> <p>Of course, I could subscribe to the observable in my component after having retrieved the Observable from the service, but I would really like to use the async construct.</p> <p>Btw, another question: Is there already a pattern on how to handle errors that occur in the async pipe? (A downside of using async pipes.... errors are delayed until rendering time of the view.</p>
0
how to use path-to-regexp to match all paths that's not starting with /api/?
<p>when using <a href="https://github.com/pillarjs/path-to-regexp" rel="noreferrer">path-to-regexp</a>, how to match all path that not starting with <code>/api/</code>?</p> <p>By using native JavaScript RegExp <code>/^(?!\/api\/).*/</code>will match<code>/x/y/z</code>. see test result from <a href="https://regex101.com/#javascript" rel="noreferrer">here</a> <a href="https://i.stack.imgur.com/rZe1k.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rZe1k.png" alt="enter image description here"></a></p> <p>However, it does not work with path-to-regexp. see the test result from <a href="http://forbeslindesay.github.io/express-route-tester/" rel="noreferrer">there</a></p> <p><a href="https://i.stack.imgur.com/EvwPF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/EvwPF.png" alt="enter image description here"></a></p> <p><strong>So what's the correct way to achieve my goal in path-to-regexp?</strong></p> <p><strong>[Update 1]</strong></p> <p>More details: The real case is that I'm using angular2 + koajs. And in angular2, browser may issue a client routing url to server. Please see my <a href="https://stackoverflow.com/questions/39096211/whats-the-right-way-to-set-routing-for-angular2-with-koajs">another question</a> about this.</p> <p>To address that issue, as suggested by @mxii, I'm trying to use <a href="https://github.com/xsmallbird/koa-repath" rel="noreferrer">koa-repath</a> to redirect all requests that not started with <code>/api/</code> to the root url: <code>http://localhost:3000/</code>excepte it's static assets (js/json/html/png/...) requests.</p> <p>And <code>koa-repath</code> use <code>path-to-regexp</code> to match the path. That's why I asked this question.</p>
0
Set a connectionString for a PostgreSQL database in Entity Framework outside the app.config
<p>I have a database build with PostgreSQL, which I access through Entity Framework 6.</p> <p>Until recently it ran smoothly through an <code>app.config</code> connectionString:</p> <pre><code>&lt;connectionStrings&gt; &lt;add name="fancyName" connectionString="Host=localhost; user id=allCanSee; password=notSoSecret; database=notHidden" providerName="Npgsql" /&gt; &lt;/connectionStrings&gt; </code></pre> <p>Our lead programmer is not happy about an open connectionString, since every computer we install the software on can read it. We therefore encrypted everything, and stored the encryption in the <code>app.config</code>.</p> <p>Now I have a new problem - I have accessed my database the following way:</p> <pre><code>public class VersionContext { public virtual DbSet&lt;DatabaseNumber&gt; DatabaseVersion { get; set; } public VersionContext() : base("name=fancyName") { System.Data.Entity.Database.SetInitializer&lt;DatabaseContext&gt;(null); } } </code></pre> <p>But since my <code>app.config</code> no longer contains the connectionString, I must tell the database where to look.</p> <p>My current attempt is something like this:</p> <pre><code>public static class VersionContextConnection { public static string GetConnectionString() //Accessable form everywhere { var providerName = "Npgsql"; var databaseName = decryptedName; var userName = decryptedUserName; var password = decryptedPassword; var host = decryptedHostName var port = 5432; return $"Provider={providerName}; " + $"Server={host}; " + $"Port={port}; " + $"User Id={userName}; " + $"Password={password}; " + $"Database={databaseName};"; } } public class VersionContext : DbContext { public virtual DbSet&lt;DatabaseNumber&gt; DatabaseVersion { get; set; } public VersionContext() : base(VersionContextConnection.GetConnectionString()) { System.Data.Entity.Database.SetInitializer&lt;DatabaseContext&gt;(null); } } </code></pre> <p>Then I'd access it as follow:</p> <pre><code>using (var context = new VersionContext()) { var entry = context.DatabaseVersion.FirstOrDefault(); ... } </code></pre> <p>But this gives an exception from <code>System.Data</code> saying <code>Keyword not supported: 'provider'.</code></p> <p>Removing <code>provider</code> from the connectionString gives another exception: <code>Keyword not supported: 'port'.</code></p> <p>Removing <code>port</code> from the connectionString gives a third exception from <code>.Net SqlClient Data Provider</code>: <code>Login failed for user 'secretSecret'.</code></p> <p>So - how do I set my connectionString, if it's not set through the <code>:base(connectionString)</code> property?</p>
0
Background image, mobiles and media query
<p>I'm trying to make it responsive to mobiles. I have background image that won't correctly resize. I've tried a media query and have no idea why it doesn't work. My code if below;</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.container3{ display: flex; align-items: center; background-size: cover; height: 700px; text-shadow: 0.25px 0.25px 0.25px #000000; background-image: url('Images/homepage.jpg'); -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; } @media all and (max-width:480px)and(min-width:0px) { .container3 { width: 100%; background-image: url('Images/homepage.jpg'); } }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt; &lt;title&gt;Unity&lt;/title&gt; &lt;link href="Style.css" rel="stylesheet"/&gt; &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"/&gt; &lt;meta name="viewport" content="width=500, initial-scale=1"&gt; &lt;body&gt; &lt;div class="container3"&gt; &lt;div class="title"&gt; &lt;h1&gt; bringing people together &lt;/h1&gt; &lt;p&gt;free advertising space&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p>
0
Retrofit 404 not found web api
<p>I have a web api and an application. So I want to a Register app but I have a problem. I use the azure. There is my registerapi (interface)</p> <pre><code>@FormUrlEncoded @POST("/application/json") public void insertUser( @Field("Username") String Username, @Field("Password") String Password, @Field("Email") String Email, Callback&lt;Response&gt; callback); </code></pre> <p>and my mainactivty.java page</p> <pre><code>public class MainActivity extends AppCompatActivity { private EditText editTextUsername; private EditText editTextPassword; private EditText editTextEmail; private Button buttonRegister; final public static String ROOT_URL = "http://bsapmusic.azurewebsites.net/api/music/register"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); editTextUsername = (EditText) findViewById(R.id.etusername); editTextPassword = (EditText) findViewById(R.id.etpassword); editTextEmail = (EditText) findViewById(R.id.etmail); buttonRegister = (Button) findViewById(R.id.btnkayit); buttonRegister.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { insertUser(); } }); } private void insertUser() { RestAdapter adapter =new RestAdapter.Builder().setEndpoint(ROOT_URL).build(); RegisterAPI api = adapter.create(RegisterAPI.class); api.insertUser( editTextUsername.getText().toString(), editTextPassword.getText().toString(), editTextEmail.getText().toString(), new Callback&lt;Response&gt;() { @Override public void success(Response result, Response response) { BufferedReader reader = null; String output = ""; try{ reader=new BufferedReader(new InputStreamReader(result.getBody().in())); output=reader.readLine(); } catch (IOException e){ e.printStackTrace(); } Toast.makeText(MainActivity.this,output,Toast.LENGTH_LONG).show(); } @Override public void failure(RetrofitError error) { Toast.makeText(MainActivity.this, error.toString(),Toast.LENGTH_LONG).show(); } }); }; </code></pre> <p>and I get retrofit 404 not found.</p>
0
Spark assign value if null to column (python)
<p>Assuming that I have the following data</p> <pre><code>+--------------------+-----+--------------------+ | values|count| values2| +--------------------+-----+--------------------+ | aaaaaa| 249| null| | bbbbbb| 166| b2| | cccccc| 1680| something| +--------------------+-----+--------------------+ </code></pre> <p>So if there is a null value in <code>values2</code> column how to assign the <code>values1</code> column to it? So the result should be:</p> <pre><code>+--------------------+-----+--------------------+ | values|count| values2| +--------------------+-----+--------------------+ | aaaaaa| 249| aaaaaa| | bbbbbb| 166| b2| | cccccc| 1680| something| +--------------------+-----+--------------------+ </code></pre> <p>I thought of something of the following but it doesnt work:</p> <pre><code>df.na.fill({"values2":df['values']}).show() </code></pre> <p>I found this way to solve it but there should be something more clear forward:</p> <pre><code>def change_null_values(a,b): if b: return b else: return a udf_change_null = udf(change_null_values,StringType()) df.withColumn("values2",udf_change_null("values","values2")).show() </code></pre>
0
Python - Check if a string contains multiple words
<p>I'm wondering if there was a function in Python 2.7 that checks to see if a string contains multiple words (as in words with spaces/punctuation marks between them), similar to how <code>.isalpha()</code> checks to see if a string contains only letters?</p> <p>For example, if something along the lines of this exists...</p> <pre><code>var_1 = "Two Words" if var_1.containsmultiplewords(): print "Yes" </code></pre> <p>And then "Yes" would be the output.</p> <p>Thanks!</p>
0
Nodejs: Convert Doc to PDF
<p>I found some repos, which do not look as they are still maintained:</p> <ul> <li><a href="https://github.com/gfloyd/node-unoconv" rel="noreferrer">https://github.com/gfloyd/node-unoconv</a></li> <li><a href="https://github.com/skmp/node-msoffice-pdf" rel="noreferrer">https://github.com/skmp/node-msoffice-pdf</a> ...</li> </ul> <p>I tried the <a href="https://stackoverflow.com/questions/20959262/convert-microsoft-documents-into-pdf-with-nodejs">approach</a> with <code>libreoffice</code>, but the pdf output is so bad, that it is not useable (text on diff. pages etc.).</p> <p>If possible I would like to avoid starting any background processes and/or saving the file on the server. Best would be solution where I can use buffers. For privacy reasons, I cannot use any external service.</p> <p><code>doc buffer -&gt; pdf buffer</code></p> <h2>Question:</h2> <p>How to convert docs to pdf in nodejs?</p>
0
WooCommerce action hooks and overriding templates
<p>I have started to learn how to create templates with WooCommerce and I had faced with a little problem. For instance, in the php file content-single-product.php of Woocommerce plugin I have strings like that:</p> <pre><code> &lt;?php /** * woocommerce_single_product_summary hook. * * @hooked woocommerce_template_single_title - 5 * @hooked woocommerce_template_single_rating - 10 * @hooked woocommerce_template_single_price - 10 * @hooked woocommerce_template_single_excerpt - 20 * @hooked woocommerce_template_single_add_to_cart - 30 * @hooked woocommerce_template_single_meta - 40 * @hooked woocommerce_template_single_sharing - 50 */ do_action( 'woocommerce_single_product_summary' ); ?&gt; </code></pre> <p>And for example, when I want to edit this (delete some fields and change the structure) I try erase the string:</p> <blockquote> <p>do_action( 'woocommerce_single_product_summary' );</p> </blockquote> <p>and after that write like this:</p> <pre><code>&lt;?php /** * woocommerce_single_product_summary hook. * * @hooked woocommerce_template_single_title - 5 * @hooked woocommerce_template_single_rating - 10 * @hooked woocommerce_template_single_price - 10 * @hooked woocommerce_template_single_excerpt - 20 * @hooked woocommerce_template_single_add_to_cart - 30 * @hooked woocommerce_template_single_meta - 40 * @hooked woocommerce_template_single_sharing - 50 */ //do_action( 'woocommerce_single_product_summary' ); do_action('woocommerce_template_single_title'); ?&gt; </code></pre> <p>Could you tell me please why this doesn't work?</p> <p>What is the right way to edit like that?</p> <p>Thanks</p>
0
Webpack dist folder not getting created in project folder?
<p>Everything running fine, but could not able to find where is my dist folder.I am using publicPath as per documentation, still dist folder seems to coming from memory.</p> <p>This might be small issue, i am new to webpack. Any help would work</p> <p>Below is my webpack.config.js file</p> <pre><code>var path = require('path') var webpack = require('webpack') var HtmlWebpackPlugin = require('html-webpack-plugin') module.exports = { entry: "./src/index.js", output: { path: path.join(__dirname,'dist'), filename: "[name].js", publicPath:'/dist' }, plugins: [ new HtmlWebpackPlugin({ template: './src/index.html' }) ], module: { loaders: [ { test: /\.css$/, loader: "style-loader!css-loader" }, { test: /\.(eot|woff|woff2|ttf|svg|png|jpg)$/, loader: 'url-loader?limit=30000&amp;name=[name]-[hash].[ext]' }, { test: /\.js$/, exclude: /(node_modules|bower_components)/, loader: 'babel', query: { presets: ['es2015', 'react', 'stage-2'] } } ] }, devServer: { historyApiFallback: true, stats:'error-only' } }; </code></pre> <p>My package.json file is </p> <pre><code>{ "name": "tryout", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "mocha './tests/**/*.test.js' --compilers js:babel-core/register --recursive", "start-dev-server": "webpack-dev-server --content-base dist/ --port 6969", "s": "npm run start-dev-server", "test:watch": "npm test -- --watch" }, "author": "", "license": "ISC", "dependencies": { "babel-core": "^6.13.2", "babel-loader": "^6.2.4", "babel-polyfill": "^6.13.0", "babel-preset-es2015": "^6.13.2", "babel-preset-react": "^6.11.1", "babel-preset-stage-2": "^6.13.0", "es6-promise": "^3.2.1", "file-loader": "^0.9.0", "html-webpack-plugin": "^2.22.0", "isomorphic-fetch": "^2.2.1", "lodash": "^4.15.0", "react": "^15.3.0", "react-dom": "^15.3.0", "react-redux": "^4.4.5", "react-router": "^2.6.1", "react-router-redux": "^4.0.5", "redux": "^3.5.2", "redux-thunk": "^2.1.0", "url-loader": "^0.5.7", "webpack": "^1.13.1", "webpack-dev-server": "^1.14.1" }, "devDependencies": { "babel-register": "^6.11.6", "css-loader": "^0.23.1", "enzyme": "^2.4.1", "expect": "^1.20.2", "mocha": "^3.0.2", "nock": "^8.0.0", "react-addons-test-utils": "^15.3.1", "redux-mock-store": "^1.1.4", "style-loader": "^0.13.1" } } </code></pre>
0
Download Excel file using jquery ajax
<p>Hi i want to download XLX file using spring mvc ajax call.Below is my ajax call to server.</p> <pre><code> $.ajax({ type : 'GET', url : 'downloadExcel', beforeSend : function() { startPreloader(); }, complete: function(){ stopPreloader(); }, success : function(response){ console.log(response); var blob = new Blob([response], { type: 'application/vnd.ms-excel' }); var downloadUrl = URL.createObjectURL(blob); var a = document.createElement("a"); a.href = downloadUrl; a.download = "downloadFile.xlsx"; document.body.appendChild(a); a.click(); } }); </code></pre> <p>Here is my server code</p> <pre><code>@RequestMapping(value = "/downloadExcel", method = RequestMethod.GET) @ResponseBody public List&lt;LicenceType&gt; downloadExcel() { return licenceTypeService.findAllLicenceType(); } </code></pre> <p>My code actually download the excel file, but on the excel sheet it showing like <code>[Object][Object]</code></p>
0
How to change object keys in deeply nested object with lodash?
<p>I have a following kind of object:</p> <pre><code>{ options: [ { id: 1, value: 'a' } ], nestedObj: { options: [ { id: 2, value: 'b' } ] } } </code></pre> <p>How do I change the key 'id' on both, options array in first level and in the nested level? I have tried to use lodash for this but not have been able to get the desired result:</p> <pre><code>{ options: [ { newKey: 1, value: 'a' ], nestedObj: { options: [ { newKey: 2, value: 'b' } ] } } </code></pre> <p>So I would like to find a function which works like <a href="https://lodash.com/docs#mapKeys" rel="noreferrer">lodash mapKeys</a> but would iterate through deep nested object.</p>
0
Is it possible to delete all comments in my code, in Android Studio?
<p>I've been working on a project in the Android Studio, and it has a lot of comments in it. Is it possible to delete all the comments (both single line <code>//</code> and multi-line <code>/*</code>) in the code? Preferably, without dealing with regular expressions.</p>
0
Developing spring boot application with lower footprint
<p>In an attempt to keep our microservices, developed in spring-boot to run on Cloud Foundry, smaller in footprint, we are looking for best approach to achieve the same.</p> <p>Any inputs or pointers in this direction will be most welcomed.</p> <p>It's surely the best that one always builds the application upwards starting from bare minimum dependencies, and the add any more only when required. Is there more of good practices to follow to further keep the application smaller in size?</p>
0
How to detect when iOS app appears in foreground, with Swift?
<p>I need to detect when my app becomes visible? (for example by double tapping the Home button and then tapping on an app that is already in the background) If possible, I would like to detect that event inside my UIViewController. I am working with Swift 2.2.</p>
0
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_.AppDelegate add:]: unrecognized selector
<p>I created a storyboard called Main.storyboard and created a AddBtnViewController with storyboard ID "addBtnVC". In the App Delegate, I initialized a tab bar with three view controllers programmatically. For one of tab bar view controllers, I created an add button that would transition to the AddBtnViewController programmatically. However, I received this error: </p> <pre><code>uncaught exception 'NSInvalidArgumentException', reason: '-[_.AppDelegate add:]: unrecognized selector sent to instance 0x7f91cb422a30' </code></pre> <p>My code:</p> <pre><code>class AppDelegate: UIResponder, UIApplicationDelegate { func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -&gt; Bool { //Make add btn for View Controller 1 of Navigation Bar let addBtn = UIButton(frame: CGRectMake(0, 0, 30, 30)) addBtn.addTarget(self, action: #selector(ViewController1.add), forControlEvents: .TouchUpInside) let rightBarButton = UIBarButtonItem() rightBarButton.customView = addBtn NavController.navigationBar.topItem?.rightBarButtonItem = rightBarButton return true } } class ViewController1: UIViewController { let addBtnVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("addBtnVC") func add(sender: UIButton!) { if let addBtnVC = storyboard!.instantiateViewControllerWithIdentifier("addBtnVC") as? AddBtnViewController { presentViewController(addBtnVC, animated: true, completion: nil) } } } </code></pre> <p>How do I fix this error?</p> <p>For posterity:</p> <pre><code>class AppDelegate: UIResponder, UIApplicationDelegate { func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -&gt; Bool { let VC1 = UIViewController() //Make add btn for View Controller 1 of Navigation Bar let addBtn = UIButton(frame: CGRectMake(0, 0, 30, 30)) addBtn.addTarget(VC1, action: #selector(VC1.add(_:)), forControlEvents: .TouchUpInside) let rightBarButton = UIBarButtonItem() rightBarButton.customView = addBtn NavController.navigationBar.topItem?.rightBarButtonItem = rightBarButton return true } } class ViewController1: UIViewController { let addBtnVC:AddButtonViewController = AddButtonViewController() func add(sender: UIButton!) { let navController = UINavigationController(rootViewController: addBtnVC) navController.navigationBar.tintColor = colorPalette.red self.presentViewController(navController, animated: true, completion: nil) } } </code></pre>
0
curl command syntax for windows
<p>I have the following command which works well on Linux, but not on windows. I am not able to find any doc for curl syntax for windows. I experimented with the quotes .. but still not working. Can anyone help me with this command so that I can use it on Windows ( I have installed curl.exe in c drive)</p> <pre><code>curl -X POST -H "Content-Type: application/json" -H "X-Cachet-Token: secret" http://somegoodserver/api/v1/incidents -d '{"name":"Test","message":"Test message","status":"1"}' </code></pre> <p>The error I get is: </p> <pre><code>"status":400,"title":"Bad Request","detail":"The request cannot be fulfilled due to bad syntax.","meta": {"details":["The name format is invalid.","The status format is invalid.","The message format is invalid."]}}]} </code></pre>
0
How check if type is class?
<p>In .Net we have <code>Type.IsClass</code> to check if a type is a class using <code>System.Reflection</code>.</p> <p>But in <em>.Net Core</em> no. So, how can I check?</p>
0
Hive: LEFT JOIN vs JOIN gives different results with filter in ON clause
<p>Suppose two tables:</p> <pre><code> table1.c1 table1.c2 1 1 A 2 1 B 3 1 C 4 2 A 5 2 B </code></pre> <p>and </p> <pre><code> table2.c1 table2.c2 1 2 A 2 2 D 3 3 A 4 3 B </code></pre> <p>When I do:</p> <pre><code>select distinct t1.c1, t2.c2 from schema.table1 t1 join schema.table2 t2 on (t1.c2 = t2.c2 and t1.c1 = t2.c1 and t1.c1 = 2) </code></pre> <p>in Hive, I get:</p> <pre><code> t1.c1 t2.c2 1 2 A </code></pre> <p>This is the expected result, no problem. But, when I do:</p> <pre><code>select distinct t1.c1, t2.c2 from schema.table1 t1 left join schema.table2 t2 on (t1.c2 = t2.c2 and t1.c1 = t2.c1 and t1.c1 = 2) </code></pre> <p>I get: </p> <pre><code> t1.c1 t2.c2 1 1 NULL 2 2 NULL 3 2 A </code></pre> <p>So, filter in ON clause seems not to work like I had expected. The filters <code>t1.c1 = t2.c1</code> and <code>t1.c1 = 2</code> hasn't been applied when, in the LEFT JOIN, it doesn't find the key on the second table so <code>t2.c2</code> is <code>NULL</code>.</p> <p>I suppose that the answer must be in <a href="https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Joins" rel="nofollow">doc</a> (May be in the 'Joins occur BEFORE WHERE CLAUSES' section?) But still I don't understand the difference.</p> <p>How is the process to give different results? </p>
0
How to disable specific dates in bootstrap-datetimepicker-master?
<pre><code>$(".datepicker").datetimepicker({ format: 'MM dd hh:ii P', startDate: "2016-08-19 10:00", daysOfWeekDisabled: [1,2,3,4,5], autoclose: true, }); </code></pre> <p>How to disable specific date in datetime picker?</p>
0
Specifying password in MySQL connection string
<p>I created ExpressJS MVC app using MySQL as DB with Yeoman generator and in <code>config.js</code> I want to change MySQL connection strings, but I don't know to specify password in string.</p> <p>my string is <code>mysql://root@localhost:3306/</code></p> <p>Please help me.</p>
0
How can I use properties from a configuration (properties/yml) file in my Spring Boot application?
<p>how can I use external configurations within my Spring application?</p> <pre><code>package hello.example2.Container import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RestController import org.springframework.web.client.RestTemplate @RestController class ContainerController { @RequestMapping("/container/{cid}") public list(@PathVariable Integer cid) { def template = new RestTemplate(); def container = template.getForObject("http://localhost:5050/container/" + cid.toString(), Container); return container; } } </code></pre> <p>I want to replace "<a href="http://localhost:5050" rel="noreferrer">http://localhost:5050</a>" with a configuration option (f.e. application.yml or application.properties).</p> <p>This is my application file (Groovy):</p> <pre><code>package hello.example2 import groovy.transform.CompileStatic import org.springframework.boot.SpringApplication import org.springframework.boot.autoconfigure.EnableAutoConfiguration import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.context.annotation.Configuration @SpringBootApplication @Configuration @EnableAutoConfiguration @CompileStatic class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } </code></pre> <p>I tried to set "@Configuration" and "@EnableAutoConfiguration" but to be honest I don't know what they are doing. I'm new to Java/Groovy and the Spring framework (but not to programming in general).</p> <p>I have read these pages but there is no complete example only snippets:</p> <p>[1] <a href="http://docs.spring.io/spring-boot/docs/current/reference/html/howto-properties-and-configuration.html" rel="noreferrer">http://docs.spring.io/spring-boot/docs/current/reference/html/howto-properties-and-configuration.html</a></p> <p>[2] <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html" rel="noreferrer">https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html</a></p>
0
How can I get integer solutions with scipy.optimize.linprog?
<p>When I solve the problem of Linear Programming, like in the following formula, <strong>I want the result of x all to be int type</strong></p> <p>Consider the following problem:</p> <p>Minimize: <code>f = -1*x[0] + 4*x[1]</code></p> <p>Subject to: </p> <pre><code>-3*x[0] + 1*x[1] &lt;= 6 1*x[0] + 2*x[1] &lt;= 4 x[1] &gt;= -3 </code></pre> <p>where: <code>-inf &lt;= x[0] &lt;= inf</code></p> <p><em>next is the python coder</em></p> <pre><code>&gt;&gt;&gt; c = [-1, 4] &gt;&gt;&gt; A = [[-3, 1], [1, 2]] &gt;&gt;&gt; b = [6, 4] &gt;&gt;&gt; x0_bounds = (None, None) &gt;&gt;&gt; x1_bounds = (-3, None) &gt;&gt;&gt; res = linprog(c, A_ub=A, b_ub=b, bounds=(x0_bounds, x1_bounds), ... options={"disp": True}) &gt;&gt;&gt; print(res) Optimization terminated successfully. Current function value: -11.428571 Iterations: 2 status: 0 success: True fun: -11.428571428571429 x: array([-1.14285714, 2.57142857]) message: 'Optimization terminated successfully.' nit: 2 </code></pre>
0
VBA Change the text color in MsgBox
<p>I want to change the font color from MsgBox</p> <p>To understand what I want, I chose this exemple:</p> <pre><code>Dim a As Integer Dim b As Integer Dim c As Integer Dim results As String a = InputBox("Enter your first value:") b = InputBox("Enter your second value:") c = InputBox("Enter your third value:") d = a - b + c If d = 0 Then results = "Correct" MsgBox "Your results is: " &amp; results Else results = "Incorrect" MsgBox " Your Results is: " &amp; results End If </code></pre> <p>The "Correct" text I want to be in green when it appears in <code>MsgBox</code>; the "Incorrect" text I want to be in red when it appears in <code>MsgBox</code></p> <p>I hope what I have requested is possible.</p>
0
ggplot: how to add common x and y labels to a grid of plots
<p>Using <code>diamonds</code>, I want to plot <code>carat</code> vs <code>price</code> for 4 levels (<code>Fair</code>, <code>Good</code>, <code>Very Good</code> and <code>Premimum</code>) of <code>cut</code>. </p> <p>Instead of allowing <code>facet_wrap()</code>to control the breaks in the axes, I made four plots to control the breaks in axes. </p> <pre><code>library(ggplot2) library(egg) library(grid) f1 &lt;- ggplot(diamonds[diamonds$cut=="Fair",], aes(carat, price))+ geom_point()+ facet_wrap(~cut, ncol =2)+ scale_x_continuous(limits = c(0,4), breaks=c(0, 1, 2, 3, 4))+ scale_y_continuous(limits = c(0,10000), breaks=c(0, 2500, 5000, 7500, 10000))+ labs(x=expression(" "), y=expression(" ")) f2 &lt;- ggplot(diamonds[diamonds$cut=="Good",], aes(carat, price))+ geom_point()+ facet_wrap(~cut, ncol =2)+ scale_y_continuous(limits = c(0,5000), breaks=c(0, 1000, 2000, 3000, 4000, 5000))+ labs(x=expression(" "), y=expression(" ")) f3 &lt;- ggplot(diamonds[diamonds$cut=="Very Good",], aes(carat, price))+ geom_point()+ facet_wrap(~cut, ncol =2)+ scale_x_continuous(limits = c(0,1), breaks=c(0, 0.2, 0.4, 0.6, 0.8, 1))+ scale_y_continuous(limits = c(0,1000), breaks=c(0, 200, 400, 600, 800, 1000))+ labs(x=expression(" "), y=expression(" ")) f4 &lt;- ggplot(diamonds[diamonds$cut=="Premium",], aes(carat, price))+ geom_point()+ facet_wrap(~cut, ncol =2)+ scale_x_continuous(limits = c(0,1.5), breaks=c(0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4))+ scale_y_continuous(limits = c(0, 3000), breaks=c(0, 500, 1000, 1500, 2000, 2500, 3000))+ labs(x=expression(" "), y=expression(" ")) fin_fig &lt;- ggarrange(f1, f2, f3, f4, ncol =2) fin_fig </code></pre> <p><strong>RESULT</strong></p> <p><em>Each plot has a range of different y values</em> </p> <p><a href="https://i.stack.imgur.com/3XPY0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3XPY0.png" alt="enter image description here"></a></p> <p><strong>QUESTION</strong></p> <p>In all facets, x and y axes are the same. The only difference is the min, max and the breaks. I want to add x and y labels to this figure. I can do this manually in any word document or image editor. Is there anyway to do it in R directly?</p>
0
How to plot dates on the x-axis using Seaborn (or matplotlib)
<p>I have a csv file with some time series data. I create a Data Frame as such:</p> <pre><code>df = pd.read_csv('C:\\Desktop\\Scripts\\TimeSeries.log') </code></pre> <p>When I call <code>df.head(6)</code>, the data appears as follows:</p> <pre><code>Company Date Value ABC 08/21/16 00:00:00 500 ABC 08/22/16 00:00:00 600 ABC 08/23/16 00:00:00 650 ABC 08/24/16 00:00:00 625 ABC 08/25/16 00:00:00 675 ABC 08/26/16 00:00:00 680 </code></pre> <p>Then, I have the following to force the 'Date' column into datetime format:</p> <pre><code>df['Date'] = pd.to_datetime(df['Date'], errors = 'coerce') </code></pre> <p>Interestingly, I see "<code>pandas.core.series.Series</code>" when I call the following:</p> <pre><code>type(df['Date']) </code></pre> <p>Finally, I call the following to create a plot:</p> <pre><code>%matplotlib qt sns.tsplot(df['Value']) </code></pre> <p>On the x-axis from left to right, I see integers ranging from 0 to the number of rows in the data frame. How does one add the 'Date' column as the x-axis values to this plot?</p> <p>Thanks! </p>
0
Running simple python script continuously on Heroku
<p>I have simple python script which I would like to host on Heroku and run it every 10 minutes using Heroku scheduler. So can someone explain me what I should type on the rake command at the scheduler and how I should change the Procfile of Heroku?</p>
0
ASP.NET Core initialize singleton after configuring DI
<p>So let's say I have a singleton class instance that I register in the DI like this:</p> <pre><code>services.AddSingleton&lt;IFoo, Foo&gt;(); </code></pre> <p>And let's say the <code>Foo</code> class has a number of other dependencies (mostly repository classes that allow it to load data). </p> <p>With my current understanding, the Foo instance is not created until it's first used (asked). Is there a way to initialize this class other than the constructor? Like right after <code>ConfigureServices()</code> completes? Or should the initialization code (loading data from db) be done in Foo's constructor?</p> <p>(It would be nice if this class could load its data before the first use to speed up first time access)</p>
0
Where can I download rt.jar for Java 7?
<p>I've been looking for a couple hours, and I can't find the Java rt.jar file anywhere online for download. I would appreciate a link to it, as I am new to Java, and I'm going to be using Netbeans for my new Java programming class.</p> <p>Thanks in advance. </p>
0
How to wait for FirebaseAuth to finish initializing?
<p>Integrated Firebase Authentication to my app. Everything seems to be fine, until I noticed the issue wherein I open the app, it shows me the login screen, even though there is already a user signed in. </p> <p>Exiting the app and launching it again solves the problem (app no longer asks the user to sign in again), though it provides the users a very bad experience.</p> <p>I've read the docs, and apparently, calling <code>FirebaseAuth.getInstance().getCurrentUser()</code> might return null if auth haven't finished initializing. I'm assuming that's the reason why the issue happens. So I wonder if there is a way to wait for FirebaseAuth to finish its initialization before I can call getCurrentUser()?</p>
0
read.csv() with UTF-8 encoding
<p>I am trying to read in data from a csv file and specify the encoding of the characters to be UTF-8. From reading through the ?read.csv() instructions, it seems that fileEncoding set equal to UTF-8 should accomplish this, however, I am not seeing that when checking. Is there a better way to specify the encoding of character strings to be UTF-8 when importing the data? </p> <p>Sample Data: </p> <p><a href="https://spaces.hightail.com/space/pwWp9" rel="noreferrer">Download Sample Data here</a></p> <pre><code>fruit&lt;- read.csv("fruit.csv", header = TRUE, fileEncoding = "UTF-8") fruit[] &lt;- lapply(fruit, as.character) Encoding(fruit$Fruit) </code></pre> <p>The output is "uknown" but I would expect this to be "UTF-8". What is the best way to ensure all imported characters are UTF-8? Thank you. </p>
0
ORA-01821: date format not recognized error for ISO 8601 date with local time
<p>I am trying to convert the date in SQL based on the parameter value in my Java code. However when the below query is executed I am getting error . Request you to help me in fixing this query.</p> <pre><code> SELECT TO_DATE ('2015-08-26T05:46:30.488+0100', 'YYYY-MM-DD"T"hh24:mi:ss.sTZH:TZM') FROM DUAL * Error at line 2 ORA-01821: date format not recognized </code></pre> <p>Date and Time format info:</p> <p><a href="http://www.w3.org/TR/NOTE-datetime" rel="noreferrer">http://www.w3.org/TR/NOTE-datetime</a></p>
0
discord channel link in message
<p>Using discord.py, I am making a bot to send users a direct message if a keyword of their choosing is mentioned.</p> <p>Everything is working, except I just want to add the channel they were mentioned in to the message. Here is my code:</p> <pre><code> print("SENDING MESSAGE") sender = '{0.author.name}'.format(message) channel = message.channel.name server = '{0.server}'.format(message) await client.send_message(member, server+": #"+channel+": "+sender+": "+msg) </code></pre> <p>This results in a correct message being composed, but the #channel part of the message is not a clickable link as it would be if i typed it into the chat window myself. Is there a different object I should be feeding into the message?</p>
0
Extract Publickey from Privatekey input using Python
<p>I need to generate publickey from a private key without temporary location locally like we do in sshgen.So i use this.Here iam passing my private key as input like this(while executing):</p> <pre><code>python codekey.py "-----BEGIN RSA PRIVATE KEY-----\nMIhhhhhhhhhhhhhhhh......Bidqt/YS3/0giWrtv+rMkJtv8n\nmirJ+16SZodI5gMuknvZG....................n-----END RSA PRIVATE KEY-----" </code></pre> <p>My code (codekey.py): </p> <pre><code>import sys import io from twisted.conch.ssh import keys k = sys.argv[1] rsa = keys.RSA.importKey(k) key = keys.Key(rsa) ssh_public = key.public().toString("openssh") print ssh_public </code></pre> <p>error:</p> <pre><code> Traceback (most recent call last): File "codekey.py", line 7, in &lt;module&gt; rsa = keys.RSA.importKey(k) File "/usr/lib/python2.7/dist-packages/Crypto/PublicKey/RSA.py", line 638, in importKey if lines[1].startswith(b('Proc-Type:4,ENCRYPTED')): IndexError: list index out of range </code></pre> <p>Dyanamically i need to pass key value as shown above while executing my python script and from that it will generate public key .Whether it is possible ??,i dont need to store locally,since for priveleges and key securities,dont want to hack.</p>
0
symfony Response with json ajax
<p>I'm new in Symfony i wanted to do some manipulation such I can get a list of all elemets in the entity Theme via Ajax but the answer is still "undefined" Here the code text strong</p> <p><strong>vue</strong></p> <pre><code> $(document).ready(function () { var $theme = $('#theme'); $theme.append('&lt;option value=""&gt;Choisir un thème&lt;/option&gt;'); $.ajax({ type: 'post', url: '{{ path('web_site_liste_theme_cmb') }}', dataType: 'json', beforeSend: function () { $('#themediv').append('&lt;div id="loading" style=" float: left; display: block;"&gt;&lt;img src="{{ asset('bundles/BackBundle/img/loadingicon.gif') }}"/&gt;&lt;/div&gt;'); }, success: function (json) { {#$('#theme').append({{ dump(json)}});#} console.log(json.value); $.each(json, function (index, value) { //console.log(value); $('#theme').append('&lt;option value="' + value.id + '"&gt;' + value.name + '&lt;/option&gt;'); $('#loading').remove(); }); } }); }); </code></pre> <p><strong>Controller</strong></p> <pre><code> public function ListeThemeAction(Request $request) { $em = $this-&gt;getDoctrine()-&gt;getEntityManager(); if ($request-&gt;isXmlHttpRequest()) { $themes = $em-&gt;getRepository('WebSiteBackBundle:theme'); $themes = $themes-&gt;findAll(); //var_dump($themes); return new JsonResponse($json); } return new JsonResponse('no results found', Response::HTTP_NOT_FOUND); // constant for 404 } </code></pre> <p>the server response is 200 OK, everything seems to work, I have the same number of data in the database but I can't read the objects values </p> <p>and here is the : <a href="http://i.stack.imgur.com/ydbA9.png" rel="nofollow">console.log(json)</a></p>
0
Bootstrap form validation changing success and error colors
<p>This is my form, i want the form to change colors when errors/something occurs.</p> <p>Example, if a user did not input anything in a required field,<br> i want it to change colors using bootstrap's css classes, can anyone teach me how i could make that happen?<br> p.s. i am new, so sorry for a newbie question.</p> <pre><code>&lt;form class="form-horizontal"&gt; &lt;fieldset&gt; &lt;!-- Form Name --&gt; &lt;legend&gt;Form Name&lt;/legend&gt; &lt;!-- Text input--&gt; &lt;div class="form-group"&gt; &lt;label class="col-md-4 control-label" for="name"&gt;Name&lt;/label&gt; &lt;div class="col-md-5"&gt; &lt;input id="name" name="name" type="text" placeholder="Enter Name" class="form-control input-md" required=""&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- Password input--&gt; &lt;div class="form-group"&gt; &lt;label class="col-md-4 control-label" for="password"&gt;Password&lt;/label&gt; &lt;div class="col-md-5"&gt; &lt;input id="password" name="password" type="password" placeholder="Enter Password" class="form-control input-md" required=""&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- Button --&gt; &lt;div class="form-group"&gt; &lt;label class="col-md-4 control-label" for="button"&gt;&lt;/label&gt; &lt;div class="col-md-4"&gt; &lt;input type = "submit" id="button" name="button" value = "Submit" class="btn btn-success"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; </code></pre>
0
error TS2304: Cannot find name 'Promise'
<p>Hello guys I went through all solution avaialble on stackoverflow. But none of work for me. Hence posting question. <strong>tsconfig.json</strong></p> <pre><code>{ "version":"2.13.0", "compilerOptions": { "target": "es5", "module": "commonjs", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "removeComments": true, "noImplicitAny": false }, "exclude": [ "node_modules" ] } </code></pre> <p><strong>package.json</strong></p> <pre><code>{ "name": "anguapp", "version": "1.0.0", "description": "Angular2 Gulp Typescript and Express", "main": "dist/server.js", "scripts": { "test": "echo \"Error: no test specified\" &amp;&amp; exit 1", "postinstall": "gulp build" }, "keywords": [], "author": "UK", "license": "MIT", "dependencies": { "angular2": "2.0.0-beta.17", "es6-promise": "3.2.1", "es6-shim": "0.35.1", "body-parser":"1.15.2", "express": "4.13.3", "gulp-concat": "2.6.0", "reflect-metadata": "0.1.8", "rxjs": "5.0.0-beta.6", "systemjs": "0.19.37", "zone.js": "0.6.17", "mongodb" :"2.2.8", "ejs" : "~0.8.5" }, "devDependencies": { "del": "2.2.2", "gulp": "3.9.1", "gulp-concat": "2.6.0", "gulp-sourcemaps": "1.6.0", "gulp-typescript": "2.13.0", "run-sequence": "1.1.5" } } </code></pre> <p><strong>While doing gulp i am getting following errors.</strong></p> <pre><code>[12:39:43] Using gulpfile D:\Repository\documents\personal\abha-du\gulpfile.js [12:39:43] Starting 'build'... [12:39:43] Starting 'clean'... [12:39:43] Finished 'clean' after 66 ms [12:39:43] Starting 'build:server'... [12:39:45] Finished 'build:server' after 2.18 s [12:39:45] Starting 'build:index'... [12:39:46] Finished 'build:index' after 21 ms [12:39:46] Starting 'build:app'... D:/Repository/documents/personal/abha-du/node_modules/angular2/platform/browser. d.ts(78,90): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/common/direct ives/ng_class.d.ts(72,35): error TS2304: Cannot find name 'Set'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/common/pipes/ async_pipe.d.ts(25,38): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/core/applicat ion_ref.d.ts(38,88): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/core/applicat ion_ref.d.ts(92,42): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/core/applicat ion_ref.d.ts(151,33): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/core/change_d etection/differs/default_keyvalue_differ.d.ts(23,15): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/core/change_d etection/differs/default_keyvalue_differ.d.ts(25,16): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/core/di/refle ctive_provider.d.ts(103,123): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/core/di/refle ctive_provider.d.ts(103,165): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/core/linker/c omponent_resolver.d.ts(8,53): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/core/linker/c omponent_resolver.d.ts(12,44): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/core/linker/d ynamic_component_loader.d.ts(59,148): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/core/linker/d ynamic_component_loader.d.ts(100,144): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/core/linker/d ynamic_component_loader.d.ts(105,139): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/core/linker/d ynamic_component_loader.d.ts(106,135): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/async. d.ts(27,33): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/async. d.ts(28,45): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/collec tion.d.ts(1,25): error TS2304: Cannot find name 'MapConstructor'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/collec tion.d.ts(2,25): error TS2304: Cannot find name 'SetConstructor'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/collec tion.d.ts(4,27): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/collec tion.d.ts(4,39): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/collec tion.d.ts(7,9): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/collec tion.d.ts(8,30): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/collec tion.d.ts(11,43): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/collec tion.d.ts(12,27): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/collec tion.d.ts(14,23): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/collec tion.d.ts(15,25): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/collec tion.d.ts(100,41): error TS2304: Cannot find name 'Set'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/collec tion.d.ts(101,22): error TS2304: Cannot find name 'Set'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/collec tion.d.ts(102,25): error TS2304: Cannot find name 'Set'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/lang.d .ts(4,17): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/lang.d .ts(5,17): error TS2304: Cannot find name 'Set'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/lang.d .ts(71,59): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/promis e.d.ts(2,14): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/promis e.d.ts(8,32): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/promis e.d.ts(9,38): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/promis e.d.ts(10,35): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/promis e.d.ts(10,93): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/promis e.d.ts(11,34): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/promis e.d.ts(11,50): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/promis e.d.ts(12,32): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/promis e.d.ts(12,149): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/facade/promis e.d.ts(13,43): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/http/headers. d.ts(43,59): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/http/url_sear ch_params.d.ts(11,16): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/platform/brow ser/browser_adapter.d.ts(75,33): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/platform/dom/ dom_adapter.d.ts(85,42): error TS2304: Cannot find name 'Map'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/direct ives/router_outlet.d.ts(27,54): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/direct ives/router_outlet.d.ts(33,51): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/direct ives/router_outlet.d.ts(38,56): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/direct ives/router_outlet.d.ts(47,65): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/direct ives/router_outlet.d.ts(58,60): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/instru ction.d.ts(124,34): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/instru ction.d.ts(148,25): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/instru ction.d.ts(164,34): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/instru ction.d.ts(167,25): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/interf aces.d.ts(21,107): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/interf aces.d.ts(39,104): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/interf aces.d.ts(57,109): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/interf aces.d.ts(80,109): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/interf aces.d.ts(102,114): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/lifecy cle/lifecycle_annotations.d.ts(29,100): error TS2304: Cannot find name 'Promise' . D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/route_ config/route_config_impl.d.ts(101,19): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/route_ definition.d.ts(20,20): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/route_ definition.d.ts(35,20): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/route_ registry.d.ts(52,66): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/router .d.ts(56,50): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/router .d.ts(68,46): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/router .d.ts(86,45): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/router .d.ts(99,34): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/router .d.ts(107,64): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/router .d.ts(112,85): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/router .d.ts(120,70): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/router .d.ts(128,43): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/router .d.ts(132,29): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/router .d.ts(138,19): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/angular2/src/router/router .d.ts(146,70): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/rxjs/Observable.d.ts(10,66 ): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/rxjs/Observable.d.ts(66,60 ): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/rxjs/Observable.d.ts(66,70 ): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/rxjs/operator/toPromise.d. ts(7,59): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/rxjs/operator/toPromise.d. ts(7,69): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/rxjs/operator/toPromise.d. ts(9,9): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/rxjs/operator/toPromise.d. ts(10,26): error TS2304: Cannot find name 'Promise'. D:/Repository/documents/personal/abha-du/node_modules/rxjs/operator/toPromise.d. ts(10,36): error TS2304: Cannot find name 'Promise'. [12:39:47] TypeScript: 86 semantic errors [12:39:47] TypeScript: emit succeeded (with errors) [12:39:47] Finished 'build:app' after 1.93 s [12:39:47] Starting 'build:home'... [12:39:47] Finished 'build:home' after 7.17 ms [12:39:47] Finished 'build' after 4.23 s [12:39:47] Starting 'default'... [12:39:47] Finished 'default' after 12 µs </code></pre> <p>Please help me to solve these <strong>TS2304: Cannot find name 'Promise'</strong> errors</p>
0
Define arrays within array in Angular 2 and Typescript
<p>In Angular 2 I was wondering if it was possible to define an array that has multiple other arrays in it. It is probably easier to just show what I mean:</p> <p>I started out using this:</p> <pre><code>export class PaymentDetails { account: any[]; bpNumber: number; } </code></pre> <p>but this gave me the problem that when I populated it I couldn't really access the data in the account array, as I want more arrays inside of it.</p> <p>So now i would like to define my class like this:</p> <pre><code>export class PaymentDetails { account: [ debitAccount: [ { debitAccountId: string; debitBankCode: string; debitBankName: string; debitCountryCode: string; debitAccountNumber: string; debitAccountHolder: string; debitContinous: string; debitDueDate: string; iban: string; bic: string; } ], ccAccount: [ { ccAccountId: string; ccCompanyCode: string; ccNumber: string; ccStart: string; ccExpiry: string; ccDsbTransactionId: string; ccCardholderName: string } ] ]; bpNumber: number; } </code></pre> <p>Is this at all possible? </p> <p>The class is getting populated with this InMemoryDataService</p> <pre><code>export class InMemoryDataService { createDb() { let paymentDetailsDB = [ { account: [ { debitAccount: [ { debitAccountId: '8736583', debitBankCode: '45345', debitBankName: 'KSK HGTT', debitCountryCode: 'DE', debitAccountNumber: '123453463', debitAccountHolder: 'A Berg', debitContinous: '', debitDueDate: '', iban: 'DE12344235', bic: '324645', }, { debitAccountId: '6567456', debitBankCode: '55463453', debitBankName: 'GRDFE', debitCountryCode: 'DE', debitAccountNumber: '000123492', debitAccountHolder: 'A Berg', debitContinous: '', debitDueDate: '', iban: 'DE43523453', bic: '123547665', } ], ccAccount: [ { ccAccountId: '23413', ccCompanyCode: '254345', ccNumber: '238857827368837', ccStart: '2010-10-05', ccExpiry: '2018-10-05', ccDsbTransactionId: '235231', ccCardholderName: 'Anne Berg', } ], } ], bpNumber: 4711, } ]; return {paymentDetailsDB}; } } </code></pre>
0
How to change date format in html from mm-dd-yyyy to dd-mm-yyyy?
<p>My problem is how to input date in HTML form in this format 21-01-1999 and not in this format 01-21-1999? When I write this HTML code</p> <pre><code>&lt;input name = "dPregled" id="dat" type="date" required="required" /&gt; &lt;/p&gt; </code></pre> <p>it gives me mm-dd-yyyy format for input. Also is there a way to automatically take today's date in a form?</p> <p>I have been researching for an answer everywhere but I can not find it. Thank u so much.</p>
0
Running multiple instance of Redis on Centos
<p>I want to run multiple instance of Redis on Centos 7. Can anyone point me to proper link or post steps here.</p> <p>I googled for the information but I didn't find any relevant information. </p>
0
how do you echo text from a file using batch?
<p>okay, so I'm trying to make a batch file that just echos the text inside a file called "test.txt" and my code is</p> <pre><code>@echo off cls ( echo %0% echo %1% echo %2% echo %3% echo %4% echo %5% echo %6% echo %7% echo %8% echo %9% echo %10% echo %11% echo %12% echo %13% echo %14% echo %15% echo %16% ) &lt;test.txt pause &gt;nul </code></pre> <p>but for some very strange reason I couldn't find any answers for anywhere, my output is</p> <pre><code>ECHO is off. ECHO is off. ECHO is off. ECHO is off. ECHO is off. ECHO is off. ECHO is off. ECHO is off. 0 1 2 3 4 5 6 </code></pre> <p>and I really don't understand why.</p>
0
Uncaught TypeError: Cannot read property 'toString' of null
<p>I have this message: "Uncaught TypeError: Cannot read property 'toString' of null" while running the code below. Any help would be appreciated since I am not familiar with Javascript </p> <p>Thank you in advance.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function getUrlVars() { var arrGamePath = document.referrer; if(arrGamePath) { var reg = new RegExp("[/][a-zA-Z]{2}-[a-zA-Z]{2,4}[/]"); var locale = reg.exec(arrGamePath) .toString(); while (locale.indexOf("/") != -1) { locale = locale.replace("/", ""); } return locale; }else{ return false; } } if(getUrlVars()) { sCID = getUrlVars(); }</code></pre> </div> </div> </p>
0
Show more / show less with jQuery
<p>So I have a webpage at which I have written an addon that allows customers to buy additional products, but I do not want all these products to be shown whenever they enter the page. So I am looking for some kind of "show more" </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="wrapper"&gt; &lt;div class="ty-compact-list" style="padding: 5px 5px 5px 0px; float: left; width: 100%;"&gt;Product 1&lt;/div&gt; &lt;div class="ty-compact-list" style="padding: 5px 5px 5px 0px; float: left; width: 100%;"&gt;Product 2&lt;/div&gt; &lt;div class="ty-compact-list" style="padding: 5px 5px 5px 0px; float: left; width: 100%;"&gt;Product 3&lt;/div&gt; &lt;div class="ty-compact-list" style="padding: 5px 5px 5px 0px; float: left; width: 100%;"&gt;Product 4&lt;/div&gt; &lt;div class="ty-compact-list" style="padding: 5px 5px 5px 0px; float: left; width: 100%;"&gt;Product 5&lt;/div&gt; &lt;div class="ty-compact-list" style="padding: 5px 5px 5px 0px; float: left; width: 100%;"&gt;Product 6&lt;/div&gt; &lt;/div&gt; </code></pre> </div> </div> </p> <p>So I am looking for some kind of way to only show 3 products whenever you enter the page but if you press the show more button it will show the next 3 products.</p> <p>I have seen many posts on this but I can not find anything related to this.</p> <p>Ps. If there could be an animation when you press "show more", then that'd be great.</p>
0
Create an array with a sequence of numbers in bash
<p>I would like to write a script that will create me an array with the following values:</p> <pre><code>{0.1 0.2 0.3 ... 2.5} </code></pre> <p>Until now I was using a script as follows:</p> <pre><code>plist=(0.1 0.2 0.3 0.4) for i in ${plist[@]}; do echo "submit a simulation with this parameter:" echo "$i" done </code></pre> <p>But now I need the list to be much longer ( but still with constant intervals).</p> <p>Is there a way to create such an array in a single command? what is the most efficient way to create such a list?</p>
0
Alternative to System.Web.Security.Membership.GeneratePassword in aspnetcore (netcoreapp1.0)
<p>Is there any alternative to <code>System.Web.Security.Membership.GeneratePassword</code> in <code>AspNetCore</code> (<code>netcoreapp1.0</code>).</p> <p>The easiest way would be to just use a <code>Guid.NewGuid().ToString("n")</code> which is long enough to be worthy of a password but it's not fully random.</p>
0
Uncaught TypeError: $.ajax(...).success is not a function
<p>I'm new to jQuery and using a little old tutorial on <code>node.js</code> that uses this snippet :</p> <pre><code>$(function () { var roomId; $.ajax({ type: "GET", url: "/api/rooms" }).success(function (rooms) { roomId = rooms[0].id; getMessages(); $.each(rooms, function (key, room) { var a = '&lt;a href="#" data-room-id="' + room.id + '" class="room list-group-item"&gt;' + room.name + '&lt;/a&gt;'; $("#rooms").append(a); }); }); [...] }); </code></pre> <p>However I get this error</p> <blockquote> <p>Uncaught TypeError: $.ajax(...).success is not a function</p> </blockquote> <p>at <code>}).success(function (rooms) {</code> </p> <p>I'm wondering what can be wrong here?</p>
0
Hibernate native query return List Object List
<p>I am using an hibernate NQL query which fetches me two columns :</p> <pre class="lang-sql prettyprint-override"><code>SELECT object_name, object_name_location FROM dbo.object_stacks WHERE object_id IN (SELECT thumb_nail_obj_id FROM dbo.uois WHERE Upper(NAME) LIKE Upper('%testobj%')) </code></pre> <p>When I select only one column i.e only object name - everything works fine but with two columns I am getting an error</p> <blockquote> <p>java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.lang.String</p> </blockquote> <p>at run time when I try to display result from the list. I tried using String array in the list as well but it doesn't work. Below are my code snippets which give error : </p> <p>When I use only List : </p> <pre><code>List&lt;String&gt; Thumbnailpaths = pathquery.list(); System.out.println(Thumbnailpaths.get(i).replace("\\", "\\\\")); </code></pre> <p>No error at compile time also nothing if leave it as it is but above line to display gives classcast exception.</p> <p>When I use List array : </p> <pre><code>List&lt;String[]&gt; Thumbnailpaths = pathquery.list(); System.out.println(Thumbnailpaths.get(i)[0].replace("\\", "\\\\")); </code></pre> <p>Here again classcast exception at runtime</p> <p>Also <code>Criteria.ALIAS_TO_ENTITY_MAP</code> doesn't help at all as it makes logic much more complex. I just need 2 column values from a database table.</p> <p>Please let me know if there is any solution to fetch multiple column results in NQL and then put in list.</p> <p>Note : Looks like here generics are not displaying and only List is being written in my code snippet</p>
0
Checking the error detection capabilities of CRC polynomials
<p>I tried to find out how to calculate the error detection capabilities of arbitrary CRC polynomials.</p> <p>I know that there are various error detection capabilities that may (or may not) apply to an arbitrary polynomial:</p> <ol> <li><p>Detection of a single bit error: All CRCs can do this since this only requires a CRC width >= 1.</p></li> <li><p>Detection of burst errors: All CRCs can detect burst errors up to a size that equals their width.</p></li> <li><p>Detection of odd numbers of bit errors: CRC with polynomials with an even number of terms (which means an even number of 1-bits in the full binary polynomial) can do this.</p></li> <li><p>Detection of random bit errors (depending from frame size): I have a ready-to-use C algorithm that allows calculating the maximum frame size for given HD and poylnomial. I didn't understood it completely but it works.</p></li> </ol> <p>Lets assume a 16 bit CRC polynomial x¹⁶+x¹²+x⁵+1 = 0x11021. That polynomial can:</p> <ul> <li>detect all single bit errors (data size independent).</li> <li>detect all burst errors up to 16 bit width (data size independent).</li> <li>detect all odd numbers of bit errors (since it has 4 polynomial terms; data size independent).</li> <li>detect 3 bit errors (HD4) up to 32571 bit data size.</li> </ul> <p>Is the above correct?</p> <p>Are there additional CRC error detection capabilities? If yes, how can I check (without deep math knowledge) if an arbitrary CRC polynomial supports them?</p>
0
Odoo 500 server internal error after installation of odoo
<p>Hı all. Thank you for this community. I want use odoo for my job. but I'm so tired, I'm on the verge of giving up from odoo.</p> <p>I would be very grateful if you help.</p> <p>After installation, I can get once localhost8069 . And creating database. ANd ı take create database error.</p> <p>Database creation error: "invalid byte sequence for encoding "UTF8": 0xff " while parsing /usr/lib/python2.7/dist-packages/openerp/addons/base/base_data.xml:55, near &lt;span&gt;--&lt;br/&gt; Administrator&lt;/span&gt; </p> <p>After this error ı take always 500 internal server error. I can not see login interface anymore. I just see 500 internal server error.</p> <p>6 days I'm working and I could not reach a solution. I used ubuntu and pardus ( some kind debian) . And the results did not change.</p> <p>But when ı used w7 ı succeed. I was able to get odoo. But ı want use odoo in linux not windows.</p> <p>I guess this error about database. But ı didnt find source about confıgure postgresql for odoo. Can you help me pls ?</p> <p>This is my steps for installions of odoo after fresh ubuntu :</p> <p>1-)</p> <pre><code>wget -O - nightly.odoo.com/odoo.key | apt-key add - echo "deb nightly.odoo.com/9.0/nightly/deb/ ./" &gt;&gt; /etc/apt/sources.list apt-get update &amp;&amp; apt-get install odoo </code></pre> <p>2-) and go : <a href="http://localhost:8069" rel="nofollow">http://localhost:8069</a></p> <p>Log file : ı erased log file and restart odoo server and try few time localhost:8069 again :</p> <p>And this is end of new fresh log file :</p> <p>File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 1554, in setup_db</p> <p>httprequest.session.db = db_monodb(httprequest)</p> <p>File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 1701, in db_monodb</p> <p>dbs = db_list(True, httprequest)</p> <p>File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 1675, in db_list</p> <p>dbs = openerp.service.db.list_dbs(force)</p> <p>File "/usr/lib/python2.7/dist-packages/openerp/service/db.py", line 323, in list_dbs with closing(db.cursor()) as cr: File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 630, in cursor</p> <p>return Cursor(self.<strong>pool, self.dbname, self.dsn, serialized=serialized) File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 164, in __init</strong></p> <p>self._cnx = pool.borrow(dsn)</p> <p>File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 513, in _locked</p> <p>return fun(self, *args, **kwargs)</p> <p>File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 581, in borrow</p> <p>**connection_info)</p> <p>File "/usr/lib/python2.7/dist-packages/psycopg2/<strong>init</strong>.py", line 164, in connect</p> <p>conn = _connect(dsn, connection_factory=connection_factory, async=async)</p> <p>OperationalError: fe_sendauth: no password supplied</p>
0
Installing angular-cli on Windows Behind Proxy Server
<p>I am currently building Angular 2 demos from behind a corporate proxy server with known issues for blocking both NPM and TypeScript 'typings' installs. While I have been able to work around these issues with proxy server settings, I'm a little unsure what to do about the latest issue.</p> <p>Whenever I try to install angular-cli globally:</p> <pre><code>npm install -g angular-cli </code></pre> <p>or even locally to a directory with an existing <strong>npm init</strong> setup (including package.json file):</p> <pre><code>npm install angular-cli --save </code></pre> <p>I receive the following error (all local paths replaced with ):</p> <p><strong>angular-cli npm install error</strong></p> <pre><code>npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\&lt;PATH&gt;\node_modules\angular-cli\node_modules\babel-runtime' -&gt; 'C:\Users\&lt;PATH&gt;\node_modules\angular-cli\node_modules\.babel-runtime.DELETE' at FSReqWrap.oncomplete (fs.js:82:15) npm ERR! Please try running this command as root/Administrator. </code></pre> <p>Anyone else having issues (or a solution) to this particular user permission issue?</p> <p>Thanks.</p>
0
Difference between RDBMS and ORDBMS
<p>It happened to me when I was reading about PostgreSQL on its <a href="https://en.wikipedia.org/wiki/PostgreSQL" rel="noreferrer">wiki</a> page where it refers to itself as an ORDBMS. I always knew about Microsoft SQL Server which is an RDBM system. Can someone help me understand the main differences between Relational Database Management System(RDBMS) and Object Relational Database Management System (ORDBMS) and in what scenarios should I use one of them?</p> <p>Also, my key question is related to the fact that in the world of Microsoft SQL Server we often use a layer of Entity Framework (EF) to do the object relational mapping on the application side. So, in ORDBMS world are all the responsibilities of an ORM already fulfilled by the database itself in entirety or there could be use cases or scenarios where I would end up using an ORM like Entity Framework on top of ORDBMS as well? Do people really even use ORMs on top of an ORDBMS system?</p>
0
ggplot2: reorder bars in barplot from highest to lowest
<p>I got this figure</p> <p><a href="https://i.stack.imgur.com/pS56O.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pS56O.png" alt="enter image description here"></a></p> <p>Following the answer of <a href="https://stackoverflow.com/questions/5967593/ordering-of-bars-in-ggplot">similar question</a></p> <pre><code>library(ggplot2) library(egg) mydf &lt;- transform(mydf, variables = reorder(variables, VIP, decreasing = T)) p1 &lt;- ggplot(mydf, aes(x = variables, y = VIP, group =1))+ geom_bar(stat="identity") + geom_hline(yintercept = 1, size = 2, linetype = 3) + theme(axis.title.x =element_blank()) p2 &lt;- ggplot(mydf, aes(x = variables, y = coefficient, group =1))+ geom_point()+ geom_line()+ geom_hline(yintercept = 0, size = 2, linetype = 3) grid.draw(egg::ggarrange(p1,p2 , ncol=1)) </code></pre> <p>My goal was to order the bars from highest to lowest.</p> <p>Although, I sorted the <code>variables and VIP</code> from highest to lowest, the bars were ordered from lowest to highest.</p> <p>Any idea what went wrong and made the bars sorted from lowest to highest?</p> <p><strong>Data</strong></p> <pre><code>mydf &lt;- read.table(text = c(" variables VIP coefficient diesel 0.705321 0.19968224 twodoors 1.2947119 0.3387236 sportsstyle 0.8406462 -0.25861398 wheelbase 1.3775179 -0.42541873 length 0.8660376 0.09322408 width 0.8202489 0.27762277 height 1.0140934 -0.12334574 curbweight 0.996365 -0.29504266 enginesize 0.8601269 -0.25321317 horsepower 0.7093094 0.16587358 horse_per_weight 1.2389938 0.43380122"), header = T) </code></pre>
0
How to set form input value in angularjs?
<p>how to set a value for an input form in angularjs?</p> <p>this is my input form:</p> <pre><code>&lt;input type="text" placeholder="John" ng-model="dataOrang.nama"&gt; </code></pre>
0
Shell Script compare file content with a string
<p>I have a String "ABCD" and a file test.txt. I want to check if the file has only this content "ABCD". Usually I get the file with "ABCD" only and I want to send email notifications when I get anything else apart from this string so I want to check for this condition. Please help!</p>
0
What is the exact command to install yum through brew?
<p>I tried installing yum through brew install command. but it is not working with the message below. What is the problem? I can not find any good materials.</p> <pre><code>$ brew install "yum" Error: No available formula with the name "yum" ==&gt; Searching for similarly named formulae... Error: No similarly named formulae found. ==&gt; Searching taps... Error: No formulae found in taps. </code></pre>
0
How to exclude the support v4 library from the studio?
<p>FAILURE: Build failed with an exception.</p> <ul> <li>What went wrong: Execution failed for task ':transformClassesWithJarMergingForDebug'. <blockquote> <p>com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/content/Loader$OnLoadCompleteListener.class</p> </blockquote></li> </ul> <p>Code in build.gradle file</p> <pre><code> apply plugin: 'com.android.application' dependencies { compile fileTree(dir: 'libs', include: '*.jar') //compile project(':ActionBarSherlock-4.1.0') compile project(':GooglePlayServicesLibrary') compile files('libs/eventbus-2.4.0.jar') compile (project(':AndroidBetterPickers')){ exclude module: 'support-v4' } compile (project(':ZxingFragmentLib')){ exclude module: 'support-v4' } compile (project(':RobotoTextView')){ exclude module: 'support-v4' } compile (project(':PanesLibrary')){ exclude module: 'support-v4' } compile (project(':ShowCaseViewLibrary')){ exclude module: 'support-v4' } compile (project(':ActionBarSherlock-4.1.0')){ exclude module: 'support-v4' } } buildscript { repositories { jcenter() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.1.3' } } allprojects { repositories { jcenter() mavenCentral() } } android { packagingOptions { exclude 'META-INF/maven/com.nineoldandroids/library/pom.xml' exclude 'META-INF/maven/com.nineoldandroids/library/pom.properties' exclude 'META-INF/services/javax.annotation.processing.Processor' } dexOptions { javaMaxHeapSize "4g" } compileSdkVersion 19 buildToolsVersion '22.0.1' defaultConfig { minSdkVersion 15 targetSdkVersion 15 multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['.apt_generated','res','src'] resources.srcDirs = ['.apt_generated','res','src'] aidl.srcDirs = ['.apt_generated','res','src'] renderscript.srcDirs = ['.apt_generated','res','src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') // Move the build types to build-types/&lt;type&gt; // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src/&lt;type&gt;/... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanied // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') } } </code></pre>
0
Can we Scaffold DbContext from selected tables of an existing database
<p>As in previous versions of Entity Framework, is it possible in Entity Framework Core to reverse engineer only the selected tables of an existing database to create model classes out of them. <a href="https://docs.efproject.net/en/latest/platforms/aspnetcore/existing-db.html" rel="noreferrer">This official ASP.NET site</a> reverse engineers the entire database. In past, <a href="http://www.asp.net/mvc/overview/getting-started/database-first-development/creating-the-web-application" rel="noreferrer">as shown in this ASP.NET tutorial</a>, using old EF you could reverse engineer only the selected tables/Views if you chose to.</p>
0
How to change the color of text to white only using Bootstrap no css
<p>I want to change the text color to white without using a single line of css code is it possible to do that using any Bootstrap Class?</p>
0
Vagrant machine - how to find out mysql username/password
<p>So, on atlas.hashicorp.com there are a lot of pre-installed machines, with PHP &amp; MySql. But problem is, I can't find anywhere MySql credentials. I.e.:</p> <p><a href="https://atlas.hashicorp.com/webinfopro/boxes/ubuntu-xenial-lamp" rel="noreferrer">https://atlas.hashicorp.com/webinfopro/boxes/ubuntu-xenial-lamp</a></p> <p>I can access PhpMyAdmin, but I can't login. Tried all "usual" combination of username/password (root, vagrant, 12345678). But none of them works. What's the point of installing MySql, when you don't give root user credentials?!?</p> <p>I also followed some instructions to reset root user password:</p> <p><a href="https://help.ubuntu.com/community/MysqlPasswordReset" rel="noreferrer">https://help.ubuntu.com/community/MysqlPasswordReset</a></p> <p>But I'm getting bunch of errors and process eventually fails. I'm not interested in debugging and solving numerous issues - just want to quickly have usable PHP 7 LAMP environment.</p>
0
Could not get unknown property 'compile' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler
<p>I was about to add google map activity, and my android studio showed this error</p> <blockquote> <p>Error:Error:line (25)Could not get unknown property 'compile' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.</p> </blockquote> <pre><code> &lt;a href="openFi`here`le:C:\Users\dhami\Desktop\uber1\ParseStarterProject\build.gradle"&gt;&lt;/a&gt; </code></pre> <p>this is my parse project Gradle file</p> <pre><code>apply plugin: 'com.android.application'android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { applicationId "com.parse.starter" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } dependencies { compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.parse.bolts:bolts-tasks:1.3.0' compile 'com.parse:parse-android:1.13.0' compile 'com.google.android.gms``:play-services:9.2.1' } </code></pre> <p>this is my project gradle file</p> <pre><code>buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.1.3' }}allprojects { repositories { mavenCentral() } } ext { compileSdkVersion = 23 buildToolsVersion = "23.0.1" minSdkVersion = 14 targetSdkVersion = 23 } </code></pre>
0
ignore eslint error: 'import' and 'export' may only appear at the top level
<p>Is it possible to deactivate this error in eslint?</p> <pre><code>Parsing error: 'import' and 'export' may only appear at the top level </code></pre>
0
How does Spring Boot control Tomcat cache?
<p>I'm porting 5 years old Spring MVC application with JSPs to Spring Boot. Therefore, according to sample in <a href="http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-jsp-limitations" rel="noreferrer">http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-jsp-limitations</a> I'm using "war" packaging.</p> <p>Embedded tomcat starts. However logs are full of caching warnings like in the example below</p> <pre> 2016-08-25 14:59:01.442 INFO 28884 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) 2016-08-25 14:59:01.456 INFO 28884 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat 2016-08-25 14:59:01.458 INFO 28884 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.4 2016-08-25 14:59:01.531 WARN 28884 --- [ost-startStop-1] org.apache.catalina.webresources.Cache : Unable to add the resource at [/WEB-INF/lib/displaytag-1.2.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 2016-08-25 14:59:01.531 WARN 28884 --- [ost-startStop-1] org.apache.catalina.webresources.Cache : Unable to add the resource at [/WEB-INF/lib/decrex-maven-0.1.10-SNAPSHOT.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 2016-08-25 14:59:01.531 WARN 28884 --- [ost-startStop-1] org.apache.catalina.webresources.Cache : Unable to add the resource at [/WEB-INF/lib/spring-boot-actuator-1.4.0.RELEASE.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 2016-08-25 14:59:01.531 WARN 28884 --- [ost-startStop-1] org.apache.catalina.webresources.Cache : Unable to add the resource at [/WEB-INF/lib/validation-api-1.1.0.Final.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 2016-08-25 14:59:01.532 WARN 28884 --- [ost-startStop-1] org.apache.catalina.webresources.Cache : Unable to add the resource at [/WEB-INF/lib/lucene-backward-codecs-5.3.1.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 2016-08-25 14:59:01.532 WARN 28884 --- [ost-startStop-1] org.apache.catalina.webresources.Cache : Unable to add the resource at [/WEB-INF/lib/lucene-queries-5.3.1.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache ..... 2016-08-25 14:59:05.121 WARN 28884 --- [ost-startStop-1] org.apache.catalina.webresources.Cache : Unable to add the resource at [/WEB-INF/lib/jstl-1.2.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 2016-08-25 14:59:05.139 WARN 28884 --- [ost-startStop-1] org.apache.catalina.webresources.Cache : Unable to add the resource at [/WEB-INF/classes/commons-logging.properties] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 2016-08-25 14:59:05.139 INFO 28884 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2016-08-25 14:59:05.139 INFO 28884 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 7117 ms ..... 2016-08-25 15:02:03.960 INFO 28884 --- [ndardContext[]]] org.apache.catalina.webresources.Cache : The background cache eviction process was unable to free [10] percent of the cache for Context [] - consider increasing the maximum size of the cache. After eviction approximately [9,251] KB of data remained in the cache. </pre> <p>I'd be happy to increase tomcat cache, but I'm failing to find a way to control it in Spring Boot. Please, <strong>advise!!!</strong></p> <p><hr/> I tried a suggestion from Andy Wilkinson below. Also tried to use it in <code>EmbeddedServletContainerCustomizer</code></p> <pre> @Component public class ServletContainerCustomizer implements EmbeddedServletContainerCustomizer { private static final Log log = LogFactory.getLog(ServletContainerCustomizer.class); @Override public void customize(ConfigurableEmbeddedServletContainer container) { if (TomcatEmbeddedServletContainerFactory.class.isAssignableFrom(container.getClass())) { int cacheSize = 256 * 1024; log.info("Customizing tomcat factory. New cache size (KB) is " + cacheSize); TomcatEmbeddedServletContainerFactory tomcatFactory = (TomcatEmbeddedServletContainerFactory) container; tomcatFactory.addContextCustomizers((context) -> { StandardRoot standardRoot = new StandardRoot(context); standardRoot.setCacheMaxSize(cacheSize); }); } } } </pre> <p>Message about changing the cache size is in the logs, but the <strong>code above has no influence</strong> on the warnings</p>
0
Should I use AWS Cognito "username" or "sub" (uid) for storing in database?
<p>I have an authenticated user in AWS Cognito service and want to store his unique identifier in the database. Should I store user's username (it's his phone number) or his "sub" (it's his uid)? All Amazon API functions like <a href="http://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminGetUser.html" rel="noreferrer">AdminGetUser</a> are using "username" parameter, but not sub/uid.</p> <p>But I also read that <a href="https://mobile.awsblog.com/post/Tx3JK25U7Z9EUIU/Integrating-Amazon-Cognito-User-Pools-with-API-Gateway" rel="noreferrer">article</a> and the author said "Always generate the policy on value of 'sub' claim and not for 'username' because username is reassignable. Sub is UUID for a user which is never reassigned to another user." </p> <p>So, now I'm hesitating what I have to use as unique user identifier - "username" or "sub"</p> <p>Thank you.</p>
0
Table cell with nowrap overflows
<p>I'm using bootstrap, and want to create a simple HTML <code>table</code>, where in the last column I have a 2-button group and a single separate button. I want this last cell to always keep this 3 buttons in one line, so I added the <code>text-nowrap</code> bootstrap class (which is a simple <code>white-space: nowrap</code>).</p> <p>If the content of the other cell(s) is long enough, the content of the last cell will overflow horizontally, and I don't understand why. I'd expect that the rest of the table will shrink to make space for the non-wrapping cell.</p> <p>Here is a demo to reproduce the issue: <a href="http://www.bootply.com/wWM2a9R8Mt" rel="nofollow">bootply</a></p> <p>Here is the markup.</p> <pre><code>&lt;div style="width: 500px"&gt; &lt;table class="table table-striped"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td&gt;Test text&lt;/td&gt; &lt;td class="text-nowrap"&gt; &lt;div class="btn-group"&gt; &lt;button class="btn btn-default"&gt;&lt;span&gt;A&lt;/span&gt;&lt;/button&gt; &lt;button class="btn btn-warning"&gt;&lt;span&gt;B&lt;/span&gt;&lt;/button&gt; &lt;/div&gt; &lt;button class="btn btn-success"&gt;&lt;span&gt;C&lt;/span&gt;&lt;/button&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt; </code></pre> <p>The button group <code>div</code> and the separate <code>button</code> are all <code>inline-block</code> elements, so the wrapping should work as expected IMO. What am I doing wrong?</p> <p>Maybe this is not strictly related to bootstrap.</p> <p><strong>UPDATE</strong></p> <ul> <li>I've updated the bootply, the link was a previous version, sorry</li> <li>Tested in latest Chrome and IE, the issue is almost the same in both.</li> </ul> <p><strong>The cause and the workaround</strong></p> <ul> <li>I've realized that unwrapping the two buttons from the <code>btn-group</code> will result a correct layout, so I started to examine what actually the <code>btn-group</code> does.</li> <li>I've found that the <code>btn</code>s in the <code>btn-group</code> are floated, and this floating causes the bad layout. <del>Adding a <code>clearfix</code> class to the <code>btn-group</code> solves the issue.</del> No it actually doesn't, still researching...</li> <li>I will examine why the <code>float: left</code> is needed for bootstrap, it seems like the buttons in the group could be aligned by using purely <code>inline-block</code> without margin. I will check this in the <code>v4-alpha</code> code, and will also report this issue to bootstrap <code>v3</code>.</li> </ul>
0
Getting 404 when attempting to publish new package to NPM
<p>I just created a <a href="https://github.com/supericium/pli" rel="noreferrer">new package</a>.</p> <p>I'm now trying to publish it to NPM for the first time like this:</p> <pre><code> ole@MKI:~/Sandbox/pli$ npm publish --access public npm ERR! publish Failed PUT 404 npm ERR! Linux 3.13.0-93-generic npm ERR! argv &quot;/home/ole/.nvm/versions/v6.4.0/bin/node&quot; &quot;/home/ole/.nvm/versions/v6.4.0/bin/npm&quot; &quot;publish&quot; &quot;--access&quot; &quot;public&quot; npm ERR! node v6.4.0 npm ERR! npm v3.10.3 npm ERR! code E404 npm ERR! 404 Not found : @supericium/pli npm ERR! 404 npm ERR! 404 '@supericium/pli' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url. npm ERR! Please include the following file with any support request: npm ERR! /home/ole/Sandbox/pli/npm-debug.log </code></pre> <p>I tried updating both NodeJS and NPM to make sure that I have the latest version, which are:</p> <pre><code>ole@MKI:~/Sandbox/pli$ node --version v6.4.0 ole@MKI:~/Sandbox/pli$ npm --version 3.10.3 </code></pre> <p>Thoughts?</p>
0
Should keystore password be same as PKCS12 certificate password?
<p>I am trying to import PKCS12 certificate using keytool in java. It works fine only when the keystore password is the same as certificate password. Is it mandatory to use the PKCS12 certificate password for keystore as well? </p>
0
SonarQube java.lang.OutOfMemoryError: GC overhead limit exceeded
<p>I am getting <code>OutOfMemoryException</code> while performing sonar analysis on my project. Jenkins job shows analysis report was generated successfully but during background task in <code>SonarQube</code> it is failing with below exception.,</p> <pre><code>2016.08.24 10:55:52 INFO [o.s.s.c.s.ComputationStepExecutor] Compute comment measures | time=14ms 2016.08.24 10:56:01 INFO [o.s.s.c.s.ComputationStepExecutor] Copy custom measures | time=9075ms 2016.08.24 10:56:02 INFO [o.s.s.c.s.ComputationStepExecutor] Compute duplication measures | time=150ms 2016.08.24 10:56:34 ERROR [o.s.s.c.c.ComputeEngineContainerImpl] Cleanup of container failed java.lang.OutOfMemoryError: GC overhead limit exceeded 2016.08.24 10:56:34 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AVa6eX7gdswG1hqK_Vvc java.lang.OutOfMemoryError: Java heap space 2016.08.24 10:56:34 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Executed task | project=iServe | id=AVa6eX7gdswG1hqK_Vvc | time=53577ms </code></pre>
0
HTTP Livestreaming with ffmpeg
<p>Some context: I have an MKV file, I am attempting to stream it to <a href="http://localhost:8090/test.flv" rel="nofollow">http://localhost:8090/test.flv</a> as an flv file.</p> <p>The stream begins and then immediately ends.</p> <p>The command I am using is:</p> <pre><code>sudo ffmpeg -re -i input.mkv -c:v libx264 -maxrate 1000k -bufsize 2000k -an -bsf:v h264_mp4toannexb -g 50 http://localhost:8090/test.flv </code></pre> <p>A breakdown of what I believe these options do incase this post becomes useful for someone else:</p> <pre><code>sudo </code></pre> <p>Run as root</p> <pre><code>ffmpeg </code></pre> <p>The stream command thingy</p> <pre><code>-re </code></pre> <p>Stream in real-time</p> <pre><code>-i input.mkv </code></pre> <p>Input option and path to input file</p> <pre><code>-c:v libx264 </code></pre> <p>Use codec libx264 for conversion</p> <pre><code>-maxrate 1000k -bufsize 2000k </code></pre> <p>No idea, some options for conversion, seems to help</p> <pre><code>-an -bsf:v h264_mp4toannexb </code></pre> <p>Audio options I think, not sure really. Also seems to help</p> <pre><code>-g 50 </code></pre> <p>Still no idea, maybe frame rateframerateframerateframerate?</p> <pre><code>http://localhost:8090/test.flv </code></pre> <p>Output using http protocol to localhost on port 8090 as a file called test.flv</p> <p><strong>Anyway the actual issue I have is that it begins to stream for about a second and then immediately ends.</strong></p> <p><strong>The mpeg command result:</strong></p> <pre><code>ffmpeg version N-80901-gfebc862 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3) configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab libavutil 55. 28.100 / 55. 28.100 libavcodec 57. 48.101 / 57. 48.101 libavformat 57. 41.100 / 57. 41.100 libavdevice 57. 0.102 / 57. 0.102 libavfilter 6. 47.100 / 6. 47.100 libavresample 3. 0. 0 / 3. 0. 0 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 1.100 / 2. 1.100 libpostproc 54. 0.100 / 54. 0.100 Input #0, matroska,webm, from 'input.mkv': Metadata: encoder : libebml v1.3.0 + libmatroska v1.4.0 creation_time : 1970-01-01 00:00:02 Duration: 00:01:32.26, start: 0.000000, bitrate: 4432 kb/s Stream #0:0(eng): Video: h264 (High 10), yuv420p10le, 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default) Stream #0:1(nor): Audio: flac, 48000 Hz, stereo, s16 (default) [libx264 @ 0x2e1c380] using SAR=1/1 [libx264 @ 0x2e1c380] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX [libx264 @ 0x2e1c380] profile High, level 4.0 [libx264 @ 0x2e1c380] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=50 keyint_min=5 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=1000 vbv_bufsize=2000 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00 [flv @ 0x2e3f0a0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead. Output #0, flv, to 'http://localhost:8090/test.flv': Metadata: encoder : Lavf57.41.100 Stream #0:0(eng): Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 23.98 fps, 1k tbn, 23.98 tbc (default) Metadata: encoder : Lavc57.48.101 libx264 Side data: cpb: bitrate max/min/avg: 1000000/0/0 buffer size: 2000000 vbv_delay: -1 Stream mapping: Stream #0:0 -&gt; #0:0 (h264 (native) -&gt; h264 (libx264)) Press [q] to stop, [?] for help Killed 26 fps= 26 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x </code></pre> <p><strong>The ffserver outputs:</strong></p> <pre><code>Sat Aug 20 12:40:11 2016 File '/test.flv' not found Sat Aug 20 12:40:11 2016 [SERVER IP] - - [POST] "/test.flv HTTP/1.1" 404 189 </code></pre> <p><strong>The config file is:</strong></p> <pre><code>#Sample ffserver configuration file # Port on which the server is listening. You must select a different # port from your standard HTTP web server if it is running on the same # computer. Port 8090 # Address on which the server is bound. Only useful if you have # several network interfaces. BindAddress 0.0.0.0 # Number of simultaneous HTTP connections that can be handled. It has # to be defined *before* the MaxClients parameter, since it defines the # MaxClients maximum limit. MaxHTTPConnections 2000 # Number of simultaneous requests that can be handled. Since FFServer # is very fast, it is more likely that you will want to leave this high # and use MaxBandwidth, below. MaxClients 1000 # This the maximum amount of kbit/sec that you are prepared to # consume when streaming to clients. MaxBandwidth 1000 # Access log file (uses standard Apache log file format) # '-' is the standard output. CustomLog - # Suppress that if you want to launch ffserver as a daemon. #NoDaemon ################################################################## # Definition of the live feeds. Each live feed contains one video # and/or audio sequence coming from an ffmpeg encoder or another # ffserver. This sequence may be encoded simultaneously with several # codecs at several resolutions. &lt;Feed feed1.ffm&gt; ACL allow 192.168.0.0 192.168.255.255 # You must use 'ffmpeg' to send a live feed to ffserver. In this # example, you can type: # #ffmpeg http://localhost:8090/test.ffm # ffserver can also do time shifting. It means that it can stream any # previously recorded live stream. The request should contain: # "http://xxxx?date=[YYYY-MM-DDT][[HH:]MM:]SS[.m...]".You must specify # a path where the feed is stored on disk. You also specify the # maximum size of the feed, where zero means unlimited. Default: # File=/tmp/feed_name.ffm FileMaxSize=5M File /tmp/feed1.ffm FileMaxSize 200m # You could specify # ReadOnlyFile /saved/specialvideo.ffm # This marks the file as readonly and it will not be deleted or updated. # Specify launch in order to start ffmpeg automatically. # First ffmpeg must be defined with an appropriate path if needed, # after that options can follow, but avoid adding the http:// field #Launch ffmpeg # Only allow connections from localhost to the feed. ACL allow 127.0.0.1 &lt;/Feed&gt; ################################################################## # Now you can define each stream which will be generated from the # original audio and video stream. Each format has a filename (here # 'test1.mpg'). FFServer will send this stream when answering a # request containing this filename. &lt;Stream test1.mpg&gt; # coming from live feed 'feed1' Feed feed1.ffm # Format of the stream : you can choose among: # mpeg : MPEG-1 multiplexed video and audio # mpegvideo : only MPEG-1 video # mp2 : MPEG-2 audio (use AudioCodec to select layer 2 and 3 codec) # ogg : Ogg format (Vorbis audio codec) # rm : RealNetworks-compatible stream. Multiplexed audio and video. # ra : RealNetworks-compatible stream. Audio only. # mpjpeg : Multipart JPEG (works with Netscape without any plugin) # jpeg : Generate a single JPEG image. # asf : ASF compatible streaming (Windows Media Player format). # swf : Macromedia Flash compatible stream # avi : AVI format (MPEG-4 video, MPEG audio sound) Format mpeg # Bitrate for the audio stream. Codecs usually support only a few # different bitrates. AudioBitRate 32 # Number of audio channels: 1 = mono, 2 = stereo AudioChannels 2 # Sampling frequency for audio. When using low bitrates, you should # lower this frequency to 22050 or 11025. The supported frequencies # depend on the selected audio codec. AudioSampleRate 44100 # Bitrate for the video stream VideoBitRate 64 # Ratecontrol buffer size VideoBufferSize 40 # Number of frames per second VideoFrameRate 3 # Size of the video frame: WxH (default: 160x128) # The following abbreviations are defined: sqcif, qcif, cif, 4cif, qqvga, # qvga, vga, svga, xga, uxga, qxga, sxga, qsxga, hsxga, wvga, wxga, wsxga, # wuxga, woxga, wqsxga, wquxga, whsxga, whuxga, cga, ega, hd480, hd720, # hd1080 VideoSize hd1080 # Transmit only intra frames (useful for low bitrates, but kills frame rate). #VideoIntraOnly # If non-intra only, an intra frame is transmitted every VideoGopSize # frames. Video synchronization can only begin at an intra frame. VideoGopSize 12 # More MPEG-4 parameters # VideoHighQuality # Video4MotionVector # Choose your codecs: #AudioCodec mp2 #VideoCodec mpeg1video # Suppress audio #NoAudio # Suppress video #NoVideo #VideoQMin 3 #VideoQMax 31 # Set this to the number of seconds backwards in time to start. Note that # most players will buffer 5-10 seconds of video, and also you need to allow # for a keyframe to appear in the data stream. #Preroll 15 # ACL: # You can allow ranges of addresses (or single addresses) ACL ALLOW localhost # You can deny ranges of addresses (or single addresses) #ACL DENY &lt;first address&gt; # You can repeat the ACL allow/deny as often as you like. It is on a per # stream basis. The first match defines the action. If there are no matches, # then the default is the inverse of the last ACL statement. # # Thus 'ACL allow localhost' only allows access from localhost. # 'ACL deny 1.0.0.0 1.255.255.255' would deny the whole of network 1 and # allow everybody else. &lt;/Stream&gt; ################################################################## # Example streams # Multipart JPEG #&lt;Stream test.mjpg&gt; #Feed feed1.ffm #Format mpjpeg #VideoFrameRate 2 #VideoIntraOnly #NoAudio #Strict -1 #&lt;/Stream&gt; # Single JPEG #&lt;Stream test.jpg&gt; #Feed feed1.ffm #Format jpeg #VideoFrameRate 2 #VideoIntraOnly ##VideoSize 352x240 #NoAudio #Strict -1 #&lt;/Stream&gt; # Flash #&lt;Stream test.swf&gt; #Feed feed1.ffm #Format swf #VideoFrameRate 2 #VideoIntraOnly #NoAudio #&lt;/Stream&gt; # ASF compatible &lt;Stream test.asf&gt; Feed feed1.ffm Format asf VideoFrameRate 15 VideoSize 352x240 VideoBitRate 256 VideoBufferSize 40 VideoGopSize 30 AudioBitRate 64 StartSendOnKey &lt;/Stream&gt; # MP3 audio #&lt;Stream test.mp3&gt; #Feed feed1.ffm #Format mp2 #AudioCodec mp3 #AudioBitRate 64 #AudioChannels 1 #AudioSampleRate 44100 #NoVideo #&lt;/Stream&gt; # Ogg Vorbis audio #&lt;Stream test.ogg&gt; #Feed feed1.ffm #Title "Stream title" #AudioBitRate 64 #AudioChannels 2 #AudioSampleRate 44100 #NoVideo #&lt;/Stream&gt; # Real with audio only at 32 kbits #&lt;Stream test.ra&gt; #Feed feed1.ffm #Format rm #AudioBitRate 32 #NoVideo #NoAudio #&lt;/Stream&gt; # Real with audio and video at 64 kbits #&lt;Stream test.rm&gt; #Feed feed1.ffm #Format rm #AudioBitRate 32 #VideoBitRate 128 #VideoFrameRate 25 #VideoGopSize 25 #NoAudio #&lt;/Stream&gt; ################################################################## # A stream coming from a file: you only need to set the input # filename and optionally a new format. Supported conversions: # AVI -&gt; ASF #&lt;Stream file.rm&gt; #File "/usr/local/httpd/htdocs/tlive.rm" #NoAudio #&lt;/Stream&gt; #&lt;Stream file.asf&gt; #File "/usr/local/httpd/htdocs/test.asf" #NoAudio #Author "Me" #Copyright "Super MegaCorp" #Title "Test stream from disk" #Comment "Test comment" #&lt;/Stream&gt; ################################################################## # RTSP examples # # You can access this stream with the RTSP URL: # rtsp://localhost:5454/test1-rtsp.mpg # # A non-standard RTSP redirector is also created. Its URL is: # http://localhost:8090/test1-rtsp.rtsp #&lt;Stream test1-rtsp.mpg&gt; #Format rtp #File "/usr/local/httpd/htdocs/test1.mpg" #&lt;/Stream&gt; # Transcode an incoming live feed to another live feed, # using libx264 and video presets #&lt;Stream live.h264&gt; #Format rtp #Feed feed1.ffm #VideoCodec libx264 #VideoFrameRate 24 #VideoBitRate 100 #VideoSize 480x272 #AVPresetVideo default #AVPresetVideo baseline #AVOptionVideo flags +global_header # #AudioCodec libfaac #AudioBitRate 32 #AudioChannels 2 #AudioSampleRate 22050 #AVOptionAudio flags +global_header #&lt;/Stream&gt; ################################################################## # SDP/multicast examples # # If you want to send your stream in multicast, you must set the # multicast address with MulticastAddress. The port and the TTL can # also be set. # # An SDP file is automatically generated by ffserver by adding the # 'sdp' extension to the stream name (here # http://localhost:8090/test1-sdp.sdp). You should usually give this # file to your player to play the stream. # # The 'NoLoop' option can be used to avoid looping when the stream is # terminated. #&lt;Stream test1-sdp.mpg&gt; #Format rtp #File "/usr/local/httpd/htdocs/test1.mpg" #MulticastAddress 224.124.0.1 #MulticastPort 5000 #MulticastTTL 16 #NoLoop #&lt;/Stream&gt; ################################################################## # Special streams # Server status &lt;Stream stat.html&gt; Format status # Only allow local people to get the status ACL allow localhost ACL allow 192.168.0.0 192.168.255.255 #FaviconURL http://pond1.gladstonefamily.net:8080/favicon.ico &lt;/Stream&gt; # Redirect index.html to the appropriate site &lt;Redirect index.html&gt; URL http://www.ffmpeg.org/ &lt;/Redirect&gt; #http://www.ffmpeg.org/ </code></pre> <p>Any help is greatly appreciated, I will do my best draw a picture of the best answer based on their username.</p>
0
How to access docker container from another machine on local network
<p>I'm using Docker for Windows( I am not using Docker Toolbox that use a VM) but I cannot see my container from another machine on local network. In my host everything is perfect and runs well,however, I want that other people use my container.</p> <p>Despite being posting the <a href="https://forums.docker.com/t/how-to-access-docker-container-from-another-machine-on-local-network/4737" rel="noreferrer">same question in Docker's Forum</a> , The answer was not show it. Plus, I have been looking for here but the solutions found it are about setting up the bridge option in the virtual machine , and as I said before, I am using Docker for windows that no use Virtual machine.</p> <p>Docker version Command</p> <pre><code>Client: Version: 1.12.0 API version: 1.24 Go version: go1.6.3 Git commit: 8eab29e Built: Thu Jul 28 21:15:28 2016 OS/Arch: windows/amd64 Server: Version: 1.12.0 API version: 1.24 Go version: go1.6.3 Git commit: 8eab29e Built: Thu Jul 28 21:15:28 2016 OS/Arch: linux/amd64 </code></pre> <p>docker ps -a</p> <pre><code>CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 789d7bf48025 gogs/gogs "docker/start.sh /bin" 5 days ago Up 42 minutes 0.0.0.0:10022-&gt;22/tcp, 0.0.0.0:5656-&gt;3000/tcp gogs 7fa7978996b8 mysql:5.7.14 "docker-entrypoint.sh" 5 days ago Up 56 minutes 0.0.0.0:8989-&gt;3306/tcp mysql </code></pre> <p>The container I want to use is gogs that is working in the port 5656.</p> <p>When I use localhost:5656 y 127.0.0.1:5656 work properly, but when I use My local network IP (192.168.0.127) from other machine the container is unreachable.</p> <p>Thanks in advance.</p>
0
Unable to create converter for class
<p>I am using retrofit in my app and Gson convertor for JSON. I would like to use database when there is not internet connection. I decided to use Sugar ORM. but I get an <code>IllegalArgumentException</code>.</p> <blockquote> <p>java.lang.IllegalArgumentException: Unable to create converter for class </p> </blockquote> <p>here is my object</p> <pre><code>public class User extends SugarRecord implements Parcelable { @SerializedName("id") @Expose private Integer id; @SerializedName("email") @Expose private String email; @SerializedName("name") @Expose private String name; @SerializedName("lastname") @Expose private String lastname; @SerializedName("properties") @Expose @Ignore private List&lt;Object&gt; properties = new ArrayList&lt;&gt;(); @SerializedName("rights") @Expose @Ignore private String rights; @SerializedName("photo") @Expose private String photo; @SerializedName("favorites") @Expose @Ignore private List&lt;PointsOnMap&gt; favorites = new ArrayList&lt;&gt;(); @SerializedName("token") @Expose private String token; public User() { } public User(String name, String lastname, String email, String photo, String token) { this.name = name; this.lastname = lastname; this.email = email; this.photo = photo; this.token = token; } //getters and setters </code></pre>
0
Laravel Access denied for user 'root'@'localhost' (using password: YES) in laravel 4.2
<p>I have old project which built using Laravel 4.2.I am getting following <strong>error</strong></p> <blockquote> <p>PDOException (1045) SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)</p> </blockquote> <p>I have googled and tried every think but i couldn't able to fix it</p> <p><strong>.env</strong> file</p> <pre><code>APP_KEY=az9tq5VHQCV9g5m2CsgY89jtijrCMgEA DB_HOST=localhost DB_DATABASE=billing DB_USERNAME=root DB_PASSWORD=1234 </code></pre> <p><strong>database.php</strong></p> <pre><code>'mysql' =&gt; array( 'driver' =&gt; 'mysql', 'host' =&gt; 'localhost', 'database' =&gt; 'billing', 'username' =&gt; 'root', 'password' =&gt; '1234', 'charset' =&gt; 'utf8', 'collation' =&gt; 'utf8_unicode_ci', 'prefix' =&gt; '', ), </code></pre> <p><a href="https://i.stack.imgur.com/K37FT.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/K37FT.jpg" alt="enter image description here"></a></p> <p>Can any one guide me where m doing wrong ? </p> <p>Note: Before asking question i tried by updating composer update as well as most of the stackoverflow answers.</p> <p><strong>Updated</strong></p> <p>I have tested this connection by creating php file</p> <pre><code>&lt;?php $servername = "localhost"; $username = "root"; $password = "1234"; // Create connection $conn = new mysqli($servername, $username, $password); // Check connection if ($conn-&gt;connect_error) { die("Connection failed: " . $conn-&gt;connect_error); } echo "Connected successfully"; ?&gt; </code></pre> <p>i will get Connected successfully message</p>
0
Incompatible version of android studio with the Gradle version used
<p>My android-studio version is the latest 2.1.3,and I am try to update gradle to gradle-3.0-all with plugin 2.2.0-beta3. When I build it was ok but when run the ide report that "Incompatible version of android studio with the Gradle version used." How can I resolve this?Should I use android-studio 2.2+?</p>
0
Spring Boot and MongoDB - how to save date
<p>I've followed the Spring.io guide for accessing MongoDB data with rest (<a href="https://spring.io/guides/gs/accessing-mongodb-data-rest/" rel="noreferrer">https://spring.io/guides/gs/accessing-mongodb-data-rest/</a>) and can save documents into mongo.</p> <p>When I try to add a date field into the POJO and set the date as a <code>new Date()</code> object, it just saves the value as null when it saves to mongo.</p> <p>I've created an extremely basic <code>@RestController</code> which is working fine (passes in the request body, and saves it down using my <code>MongoRepository</code> class), saving documents via the rest console. I tried creating a new date in here and setting it before saving it down to Mongo but this gives me something like <code>"createdDate": 1472394366324</code>.</p> <p>I can save dates as a string into Mongo, but what I want is to be able to save dates in the date format so I can query them with a basic 'date between' query (so something like this, the exact format doesn't matter much - <code>"date" : ISODate("2014-02-10T10:50:42.389Z")</code>. I can write the queries to get values via parameters, but to get the 'date between' query working I need to be able to store date values into Mongo.</p> <p>What is the easiest way to accomplish this?</p> <p>Edit:</p> <p>Pojo class -</p> <pre><code>import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @Document(collection = "Musicians") public class Musician { @Id private String id; private String firstName; private String lastName; @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) private Date createdDate = new Date(); public Musician() {} public Musician(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; //createdDate = new Date(); } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public Date getCreatedDate() { return createdDate; } public void setCreatedDate(Date createdDate) { this.createdDate = createdDate; } } </code></pre> <p>The RestController class -</p> <pre><code>@RestController @RequestMapping(value = "/musicians") public class MusicianController { @Autowired MusicianRepository musicianRepository; @Autowired MongoTemplate mongoTemplate; @RequestMapping(method = RequestMethod.POST, value = "") public ResponseEntity&lt;HttpStatus&gt; createMusician(@RequestBody Musician musician) { Musician musicianIn = musician; musicianRepository.save(musicianIn); return new ResponseEntity(HttpStatus.ACCEPTED); } @RequestMapping(method = RequestMethod.GET, value = "") public ResponseEntity&lt;List&lt;Musician&gt;&gt; getMusicians() { List&lt;Musician&gt; musicians = musicianRepository.findAll(); return new ResponseEntity&lt;List&lt;Musician&gt;&gt;(musicians, HttpStatus.OK); } } </code></pre>
0
Difference between Session and Connection in SQL Server
<p>In case of temporary tables, we see that they are connection dependent. I mean that tables created in one connection is only available to that connection and automatically dropped when the connection is lost or destroyed.</p> <p>What is the difference between connection and session in SQL Server?</p>
0
How to get a working Progress Bar in python using multi-process or multi-threaded clients?
<p>That's the basic idea. </p> <p>I couldn't understand them while reading about all this in python's documentation. There's simply too much of it to understand it.</p> <p><strong>Could someone explain me how to get a working progress bar with a multi-threaded(or multi-process) client?</strong></p> <p><strong>Or is there any other way to "update" progress bar without locking program's GUI?</strong></p> <p>Also I did read something about "I/O" errors when these types of clients try to access a file at the same time &amp; X-server errors when an application doesn't call multi-thread libs correctly. <strong>How do I avoid 'em?</strong></p> <p>This time I didn't write code, I don't want to end with a zombie-process or something like that (And then force PC to shutdown, I would hate to corrupt precious data...). I need to understand what am I doing first!</p>
0
Could not fetch model of type 'EclipseProject' using Gradle distribution
<p>I get the following exception while importing a Gradle project in Eclipse Neon (Buildship 1.0.18 / Gradle IDE 3.8.1 ):</p> <pre><code>org.gradle.tooling.GradleConnectionException: Could not fetch model of type 'EclipseProject' using Gradle distribution 'https://services.gradle.org/distributions/gradle-3.0-bin.zip'. at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:55) at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:29) at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:41) at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54) at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46) at org.gradle.tooling.internal.consumer.DefaultModelBuilder.get(DefaultModelBuilder.java:51) at com.gradleware.tooling.toolingclient.internal.DefaultToolingClient.executeAndWait(DefaultToolingClient.java:106) at com.gradleware.tooling.toolingclient.internal.DefaultModelRequest.executeAndWait(DefaultModelRequest.java:79) at com.gradleware.tooling.toolingmodel.repository.internal.BaseModelRepository$1.get(BaseModelRepository.java:95) at com.gradleware.tooling.toolingmodel.repository.internal.BaseModelRepository.executeAndWait(BaseModelRepository.java:163) at com.gradleware.tooling.toolingmodel.repository.internal.BaseModelRepository.access$000(BaseModelRepository.java:41) at com.gradleware.tooling.toolingmodel.repository.internal.BaseModelRepository$2.call(BaseModelRepository.java:121) at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4724) at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3522) at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2315) at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2278) at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2193) at com.google.common.cache.LocalCache.get(LocalCache.java:3932) at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4721) at com.gradleware.tooling.toolingmodel.repository.internal.BaseModelRepository.getFromCache(BaseModelRepository.java:138) at com.gradleware.tooling.toolingmodel.repository.internal.BaseModelRepository.executeRequest(BaseModelRepository.java:117) at com.gradleware.tooling.toolingmodel.repository.internal.BaseModelRepository.executeRequest(BaseModelRepository.java:88) at com.gradleware.tooling.toolingmodel.repository.internal.DefaultSingleBuildModelRepository.fetchEclipseGradleBuild(DefaultSingleBuildModelRepository.java:185) at org.eclipse.buildship.core.workspace.internal.DefaultModelProvider.fetchEclipseGradleBuild(DefaultModelProvider.java:53) at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildsJob.synchronizeBuild(SynchronizeGradleBuildsJob.java:77) at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildsJob.runToolingApiJob(SynchronizeGradleBuildsJob.java:69) at org.eclipse.buildship.core.util.progress.ToolingApiJob$1.run(ToolingApiJob.java:73) at org.eclipse.buildship.core.util.progress.ToolingApiInvoker.invoke(ToolingApiInvoker.java:61) at org.eclipse.buildship.core.util.progress.ToolingApiJob.run(ToolingApiJob.java:70) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Caused by: java.lang.IllegalArgumentException at com.google.common.base.Preconditions.checkArgument(Preconditions.java:111) at org.gradle.plugins.ide.eclipse.model.Link.&lt;init&gt;(Link.java:36) at org.gradle.plugins.ide.eclipse.internal.LinkedResourcesCreator.links(LinkedResourcesCreator.java:42) at org.gradle.plugins.ide.eclipse.EclipsePlugin$2$2$1.call(EclipsePlugin.java:182) at org.gradle.plugins.ide.eclipse.EclipsePlugin$2$2$1.call(EclipsePlugin.java:179) at org.gradle.util.GUtil.uncheckedCall(GUtil.java:401) at org.gradle.api.internal.ConventionAwareHelper$2.getValue(ConventionAwareHelper.java:84) at org.gradle.api.internal.ConventionAwareHelper$MappedPropertyImpl.getValue(ConventionAwareHelper.java:133) at org.gradle.api.internal.ConventionAwareHelper.getConventionValue(ConventionAwareHelper.java:111) at org.gradle.plugins.ide.eclipse.model.EclipseProject_Decorated.getLinkedResources(Unknown Source) at org.gradle.plugins.ide.internal.tooling.EclipseModelBuilder.populate(EclipseModelBuilder.java:217) at org.gradle.plugins.ide.internal.tooling.EclipseModelBuilder.buildAll(EclipseModelBuilder.java:113) at org.gradle.plugins.ide.internal.tooling.EclipseModelBuilder.buildAll(EclipseModelBuilder.java:67) at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.createModelResult(BuildModelActionRunner.java:76) at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:67) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:58) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:82) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49) at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:59) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:49) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72) at org.gradle.util.Swapper.swap(Swapper.java:38) at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.HintGCAfterBuild.execute(HintGCAfterBuild.java:44) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50) at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:240) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54) at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) </code></pre> <p>I found almost the same exception here: <a href="https://stackoverflow.com/questions/32029093/could-not-fetch-model-of-type-eclipseproject-using-gradle">Could not fetch model of type &#39;EclipseProject&#39; using Gradle</a> but the solution was to use the latest Gradle version (currently 3.0)</p> <p>The same scenario was reported on <a href="https://discuss.gradle.org/t/could-not-fetch-model-error-when-converting-project-to-gradle-using-buildship/19022" rel="nofollow noreferrer">https://discuss.gradle.org/t/could-not-fetch-model-error-when-converting-project-to-gradle-using-buildship/19022</a> but with no answers so far.</p> <p>The reported resource is available for download: <a href="https://services.gradle.org/distributions/gradle-3.0-bin.zip" rel="nofollow noreferrer">https://services.gradle.org/distributions/gradle-3.0-bin.zip</a></p> <p>Does anybody have workarounds for this problem? Thank you.</p>
0