Menu
  • HOME
  • TAGS

shorten vectors by using certain means

r,vector

You can work it out like this: set.seed(1) (list <- replicate(3, sample(1:10, 10, T), simplify = FALSE)) # [[1]] # [1] 3 4 6 10 3 9 10 7 7 1 # # [[2]] # [1] 3 2 7 4 8 5 8 10 4 8 # # [[3]] #...

Cocoa Static Library - Some Third Party Source Files Are Not Working Properly

ios,static-libraries,cocoahttpserver

You are using a categories in your static lib. Read this: Building Objective-C static libraries with categories...

How to find Apache HTTP Server inside Tomcat

java,apache,tomcat

Apache Config in the above tutorial refers to configuration of the Apache HTTP Server. Apache HTTP Server and Apache Tomcat is two different projects. To configure Expires and max-age of Cache-Control header in Apache Tomcat refer to this documentation of the ExpiresFilter

serialize and deserialize Clojure ::namespaced-keywords in JSON

json,authentication,serialization,clojure

Looking at the tests in Chesire, it's quite obvious that the optional keyword parameter to parse-string will affect all name attributes in a JSON object, value attributes like the namespaced keyword in your example are not affected. Actually, your problem is two-fold: the original set is also not converted back...

How to modify my T-SQL UPDATE query by adding a CONDITIONAL clause?

sql-server,sql-update

If you specifically only want to affect the records in December, use the DATEPART function: USE MyDatabase UPDATE ResStayDate SET RateAmount = CASE WHEN ResID = 256 and DATEPART(MONTH,StayDate) = 12 THEN 155.00 ELSE RateAmount END ...

Canvas Colour Match Range

javascript,canvas

Disclaimer This answer is based on OP's code and may not be the best way of doing it. To check if the actual pixel is in the range you defined by threshold, you can use some if statement like-so : if(data[i]>=color[0]-threshold/2 && data[i]<=color[0]+threshold/2 && data[i+1]>=color[1]-threshold/2 && data[i+1]<=color[1]+threshold/2 && data[i+2]>=color[2]-threshold/2 &&...

How to access custom view properties after initialize

ios,swift

You should check if you have connected your topScrollerConstraint to the file's owner since it will not get instantiated and therefore, error. Here is a recent SO question regarding difference between these two: What is File’s owner in XIB in this case?...

Delphi how to implement baseclass event?

delphi,inheritance,keypress

You should override KeyDown method in your base form class. type TBaseForm = class(TForm) protected procedure KeyDown(var Key: Word; Shift: TShiftState); override; end; procedure TBaseForm.KeyDown(var Key: Word; Shift: TShiftState); begin // do your processing here // ... inherited; // call inherited method that will call OnKeyDown if assigned end; This...

How to target the chrome browser for Mac only?

javascript,jquery,css,cross-browser

Use JavaScript something like below. if (navigator.userAgent.match(/Macintosh/) && navigator.userAgent.match(/Chrome/)) ...

Resize function to replace divs disables onclick function

javascript,jquery

It's due to divs being created/erased dynamically. What you need is event delegation. Event delegation allows us to attach a single event listener, to a parent element, that will fire for all descendants matching a selector, whether those descendants exist now or are added in the future. Replace: $('div').on({click: function()...

How to convert a list to datatable

c#,json

i only want a Datatable which contains only the rows which are in List<Datum> Since you already have the method it's simple: DataTable tblDatum = ToDataTable(myobj.data) ...

Datatables column filter checkbox not working with Ajax

jquery,ajax,datatables

Without knowing anything about what is going on - all we know is a comment about "it is not working when I get data from ajax" - and therefore assuming everything else is working great, no news is good news etc; and taken notice of ColumnFilter as being an old...

How to implement custom authentication in ASP.NET MVC 5

c#,asp.net-mvc,authentication,authorization,asp.net-identity

Yes you can. Microsoft's Identity framework's authentication and authorization parts works independently. If you have own authentication service you can just use Identity's authorization part. Consider you already have a UserManager which validates username and password. Therefore you can write following code in your post back login action: [HttpPost] public...

css vertical-align not working

css,vertical-alignment

Set a line-height for the paragraph p { line-height: 32px; vertical-align: middle; } p { line-height: 32px; vertical-align: middle; } <head> <style type="text/css"> html * { margin: 0px; padding: 0px; } .Title { width: 50%; display: inline-block; vertical-align: middle; text-align: center; font-weight: bold; font-size: larger; border: solid; border-width: thin; }...

Python split a string w/ multiple delimiter and find the delimiter used

python,regex,string,split

string ="someText:someValue~" print re.split("(:|~)",string,1) If you put in group,it will appear in the list returned.You can find it from 1 index of list....

Eclipse: SourceType to Class (or get current parameters of the Class)

java,eclipse,jdt,eclipse-jdt

To get the type arguments of a type's superclass (IType sourceType) use String superSignature = sourceType.getSuperclassTypeSignature(); for (String typeArgument : Signature.getTypeArguments(superSignature)) System.out.println(Signature.getSignatureSimpleName(typeArgument)); Utility Signature is org.eclipse.jdt.core.Signature. To get the next IType from its fully qualified name use: IJavaProject project = sourceType.getJavaProject(); IType type = project.findType(qualifiedTypeName); If you have an unresolved...

How can I get an error message when no file is selected in my file uploader?

php,html

<html> <body> <script> function unlock(){ document.getElementById('buttonSubmit').removeAttribute("disabled"); } </script> <form action="done.php" method="post" enctype="multipart/form-data"> <input type="file" onchange="unlock();" name="file"> <button type="submit" id="buttonSubmit" value="upload" disabled>Upload</button> </form> </body> </html> ...

TypeError: options.xhr is not a function

javascript

As you are using jQueery, here's code I know works - it adds progress event to jQueery's ajax family of functions, it's used every day on company website (function ($) { var originalXhr = $.ajaxSettings.xhr; $.ajaxSetup({ progress: function () { }, upprogress: function () { }, xhr: function () {...

varchar(max) is truncating the string when set in a variable

sql,sql-server,varchar,truncate

The SQL function PRINT will only show a maximum of 8000 char, the variable still has the full content. Try running this: PRINT LEN(@sql) You should see a much larger number....

How to add additional functionalities?

javascript,html,javascript-objects

As you see the heading block is for the title of the blog. All you need is just making it more visible. var entrytext = ""; entrytext += "<div class=" + text + ">"; entrytext += "<h1>" + heading + "</h1>"; entrytext += "<" + head + ">"; entrytext +=...

Using AsyncTask to display web service data in ListView

android,listview,android-asynctask

public class MainActivity extends AppCompatActivity { private static final String SOAP_ACTION = "http://tempuri.org/IService/AllUserName"; private static final String METHOD_NAME = "AllUserName"; private static final String NAMESPACE = "http://tempuri.org/"; private static final String URL = "http://10.0.2.2:50006/WCFService2/Service.svc?wsdl"; String[] userNames = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); new AsyncTask<Void , Void,...

links not working as required when used with reparenting

jointjs

The paper event cell:pointerup is triggered for both elements and links. getBBox() is not defined for links. You are trying to call an undefined method link.getBBox() inside the cell:pointerup handler. The solution can be either to check whether the cellView is an element and than proceed the reparenting or...

How to write quotes (" or ') and quoted strings to a Razor view

c#,razor,asp.net-mvc-5

You should return your output as an MvcHtmlString instead, otherwise MVC will encode it: private static MvcHtmlString Render(ResourceSet resources) { string resourceString = ""; foreach (DictionaryEntry resource in resources) { resourceString += String.Format("var {0} = '{1}'; ", resource.Key, resource.Value); } return new MvcHtmlString(resourceString); } Alternatively, you can use the Html...

ajax Check if Email already exist Ruby on Rails

ruby-on-rails,ruby,ajax

It is a typo, just make it like this and try: $("#user_email").on('change keyup paste',function(){ console.log("change?"); $.post('/checkemail?email='+$("#user_email").val(),function(data){ }); }); And in the routes make it to this: post '/checkemail', to: 'users#emailcheck' Or whatever you have written make this: user#emailcheck to users#emailcheck as controllers are always in plural form. In your users_controller...

Java Empty part of splitted string

java,string,split

You should check if a.length < 4 Now you already call an item which does not exist, do instead for(int i=0;i<a.length;i++) // will never get an IndexOutOfBounds a[i];// <-- do something.... ...

Adding property to object, defining it and immediately logging it returns undefined

javascript

Because you need to use this.baz to access the variable you've added earlier. this inside the foo() refers to the foo function. But, when you log baz it'll be searched on the window(global) object, since it is not defined in the foo(). So, your statement is like: console.log(window.baz); Since baz...

Fragment communicating with an Activity

java,android,android-fragments,interface

Your mCallback is your activity, in the onAttach method of your fragment, you will set the activity as listener for your fragment. By this way, this is normal that the activity is notified when you call mCallback.onArticleSelected(position);

Python: Getting the top 4 Highest Values in a 2d List

python,arrays,list,python-3.x,2d

I would probably have used a dict but you can zip the lists together to make pairs then sort: teams = ["Randomteam1","Randomteam2","Randomteam3","Randomteam4","Randomteam5","Randomteam6"] team_info = [[7, 2, 1, 1, 3], [4, 1, 1, 1, 3],[2, 0, 2, 2, 3], [12, 3, 0, 0, 3], [9, 0, 2, 2, 3], [10, 3,...

Linq every occurrence of value, bind to ViewModel

c#,linq

Try something like this: var viewModels = playerDetail.Select(p => new PlayersViewModel() { PlayerID = p.PlayerID, PlayerName = String.Format("{0} {1}", p.ForeName, p.Surname), TeamID = pid.Where(pidElement => pidElement.PlayerID == p.PlayerID) .Select(pidElement => pidElement.TeamID).ToList() }).ToList(); In general it seems to me you're trying to tackle the problem from the wrong end. You want...

create custom authenticate controller with different database filed in Laravel

php,laravel,laravel-5,laravel-5.1

There are 3 things you need to do. Pass plain-text password to Auth::attempt() as Laravel will hash that itself before verifying it against the hash stored in the database. Auth::attempt(['u_email'=>$credentials['email'],'password' => $credentials['password']]); Pass password as password, not u_password to Auth::attempt(). The key doesn't need to match the password column name...

Protect againg “Overposting Forms” within Symfony

php,forms,symfony2,model-binding,binder

If you use the cookbook approach to symfony2 forms, you already have that protection, alongside with CSRF protection. If you add an extra field to the request you will get the following error: This form should not contain extra fields Example Form: class FooType extends AbstractType { public function buildForm(FormBuilderInterface...

SQL Left Outer Joins displaying Nulls

sql,join

Your query is: SELECT sp.ID, sp.Spcode, sp.CommonName, rl.Description FROM tblSalesPerson sp LEFT OUTER JOIN tblRegionLookup rl ON sp.Region = rl.Region ORDER BY sp.CommonName asc; If rl.Description is NULL, then there is no match between the tables. The problem is that "PCNW" in the first table does not match "PCNW" in...

Advanced text replacement

regex,string,replace,anki

This regex should deal with the cases you are looking for (including matching the longest possible pattern in the first column): ^(\S+)(\S*?)\s+?(\S*?(\1)\S*?)$ Regex demo here. You can then go on to use the match groups to make the specific replacement you are looking for. Here is an example solution in...

how to download image from server and store in internal storage using JSON in android

android,json,bitmap

You get String in response to server. Then you create json object String strResponse = ... JSONObject jsonObject = new JSONObject(strResponse); JSONArray pagesArray = jsonObject.getJSONArray("pages"); for (int i=0;i<pagesArray.length();i++){ JSONObject pageObj = pagesArray.getJSONObject(i); JSONArray pageImagesArray = pageObj.getJSONArray("page_image"); for (int j=0;j<pageImagesArray.length();j++) { JSONObject image = pageImagesArray.getJSONObject(j); String urlImg = image.getString("image"); } }...

Is xcdatamodel needed?

ios,objective-c,core-data,xcdatamodel

A. Yes, you need a data model. You get it with File | New … | File and in the sheet iOS | Core Data | Data Model. However it is easier to create a Core Data application from the very beginning. B. Classes and entity (types) can have different...

case sensitivity when running OS X app from terminal

osx,bash,terminal,case-sensitive

Actually, this is a consequence of the formatting of the hard drive you're using. If your hard drive (or SSD) had "case-sensitive" formatting, that's why you need to be explicit about MacOS instead of macos. If you had formatted your hard drive for simply "Journaled", then you could get away...

Oracle Update table to set specific attribute value in semicolon separated values

sql,oracle

i hate it but... update table set column = replace(column,'New_eMail+Y','New_eMail+N') where column like '%New_eMail+Y%' you don't need the WHERE clause but if you put a functional index on the table it may be quicker with it...

Django Subdomains - Web page has a redirect loop

python,django,nginx,gunicorn

Your first redirect is correct, but then you redirect again even though you are on the right domain. This results in the redirect loop. You need to check if the current subdomain matches the intended subdomain, and if it does, return None instead of a redirect: if len(domain_parts) > 2:...

How to View Deadlock Transactions In SQL Server?

sql,sql-server

Use this query SELECT db.name DBName, tl.request_session_id, wt.blocking_session_id, Object_name(p.OBJECT_ID) BlockedObjectName, tl.resource_type, h1.TEXT AS RequestingText, h2.TEXT AS BlockingTest, tl.request_mode FROM sys.dm_tran_locks AS tl INNER JOIN sys.databases db ON db.database_id = tl.resource_database_id INNER JOIN sys.dm_os_waiting_tasks AS wt ON tl.lock_owner_address = wt.resource_address INNER JOIN sys.partitions AS p ON p.hobt_id = tl.resource_associated_entity_id INNER JOIN...

How to convert int array to List>?

c#,linq,keyvaluepair

Something like this: var res = ints.Select(x => new KeyValuePair<int, string>(x, "")).ToList(); Or also possible: var dict = ints.ToDictionary(x => x, x => "") Which will create a dictionary which basically IS a list of KeyValue-pairs....

How to fix only fix a bootstrap menu at the top on scroll

jquery,css,html5,twitter-bootstrap

var distance = $('#menu').offset().top; $(window).scroll(function () { if ($(window).scrollTop() >= distance) { $('#menu').addClass("navbar-fixed-top"); } else { $('#menu').removeClass("navbar-fixed-top"); } }); remove your navbar-fixed-top class and try this js...

ZipFile bad directory structure

python,archive,zipfile

You can specify arcname parameter in the write method: import sys import os import zipfile source_dir = "C:\\myDir\\yourDir" zip = zipfile.ZipFile("C:\\myDir\\yourDirZip.zip","w",allowZip64=True) for root, dirs, files in os.walk(source_dir): for f in files: zip.write(os.path.join(root,f), arcname=f) zip.close() ...

PHP handling form inputs

php,forms

You should treat Javascript validation as a "bonus" where PHP validation is a must. Is better that to use empty() instead of isset() on input validation, since will return TRUE even user does not key in any value. if( !( empty($_POST['inputTitle']) || empty($_POST['inputName']) || empty($_POST['inputSurname']) || empty($_POST['inputEmail']) || empty($_POST['inputLinks']) )...

Need help changing variable value to then change a displayed message

javascript,function,button,var

Your javascript is in a big mess, below I have fixed the issues in it mathstuff = function(){ var x = Math.floor((Math.random() * 10) + 1); document.getElementById("demo").innerHTML = x; } mathstuff2 = function() { var x = Math.random(); document.getElementById("demo2").innerHTML = x; } onetoten = function() { var x, text; //get...

Cannot post to asp.net MVC controller

asp.net-mvc,post

I see a couple of issues here. First the name of your controller should follow the convention of SomenameController, so you might want to call it MVCcontrollerNameController The URL you specify is missing a slash to delimit between the path and the controller name: url: 'apiUrl' + '/' + 'MVCcontrollerName'...

Dynamic selection of names on element in jquery

jquery

Use + for concatenation. Also, * is not required. $('[name=' + elemName + ']').val(''); // ^ ^ OR, you can select all the elements whose name starts with item as follow, without for loop. $('[name^="item"]').val(''); ...

Hapi good how to print debug message without using console log

node.js,hapijs

Debug is pretty good. Or, if you want to stay inside the hapi ecosystem, you can use Good to manage your logging needs: var Hapi = require('hapi'); var server = new Hapi.Server(); server.connection({ port: 4000 }); var options = { reporters: [{ reporter: require('good-console'), // Log everything to console events:...

express + hogan how to handle session?

javascript,node.js,session,express,hogan.js

I can't find any document about session in hoganjs, it seems only handle template? Hogan is template engine. All it does is process templates. You are correct. (See: what is a template engine?) So does that mean I have to detect in routes/Index.js and render different file? Nope. What...

How do I get Laravel to specify my charset in all responses?

laravel,character-encoding

You can change charset in the middleware: <?php namespace App\Http\Middleware; use Closure; class SetCharset { public function handle($request, Closure $next) { $response = $next($request); $response->header('Content-Type', 'text/html; charset=windows-1252'); return $response; } } Just make sure that all the content you return is in proper encoding....

No symbol in shared library of implemented parent method

c++,linker,shared-libraries,static-libraries

You won't see any symbols for the pure virtual functions in the base class unless you write definitions for them, as the compiler cannot possibly output any symbol for a definition that doesn't exist. You also won't see any definitions for the overrides in the derived class unless you call...

IOS Objective C - Error receiving json data from url

ios,objective-c,json

Not 100% sure about your implementation of Provincias but I think your problem is here: prov.tipoProvincia = [dic objectForKey:@"Provincia"];// -> ok prov.tipoIdProvincia = [dic objectForKey:@"idProvincia"];// -> try to send int message to convert String to Int prov.tipoNumActos = [dic objectForKey:@"Actos"]; // -> same here Your objects in dict are NSString...

$watch not firing as many times as expected

javascript,angularjs,watch

A $watch will only fire once during each angular $digest cycle! (If watching a property that is - the simplest scenario). The three changes you are making to foo are all occurring during the same cycle. And angular will compare the values before the cycle and after the cycle. For...

Count number of occurrence with a 'class' condition

r,class,condition,find-occurrences

Here is a dplyr solution tab <- read.table(text="R sp N Hauteur Alt Plot Quadrat Microhab Cover R2 B 1 0-50cm 350 P1 Q1 TA 50 R2 D 1 0-50cm 350 P1 Q1 TA 50 R3 A 2 0-50cm 550 P1 Q1 TA 95 R3 C 1 0-50cm 550 P1 Q1...

Getting javascript variable value inside html

javascript,html

Replace 12 with something like a label and give it an id. Let's call the id="totalQty". In the Javascript $totalQty.val() = 12 or what ever you want to set it to....

specify view's column type

sql,sql-server,tsql,view

Use a CAST: CREATE VIEW [dbo].[myview] (a,b,c) AS SELECT a,b,CAST(NULL AS NVARCHAR(100)) c; ...

Pass params in ng-include

javascript,html,angularjs,templates

There is no way to pass parameters to an ng-include. It does have access to the same scope as the HTML it's in, though. If you need to be able to pass different parameters, you're going to have to use a directive: angular.module("myModule") .directive('radioButton', [function () { return { restrict:...

Angular JS $scope.$on in a directive don't affect scope variable

angularjs,scope,rootscope

Since it's an async call, which is outside AngularJS lifecycle, you need to run $scope.$apply explicitly to trigger a $digest, which will update the view: $scope.$apply(function () { $scope.progress = data; }); ...

Why does the container lose 10px height?

javascript,jquery,html

Because you can only draw at full pixels. The height of each square is rounded from 38.4px down to 38px. 25 * 38px = 950px.

In PostgreSQL on Windows what effect does the locale have on a database itself

postgresql,postgresql-9.3

It affects the text encoding ("code page") chosen for the DB, as well as the collation (sort order) used for text. Changing either requires that you dump the database, drop it, re-create it and restore a dump. When creating the database you can specify a specific ENCODING, LC_CTYPE, LC_COLLATE etc...

Copy a file from a network share to a remote PC`s harddisk

powershell,powershell-4.0

You can do it like this: Copy-Item -Path X:\Test.txt '\\MyComputerNameOrIP\D$'

How does angular binding happen?

angularjs,angularjs-watch,angularjs-bindings

Your understanding of how Angular sets up a watcher for each binding is pretty much right on the money. I'll go ahead and jump straight to the question, as opposed to debunking/discussing your point of view of what the inner workings of Angular bindings look like. I have a question...

Reverse lastIndexOf

javascript,jquery

The definition is string.substring(start,end) so you can simply str_dateId = str_firstId.substring(0, str_firstId.lastIndexOf("_"));...

Center div over multiple divs

html,css

If you wrap the images and overlay in a parent element with position: relative you will be able to use position: absolute on the overlay element to position it on top of the images. Here's a quick example: https://jsfiddle.net/hmpxdezy/1/ Edited answer: Based off your jsFiddle, is it div.custom you want...

Temporary table creation

php,mysql

The value "WR" is an alias for the query, not a temporary table. It doesn't copy the data in memory, it's just a shortcut to make the query shorter/easier to read. Here's an example: SELECT * FROM countries c WHERE c.code = "GB" Expands to be: SELECT * FROM countries...

r - nth occurrence in a dataframe [duplicate]

r

Or if you're feeling dplyr-ishly loopless: new.df <- my.df %>% group_by(FirstName) %>% mutate(Index=1:n()) Or you can just use row_number() Or using data.table library(data.table) setDT(my.df)[, Index := seq_len(.N), by = FirstName] Or just base R with(my.df, ave(seq(FirstName), FirstName, FUN = function(x) seq(length(x)))) ...

Django: how to inject data when overriding get_queryset()?

python,django,django-class-based-views

The keyword arguments (kwargs) that the Django URL dispatcher passes to the view comes from the following: Captured parameters in the URL expression Additional arguments specified in the URL definition All of them in urls.py. So, for example, in order to get an ID form the URL in a form:...

How do I append the attribute value to each element on a page?

jquery

You may use each , html and using data to grab the data-* attribute. $("li[data-update-id]").each(function(){ $(this).html($(this).data('update-id')); }); ...

Why plus operator in brackets works differently?

javascript

From: http://www.2ality.com/2012/01/object-plus-object.html The problem is that JavaScript interprets the first {} as an empty code block and ignores it. The NaN is therefore computed by evaluating +{} (plus followed by the second {}). The plus you see here is not the binary addition operator, but a unary prefix operator that...

Direct binding deployment with Kafka as message bus

spring-xd

Per the documentation, the XD KafkaMessageBus does not currently support direct binding... NOTE: The Kafka message bus does not support count=0 for module deployments, and therefore, it does not support direct binding of modules. This feature will be available in a future release. In the meantime, if direct communication between...

mysqli_result::fetch_all returning Null

php,mysqli,null

num_rows returned result set identifier by mysqli_query() So instead of if($result->num_rows>0) You use if($stmt->num_rows>0) ...

Why is my dictionary empty?

python,list,dictionary

Since you have a list of list of pairs, List_of_list_of_pairs[n] would still be the list of pairs, it will not be the pairs. But your code is assuming that List_of_list_of_pairs[n] is the pair , which it isn't. You should iterate over first List_of_list_of_pairs and then the elements in it (which...

List to Object[]

java,list,object,casting

You cannot. However, the List interface offers the toArray() method. So: Object[] rows = responseMap.get("data").toArray(); ...

button fade-in at bottom of screen

javascript,html,css

Subtract 150 from document height and write in else to fedout. <script> $(window).scroll(function() { if($(window).scrollTop() + $(window).height() == $(document).height()-150){ isShown = true; $('.footer-btn').fadeIn(500); }else{ $('.footer-btn').fadeOut(500); } }); </script> ...

Always 'Entity first' approach, when designing java apps from scratch?

java,database-design,architecture,uml,entity-model

As you expect - my answer is it depends. The problem is that there are so many possible flavours and dimensions to a good design you really need to take the widest view possible first. Ask yourself some of the big questions: Where is the core of the system? Is...

Custom error message is not working laravel5.1 form request?

php,validation,laravel,laravel-5.1

It is messages, not message. Change public function message() to public function messages() ...

If element has class and another element is empty change class on another element

javascript,jquery,html

One easy way is(assuming the empty span will be <span></span>, ie there is no blank content in it) jQuery(function ($) { $('#showEmpty').click(function () { $('div.package.array').has('span.value:empty').find('span.name').removeClass('name').addClass('empty'); }); }); Here we finds div with classes package and array which has an empty span with class value, then find the span with class...

Edit text size should not alter the size of Image-view

android,android-layout,android-edittext,android-imageview

The problem is in using android:layout_above="@+id/caption_holder". It says that ImageView is above the caption_holder, so when caption_holder is resized, ImageView is resized too. Try to remove this attribute....

how to reconnect to a docker container

node.js,docker,boot2docker

You can consider docker exec to open a bash in your running container. See also "difference between docker attach and docker exec" docker exec -it f32de2737e80 bash But as commented, updated the app should be done by modifying a Dockerfile and rebuilding an image....

Regular expression error when using stringr (R package) to search for curly brackets

regex,r

{ is a special character - you have to escape it: str_locate_all(textstring, '\\}') ...

IF Button in datagridview is clicked vb.net

vb.net,datagridview

I would suggest to use handle the CellContentClick event instead, which fires only when content in a cell is clicked. The CellClick event will fire when any part of a cell is clicked. Additionally your code has an issue where you are comparing the wrong value for the column name...

Change background color of JTable whole row based on column value

java,swing,jtable,tablecellrenderer

The problem with your approach is that you use getTableCellRendererComponent so only that cell will have its color changed. I had to make something similar. Based on the value of a column, I had to color the row. I used a class that extended the JTable and Override prepareRenderer @Override...

Get parent Div and then the elements inside

javascript,jquery,html

Use find() instead $(".memberMore ").click(function(e) { e.preventDefault(); //Get the 'parent' div (memberDiv) var myDiv = $(this).closest("div"); console.log($(myDiv).find(".myUserName").text()); return false; }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script> <div class="memberDiv" style="position:relative"> <p class="myUserName"><strong>Jo Bloggs</strong> </p> <p class="myJobTitle">Widget Maker</p> <p...

sql left join possible no relationship

sql,left-join

Why did you "stop" after the first LEFT JOIN? Do the same with the other tables: SELECT leads.id AS id, CONCAT(leads.first_name,' ',leads.surname) AS lead_name, leads.country AS country, CONCAT(employees.first_name,' ',employees.surname) AS booked_by, lead_call_logs.create_datetime FROM leads LEFT JOIN lead_call_logs ON leads.id = lead_call_logs.lead_id LEFT JOIN users ON lead_call_logs.create_by = users.id LEFT JOIN...

About maven and gradle, how to use them?

java,android,maven

try changing compile 'net.dongliu:apk-parser-2.0.14' to compile 'net.dongliu:apk-parser:2.0.14' ...

Qt - Creating Icon Button

c++,qt,qaction

When you call addAction(addButton);, Where do you intend to add the action. Example: ui->mainToolBar->addAction(addButton); QPushButton will meet your requirement. You can style the push button using style sheet. Example: QPushButton *addButton = new QPushButton(QIcon(":/plus.png"),""); QString buttonStyle = "QPushButton{border:none;background-color:rgba(255, 255, 255,100);}"; addButton->setStyleSheet(buttonStyle); // Style sheet addButton->setIconSize(QSize(50,50)); addButton->setMinimumSize(50,50);...

Declare const in Qt and access from 2 different classes

c++,qt

I want to declare const variable in one class and use this variable in other classes. Those strings aren't part of your ProtocolCommands class; they just happen to be declared in that compilatition unit. If you want them as (static) members of the class, then declare them inside the...

Sequential procedures in Lisp

functional-programming,lisp,common-lisp

An usual way in Common Lisp would be to use LET* (let* ((thing1 (thing-operation0 thing0 extra-arg0)) (thing2 (thing-operation1 thing1 extra-arg1)) (thing3 (thing-operation2 thing2 extra-arg2))) (thing-operation3 thing3 extra-arg3)) That way one can name the return values, which improves readability and one could write declarations for those. One could also write a...

Regular expression range that must not start at zero

c#,asp.net,.net,regex,asp.net-mvc

This should do: ^(0[1-9]|[1-9][0-9]?)$ ...

JQuery - check if value is in array

javascript,jquery,arrays

You could also do the following way with no loops. var value = labelInput.val(); if( test.join(",").match(new RegExp(value, "gi")) !== null ) { labelInput.addClass("sp-validation-error"); } Note: RegExp is a bit slower than indexOf. Hence, you could also use: if( test.join(",").indexOf(value) !== -1 ) { labelInput.addClass("sp-validation-error"); } A Demo...

How could I transfer message from my File Inbound adapter to Sftp Outbound adapter through Spring DSL in java 1.7

spring-integration

You don't need to read the file into memory; the sftp adapter will read it and send it directly. @Bean public IntegrationFlow transferFlow() { return IntegrationFlows.from(Files.inboundAdapter(new File("/tmp/foo")), new Consumer<SourcePollingChannelAdapterSpec>() { @Override public void accept(SourcePollingChannelAdapterSpec e) { e .autoStartup(true) .poller(Pollers .fixedDelay(5000) .maxMessagesPerPoll(1)); } }) .handle(Sftp.outboundAdapter(this.sftpSessionFactory) .useTemporaryFileName(false) .remoteDirectory("destDir")) .get(); } If...

Represent Integers with 2000 or more digits [duplicate]

c++,integer

The obvious answer works along these lines: class integer { bool negative; std::vector<std::uint64_t> data; }; Where the number is represented as a sign bit and a (unsigned) base 2**64 value. This means the absolute value of your number is: data[0] + (data[1] << 64) + (data[2] << 128) + .......

boost c++ method returning different object types

python,c++,boost

As said in the comments, the real question here is: How to return different types from the same function in C++? We can use boost.variant for that. Here is a small example that demonstrates the basic feature we need: #include <iostream> #include <string> #include <boost/variant.hpp> boost::variant<int, std::string> fun (bool i)...

Using iOS pan gesture to highlight buttons in grid

ios,objective-c,swift,cocoa-touch

You are right, there is no such event. Also UIButton events won't help you either, because those require to actually start gesture inside. What you can do instead is to get location of the point you are currently dragging: func panDetected(sender : MoreInformativeGestureRecognizer) { let touchPoint = sender.locationInView(self.view) } And...

How to create a View that covers the current Activity Android

java,android

You can use an Dialog to achieve your View Requirement. You can create an AlertDialog problematically and add view elemets in to it. EDIT Reference code : public static void wrappedImageDialog(final Context context) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setPositiveButton("Get Pro", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int...

Convert iOS project to 64 bit using ConvertCocoa64 script

ios,xcode,terminal,64bit,iphone-64bit

If I'm not mistaking, to run script, you should place dot . before command. Doesn't really matters, where script is situated as long, as it doesn't rely on it heavily > cd ~/path/to/script/dir/ > ./ConvertCocoa64 ... ...

How to update all rows except one row out of many satisfying the given condition?

sql,oracle,oracle11g,sql-update

Since you don't care about the ordering of rows while updating the table, you could simply use MIN and GROUP BY. Update You need to group by colA and colC. For example, Setup SQL> CREATE TABLE t 2 ( 3 COlA VARCHAR2(12), 4 COLB VARCHAR2(9), 5 COLC VARCHAR2(5), 6 COLD...

Parse a comma separated list of emails in Python which are of the format “Name”

python,regex,email

You may use the following import re p = re.compile(r'"([^"]+)"(?:\s+<([^<>]+)>)?') test_str = '"Mr ABC" <[email protected]>, "Foo, Bar" <[email protected]>, "[email protected]"' print(re.findall(p, test_str)) Output: [('Mr ABC', '[email protected]'), ('Foo, Bar', '[email protected]'), ('[email protected]', '')] See IDEONE demo The regex matches... " - a double quote ([^"]+) - (Group 1) 1 or more characters other...

Why is the pointer typedef not used in std::vector::data()?

c++,c++11,language-lawyer

The reason data() exists is to get a pointer to the underlying array inside the vector, so that (for example) you can pass it to APIs that work with pointers not iterators. The pointer typedef is not necessarily a real pointer type, it is a typedef for std::allocator_traits<allocator_type>::pointer which could...

Using Python virtualenvs created in host machine on a guest VM

python,ubuntu,pip,virtualenv

The files in the virtualenv contain absolute file paths that work on the host system but probably not on the guest system. You might be able to fix that by making the virtualenv relocatable (run this on the host system): virtualenv --relocatable ENV More information (and caveats) in the documentation....

performing operations after uploading a CSV file in shiny [R]

r,shiny,shinydashboard

You could do something like this: ui.R library(shiny) shinyUI(fluidPage( fileInput('datafile', 'Choose CSV file', accept=c('csv', 'comma-separated-values','.csv')), tableOutput('table'), plotOutput('plot') )) server.R library(shiny) library(ggplot2) shinyServer(function(input, output,session) { dataframe<-reactive({ if (is.null(input$datafile)) return(NULL) data<-read.csv(input$datafile$datapath) data<- data %>% group_by(C) %>% mutate(A) %>% mutate(B) %>% mutate(add = (A+B)) %>% mutate(sub = (A-B)) data })...

How to Build Software

Getting started tutorials how to be a good programmer, develop software with:

palindrome , visual-studio-2005 , ussd , nullpointerexception , redis-rails , android-savedstate , autodesk , sizer , keen-io , cdo.message , odt , expression-trees , spyne , ms-access-data-macro , mkpolyline , software-collections , symlink-traversal , heisenbug , reporting , charindex , no-duplicates , ninjaframework , items , virtual-functions , urlmon , cachedrowset , guid , swing , knitr , frameset , temboo , overlapping-matches , packetbeat , postgres-fdw , android-nested-fragment , instances , jedi-code-library , 3g-network , coupon , extjs3 , rackspace , rollingfileappender , memory-efficient , sqltransaction , mounted-volumes , bitronix , pari , vcs-trigger , getcomputedstyle , intel-pin , delete , xeon-phi , eclipse-jdt , persistent , ddd-repositories , hammingweight , storekit , executorservice , css-transitions , gacutil , image-zoom , primefaces-mobile , formail , shift , deselect , sequence , xsp4 , azure-vm-role , str-replace , dlsym , arrayref , modeless , md5sum , inputstreamreader , opentsdb , aggregator , windows-universal , spring-mvc-test , actionviewhelper , callbackurl , lzo , grunt-requirejs , addressof , ssis-2012 , playlists , .ico , contextroot , tpl-dataflow , jmeter-plugins , emacs-jedi , vba , seem-beacon-manager , rampart , hybrid , nscharacterset , peer-connection , boost-geometry , bids , kademi , sqlhelper , fisheye , availability , graphite , pyelasticsearch , strategy , onlongclicklistener , divshot , jmc , data-binding , pam , ellipsis , openerp-7 , konvajs , gyp , kendo-ui-grid , pgpool , nanoc , mysql-5.1 , dynamic-class-creation , python-mode , backbone-routing , windows-process , syntax-error , ondraw , create-function , crash-dumps , credit-card , oculus , elasticsearch-py , rinside , nivo-slider , oledbexception , xdotool , multiple-columns , multi-user , pony , ibooks , html-frames , uivisualeffectview , gulp-load-plugins , android-proguard , luhn , nfs , echosign , simplepie , ora-12545 , hotmail , vichuploaderbundle , sspi , php-5.2 , oracleclient , port-scanning , jqgrid-formatter , jquery-load , hindi , tiddlywiki , sticky-windows , recyclerview , urlspan , firemonkey , system.io.file , string-externalization , seaglass , meteor-up , postsharp , google-chartwrapper , cx-freeze , dictionary , infobox , poco-libraries , namespace-organisation , gridpane , cursor-position , rss , visual-studio-macros , integrated-pipeline-mode , jquery , protractor , mpeg2-ts , pyml , cache-manifest , isinstance , pdf417 , filefield , sproutcore , avassetimagegenerator , dotcms , pathinfo , user-defined , surf , pseudo-element , undefined-reference , portable-executable , prestashop-1.5 , r-s3 , net.tcp , gosu , winzip , facebook-friends , upperbound , persistent-connection , pg-search , inflate-exception , conventions , pydio , intel-inspector , parameterized-unit-test , ransac , ieee-754 , filab , mappedsuperclass , type-2-dimension , geckofx , spark-notebook , rosetta-code , spliterator , node-red , publish , handlebarshelper , android-asynctask , textrange , rel , javascript-injection , c , android-kernel , cocoon , time-format , jet-sql , snakeyaml , scorm , runspace , distributed-algorithm , lob , components , application-variables , ufront , awsiossdk , django-formwizard , conditional-compilation , fifo , derivative , maxima , webrick , fontmetrics , directory , inline-view , intermediate-language , repository , tofixed , declarative-programming , unsupervised-learning , ora-06512 , calllog , wcf , gobject , background-process , adaptive-layout , rsync , cublas , tabstop , properties , cspack , jax-ws , taction , whiptail , detect , ldap-query , ocamlbuild , htmlunit-driver , service-factory , ng-idle , try-with-resources , magic-quotes , jtabbedpane , webmethods , jcs , openni , scala-maven-plugin , system-preferences , swarm , pac , expect , paypal-permissions , linear-algebra , erlang-escript , instance-eval , tinydb , snapshot , py.test , object-properties , jchart2d , report-viewer2012 , django-static , convenience-methods , php-imagine , performance-estimation , java-server , html5-canvas , call-graph , renaming , this-pointer , modal-dialog , nsmanagedobjectcontext , worklight-security , adoconnection , unjar , qbasic , omnipay , movement , morphia , azure-service-fabric , update-attributes , trident , bittorrent , interact-js , stream-operators , pattern-finding , apple-watch , android-viewgroup , mapkit , ecma262 , tfs2010 , keyboard-hook , e4x , chaining , jsonp , screen-lock , plpgsql , designview , nsunknownkeyexception , autohotkey , mongoose-q , tweets , call , getproperty , nsbitmapimagerep , azure-virtual-machine , query-engine , fastreport , blotter , glass-mapper , feof , mpld3 , apache-chemistry , appdata , roweditor , jain-sip , registerstartupscript , kendo-menu , tilelist , jsperf , install , f#-interactive , emacs-faces , calculated-columns , predicates , gettext , qfilesystemwatcher , multiview , prototype-chain , skpsmtpmessage , generic-collections , avi , android-input-method , rootfs , ipojo , rake , android-loadermanager , delaunay , istanbul , white-box-testing , utility , hidden-field , suphp , glassfish-4.1 , dreamhost , rdf , stackedbarseries , spannablestring , fdb , naked-objects , comctl32 , cfinput , celeryd , ironscheme , system.reflection , localtime , wideimage , solver , ipod , mp4 , peg , ringcentral , ios-provisioning , raft , xsd.exe , multi-tenancy , tasklist , akka , audio-fingerprinting , google-client , inventory-management , azure-caching , openssh , ispostback , arp , micro-optimization , uvm , jdbc-odbc , funq , samplegrabber , zend-server , uefi , edittextpreference , exist-db , lnk2001 , variadic-templates , instafeedjs , nsincrementalstore , joomla , va-arg , globals , shelveset , median , couchbase-nodejs-sdk , framerjs , sha2 , short-url , dropbox-api , clr , excel-interop , recursive-cte , formatted-input , bit , adminer , dynamic-properties , onpaint , kprobe , codeship , nhibernate-mapping , monolog , xamarin.forms , information-schema , matching , d3.js , prudentia , entity-framework-6.1 , opencms , hardcode , qgraphicswidget , pdfmake , sentiment-analysis , autoloader , home , basecamp , pfimageview , .net-assembly , ssd , jsdom , jpcap , apacheds , jeditorpane , libraries , pointcuts , codeigniter-hmvc , emgucv , eclipse-gmf , yield-keyword , qt , shorthand-if , varnish , ssis , kickstarter , cartopy , type-annotation , pdfstamper , azimuth , virus , uncheck , fwrite , auto-indent , alchemy , atlassian , ifs , query-cache , servlet-container , google-translate , akka-http , radtreeview , entity-framework , appveyor , jquery-validation-engine , kotlin , oracle12c , icc , .war , findby , descriptor , noclassdeffounderror , gcc5 , rendr , fgetcsv , get-headers , invalidoperationexception , gplots , dotnetnuke-module , rbind , ggally , type-parameter , nokia-imaging-sdk , pruning , objectanimator , buddypress , circuit-diagram , bitarray , bsxfun , expression , baasbox , openvz , nssavepanel , android-app-indexing , candlestick-chart , elk-stack , nsvalue , computer-name , transformer , selenium-grid , msvc12 , asp.net-ajax , tizen-web-app , graphml , textureview , backticks , language-concepts , ncache , mercurialeclipse , string-formatting , pbx , dbmigrate , revert , office365 , xelement , python-interactive , typeconverter , django-flatpages , blockly , webkitspeechrecognition , libav , spring-properties , triplestore , uiapplicationdelegate , opengl-4 , wikipedia , market-basket-analysis , gnu-arm , partial-methods , primes , reshape2 , websphere-commerce , app-config , qt-signals , modality , gulp-compass , a-star , hmvc , freetds , angular-new-router , image-morphology , prestashop-1.6 , lucee , aspxgridview , addchild , user-permissions , jquery-isotope , android-broadcast , fgets , file-not-found , error-log , hibernate-search , cycript , openedx , django-rest-framework , internet-radio , paho , webix , computation , processing , microsoft-speech-platform , activity-manager , ansi-sql , hg-git , haskell-diagrams , watchkit , android-tabhost , raven , rightnow-crm , papaparse , formvalidation-plugin , personalization , nsmanagedobjectmodel , primitive-types , ajax-request , highmaps , aida , mecab , azure-autoscaling-block , parallel-for , vast , capped-collections , dtcoretext , scriptbundle , nexus-4 , pugixml , zfcuser , bioconductor , topaz-signatures , timestamp , fraud-prevention , word-diff , savefiledialog , core , c-cda , ccd , monit , chilkat , sections , insertion-sort , dhcp , amdatu , c++-cli , component-scan , backbone-events , instrumentation , xdgutils , np-hard , scrapy-spider , freebsd , grequests , apply , smslib , rdp , joomla-task , blender , qgroupbox , simulate , custom-keyboard , avmutablecomposition , gigya , jqbootstrapvalidation , declare , grinder , background-thread , idataerrorinfo , level-of-detail , openbravo , monoids , sanitization , business-objects , markov-chains , 3d-modelling , mongodb-indexes , glu , gmaps4jsf , acrobat , interactive-brokers , setup-wizard , dbms-output , delete-directory , filesize , flask-login , ember.js , validationrule , knn , lingo , qlist , member-function-pointers , ohm , icicle-diagram , curly-brackets , gatling , multiple-tables , checkstyle , relational , content-security-policy , cl , file-copying , sails-postgresql , imagenamed , github-mantle , django-cms , scrapy-shell , klocwork , gdb , www-mechanize , dirent.h , thermal-printer , many-to-one , http-compression , test-coverage , libstdc++ , spring-el , visual-studio-shell , deferred , mac-address , audio-recording , plasmoid , digits , fastmm , execute , package-private , aes-gcm , nesc , maintainability , pdfjs , iif-function , dynamic-controls , dedicated-server , nsbuttoncell , consumer , adal , wav , class , azure-management-api , reloaddata , foreign-keys , datadetectortypes , nickel , windows-xp , vbp , logback , explicit-specialization , rhino-mocks , powerpacks , lowpass-filter , signtool , onunload , websphere-liberty , capistrano , built-in-types , punycode , scalikejdbc , re-engineering , pushstreamcontent , bioinformatics , tsd , daypilot , grid , cgcontextdrawpdfpage , delphi-6 , malware-detection , catkin , phpunit , hoare-logic , arr-3.0 , nsprintoperation , tumblr , ssh-agent , functional-java , correlated-subquery , input-history , wordpress-theming , relative-url , react-router , freeswitch , asp.net-dynamic-data , two-factor-authentication , node-modules , titanium-mobile , fortify-source , itunes-store , anonymous-function , range-v3 , inotifycollectionchanged , procedural-programming , android-resources , nokiax , reportserver , mapping , epl , eoferror , bnd , curl , hspec , nstabview , slab , flannbasedmatcher , reactive-streams , messageui , appcmd , csl , robospice , laravel-seeding , respond-to , metrics , google-gdk , subreports , most-vexing-parse , concat-ws , weblogic8.x , asic , icarus , cakephp-bake , inflection , getdnsapi , default-document , mcrypt , flurry , node-serialport , protostuff , arrow , nsslider , tfs-process-template , gmpy , mutable , communication , zpl-ii , modelmetadata , phase , lookup-tables , apple-push-notifications , background-service , tomcat-jdbc , database-normalization , refile , design-by-contract , keyboard-input , audio-converter , ruby-2.1.3 , sdl-image , dotpeek , mailsettings , telerik-grid , arrays , pc-lint , development-environment , ext3 , scitools , alpha , axwebbrowser , azure-servicebus-queues , approval , password-encryption , apache-commons-lang3 , code-formatting , sqlyog , parser-combinators , entity-system , uilabel , gql , subquery , suppress , intersystems , android-camera-intent , pentaho-cde , excel-vba , pry-rails , array-push , colorbar , hiredis , dwm , table-structure , scope-id , queueuserworkitem , peewee , google-app-engine , nsscanner , odr , onkeydown , jboss-forge , cloudant , spark-streaming , start-job , manual , github-api , ime , vs2013-update-4 , twitter-gem , ignore , trinidad , cordova-3 , sbt-assembly , xcode-storyboard , sinch , apache-shindig , ppm , func , date-parsing , long-double , qqmlcomponent , drmaa , binomial-theorem , diaspora , rich-snippets , gpuimage , urwid , single-user , hmacsha1 , hibernate-session , gvnix , ota , coverity , avassetreader , dynamic-pivot , traminer , hlsl , exception-safety , segment-tree , pyhdf , codelens , attachment-field , gruntjs , objective-c-blocks , android-snackbar , swifty-json , tilde , preload , devise-confirmable , gtk# , 4d , google-apps-script , processors , freeglut , celerybeat , tab-delimited , sqlfiddle , stm , artificial-intelligence , phundament , mongotemplate , vertex-array , autoscroll , database-versioning , appdomain , update-statement , software-engineering , bpm , elfinder , centos7 , login-page , nstablecolumn , radix-sort , xamarin.mac , phobos , apache-commons-io , dirty-data , jqwidget , cllocationcoordinate2d , gravity , svn-repository , extjs4 , ios-urlsheme , collectionbase , choicefield , angularjs-model , vectorization , global , highslide , jdom-2 , vscode , clientip , iframe , qcoreapplication , onejar , uint32 , security-constraint , curry , quickform , hierarchicaldatasource , system-verilog , linechart , cinch , pyglet , gwtp , rvo , autoprefixer , mailchimp , koala-gem , actionlistener , managedinstallerclass , httpclient , krpano , jta , completion , mousehover , bulbs , acm , rdio , whenever-capistrano , cardscrollview , documentum , rails-generate , computed-field , coinbase , business-rules , gii , indices , html5-draggable , rabbitmqctl , genetic , to-json ,