2018-10-22         Walter

Unable to attach a ClusterRoleBinding to a Kubernetes ServiceAccount

I'm attempting to grant a Kubernetes ServiceAccount the cluster-admin role using a ClusterRoleBinding:apiVersion: v1kind: ServiceAccountmetadata: name: jenkins namespace: jenkins---apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRoleBindingmetadata: name: jenkinsroleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-adminsubjects:- kind: ServiceAccount name: jenkins namespace: jenkins...and I'm getting this error:The ClusterRoleBinding "jenkins" is invalid: roleRef: Invalid value: rbac.RoleRef{APIGroup:"rbac.authorization.k8s.io", Kind:"Cl...

 kubernetes                     1 answers                     78 view
 2018-10-22         Walter

Why inet_ntoa is designed to be a non-reentrant function?

Glancing at the source code of GNU C Library,I found the inet_ntoa is implementated with static __thread char buffer[18]My question is, since there is a need to use reeentrant inet_ntoa,why do not the author of GNU C Library use malloc to implementate it?thanks. The reason it's not using the heap is to conform with standards (POSIX) and other systems. The interface is just not such that you are supposed to free the buffer returned. It assumes static storage..But by declaring it as thread local (with __thread), two threads do not conflict with each other if they happen ...

 sockets                     1 answers                     98 view
 2018-10-22         Walter

oAuth with PHP (for google api)

How to use oAuth with PHP ? I can't install oauth class with pecl because I'm using share hosting.I foundhttp://code.google.com/p/oauth-php/but there is no example for client. I want to use oauth for Google API. Here is your example: http://code.google.com/p/oauth-php/wiki/ConsumerHowToYou can also read through http://code.google.com/apis/gdata/docs/auth/oauth.html to find out the specifics on Google. [XXX]I got it and I develop my own client library base on http://googlecodesamples.com/oauth_playground/ (svn sourcecode) [XXX]There are plenty of libraries available...

 php                     5 answers                     77 view
 2018-10-22         Walter

Asp.Net deny access on certain pages to users

How do I allow access to my web application to a user, but deny them access to a specific page? I want to allow more uses to use an app I've built, but there are a couple pages I don't want them to be able to access.Here's what I have in the Web.config now. <authorization> <allow roles="COMPANY\User_1"/> <allow roles="COMPANY\User_2"/> <allow roles="COMPANY\User_3"/> <deny users="*"/> </authorization>====================================================================================Here's what I have in...

 asp.net                     2 answers                     60 view
 2018-10-22         Walter

restrict lambda to use only some data centres?

I’m researching my options to publish microservices under AWS lambda. As we will be billed by the microsecond and memory used, performance of our lambda functions is pretty important.My DB is Cassandra or other NOSQL distributed on several AWS nodes, on several data centres.How can I configure lambda to be sure that my lambda function, including DB access, is using a DB node on the same data centre?I know that Cassandra drivers will redirect intelligently queries to the nearest DB node, but what I need is to the restrict lambda execution to just nodes on the same data centr...

 aws-lambda                     1 answers                     22 view
 2018-10-22         Walter

2d list in python - accessing through column names

I'm parsing two files which has data as shown belowFile1: UID A B C D ------ ---------- ---------- ---------- ---------- 456 536 1 148 304 1071 908 1 128 243 1118 4 8 52 162 249 4 8 68 154 1072 296 416 68 114 118 180 528 68 67 file2: UID X Y A Z B ------ ---------- ---------- --------...

 python                     3 answers                     100 view
 2018-10-22         Walter

Convert Factors to Numbers But Getting N/As for The Entire Column

First off, I have looked at all the examples and previous questions and have not been able to find a usable answer to my situation. I have a data set of 300ish independent variables I'm trying to bring into R. The variables are all classified as factors. In my csv file I'm uploading, all of the variables are pricing data with two decimal places. I have used the following code and some of the variables have been converted with decimals. However, many of the converted columns are filled with NAs; in fact, some entire columns are completely NAs.dsl$price = as.numeric(as.factor...

 r                     1 answers                     44 view
 2018-10-22         Walter

How to create a solution file using vs 2008

I have all the files for the deployment listed below :-BIN-CSS-IMAGES default.aspxPrecompiledApp.xmlWeb.xmlThe above files can be copy pasted in the webapps folder and default.aspx could be run from the browser.i want to create a solution sln file from this. How to create a solution file? It looks as though you are creating a web site. I've never been able to create a solution with just a website in it (a web application is a different beast however). However, I have found a workaround, although it's a little cludgy. Create a new class library project (any project typ...

 asp.net                     3 answers                     68 view
 2018-10-22         Walter

How to check if it's null?

I retrieve data from database like below. How do I check whether the value retrieved from database is null?Private Function GetBatch() As DataSet Dim dataset As New DataSet Dim adapter As Data.SqlClient.SqlDataAdapter Dim cn As New System.Data.SqlClient.SqlConnection(connectionstring()) GetBatchCommand.Connection = cn adapter = New Data.SqlClient.SqlDataAdapter(GetBatchCommand) adapter.Fill(dataset) Return datasetEnd FunctionDim dataset As New DataSet dataset = GetBatch()With dataset.Tables(0)Dim PersonID As String...

 sql                     5 answers                     64 view
 2018-10-22         Walter

Increase the performance of a SQL query

I have a tranctions table in which I need to get the transtions date and time for 5 differnect tractions (order drop, order pick, order Address labeled, loaded and ship).For each order I'm trying to get these transtions time for specific date and on orders we ship on those date. My query run almost for every to get these information.Is there a better way to rewrite this? I would really appreciate your help. SELECT "ORDER", MAX(CASE WHEN "ACTION" = 'DNLD' THEN TO_CHAR(datetimecreated,'yyyy-mm-dd hh24:mi') END) AS ORDER_Drop_time, MAX(CASE WHEN "ACTION" = 'RE...

 sql                     2 answers                     29 view
 2018-10-22         Walter

Select statement performance

I'm having a performance issue with a select statement I'm executing.Here it is:SELECT Material.*FROM Material INNER JOIN LineInfo ON Material.LineInfoCtr = LineInfo.ctr INNER JOIN Order_Header ON LineInfo.Order_HeaderCtr = Order_Header.ctrWHERE (Order_Header.jobNum = 'ttest') AND (Order_Header.revision_number = 0) AND (LineInfo.lineNum = 46)The statement is taking 5-10 seconds to execute depending on server load. Some table stats:- Material has 2,030,xxx records.- Lineinfo has 190,xxx records- Order_Header has 2,5xx records.My statement is returning a t...

 sql-server                     4 answers                     43 view
 2018-10-22         Walter

Python, Deleting files one by one in multiple directories

I am facing simple problem, but can't get my head around it. I have millions of millions files, in millions of directories I need to delete. Windows can't handle it as it's crushing before it even starts deleting. Tries Linux script but that didn't really work. I decided to write my own program to do that. Idea is simple:Check if there is a folder in the root path, if there is, go in it, check for folder if it's there go in and that until there is no folders, then delete all the files in that folder then delete that folder, and start again until root directory is empty. I s...

 python                     1 answers                     7 view
 2018-10-22         Walter

trying to access Azure storage from console app and get exception "Configuration system failed to initialize"

Trying to access Azure storage from console based app, I have following code but it throws when I try call CreateIfNotExist() on the blob container.Any ideas why? static void Main(string[] args) { try { var account = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=superXXX;AccountKey=XXXX=="); cloudBlobClient = new CloudBlobClient(account.BlobEndpoint.AbsoluteUri, account.Credentials); UploadBlob("folder", "file1.txt", "This is the contents"); } catch (Exception exn) { Co...

 c#                     3 answers                     48 view
 2018-10-22         Walter

How trigger field changes in Django ORM

I have project written on Django. In another projects I use SQLAlchemy and I use very usefull method to trigger field change:@event.listens_for(ClassName.field_name, 'set')def func_name(target, value, oldvalue, initiator): if value == oldvalue: returnIn my Django project I have Order class:class Order(models.Model): PAYMENT_CHOICES = ( ('Paid', 'Paid'), ('Not Paid', 'Not Paid') ) EXECUTION_CHOICES = ( ('Done', 'Done'), ('In Progress', 'In Progress') ) name = models.CharField(max_length=255, default='') skype = models.C...

 python                     2 answers                     25 view
 2018-10-22         Walter

Display formatted DateTime inside ObservableCollection

Into DataGrid I have 2 column: public string DayName {get; set;} public DateTime DateTimeColumn {get; set;}I want to display data as below:DayName | DateTimeColumn Monday | 2018-09-03 Tuesday | 2018-09-04 Wednesday | 2019-09-05 ....To do that I have method:public static ObservableCollection<MyDataConcept> BuildDataConceptList(int year, int month){ ObservableCollection<MyDataConcept> resultList = new ObservableCollection<MyDataConcept>(); foreach (var data in GetDates(year, month)) { if (data.DayOf...

 c#                     1 answers                     85 view
 2018-10-22         Walter

Array of Bitmap from array in xml file

I have in my array.xml an array of more than 100 images with all different name.<array name="icons"> <item>@drawable/setting</item> <item>@drawable/simplemode</item>...I need to load all them inside an array of BitmapHow can I do? Thanks Resources arrays that contains references to Drawables are called TypedArray in Android. You can refer to them very easily. Here's an example:TypedArray icons = getResources().obtainTypedArray(R.array.icons);Not, icons can retrieve the drawables for you. You can find the reference here: https:/...

 android                     1 answers                     38 view

Page 1 of 144  |  Show More Pages:  Top Prev Next Last