Selman

1

votes
0

answer
413

views

Connecting to Informix Connection Manager Using JDBC

I need some clarification on how (some) JDBC drivers connect to (Informix) Databases. We had the issue of 'connection refused' when trying to connect to Informix connection manager from a Java application via JDBC,although access was granted via firewall. When we consulted Informix Team,they told us...
selman
1

votes
0

answer
38

views

Custom Wordpress Feature Media (wordpress-feature-media) to better_featured_image for ionic3

it was a long title :( I need your help. Ionic application development. With the following codes, I can display single images in Articles. But I want to view multiple pictures. My codes are as follows; Wordpress Url: http://trailerapp.site/wp-json/wp/v2/posts WordPress-post.html ______ WordPress-fea...
1

votes
1

answer
202

views

Don´t preload images in XML (google maps API v3)

Hey i have a question that seems very tricky. I want to add images for every Infowindow in my map. But the clue is that the images shouldn't parse directly from the XML, because if there are 300 markers and for every marker an image, that would by a very big data which have to load on mapstart. Is...
selman
1

votes
1

answer
184

views

Back propogation on multi layered neural networks

I am making a neural network system with c# without using any libraries or Accord.Net. But i am stuck on how to back propogate my error. Do i have to include all layers that i have already propagated to the next layer, or only the previous layer gets in the equation? Edit for more information: My ne...
Selman Savaş
1

votes
1

answer
34

views

Protocol extension to struct and overwritable

I want to be able to decode different objects that come from the server with different date formats and for that I came up with this protocol: public protocol DateFormatProtocol{ var dateFormat : String {get} } public protocol CodableWithDateFormat : Codable, DateFormatProtocol{ static var dateForma...
1

votes
2

answer
122

views

Opening and reading a file in C

I have to write an app on C that opens a file, reads what is inside of it, stores that information on a struct and prints all the information. I did it creating 'empleados.txt' and placing it on the folder where is main.c. This is the content of the .txt: Juan Perez Rodriguez 11111111A 1200 Pepa Bue...
Patty Selman
1

votes
4

answer
377

views

Why compiler can not infer loop variable type for custom collections?

Sometimes compiler can not infer the variable type.For example if I define a string List like this: Or string array List: Obviously compiler infer type of the item.But if I do something like this: public class Foo : IEnumerable { List _fooRecords = new List(); public IEnumerator GetEnumerator() { r...
Selman Genç
1

votes
2

answer
154

views

How to implement GetHashCode for this situation?

I'm trying to implement an IEqualityComparer which basically compares two strings in a way that,(let's assume we have two strings x and y) if x starts with y or y starts with x they should be treated as equal. public bool Equals(string x, string y) { return x.StartsWith(y) || y.StartsWith(x); } publ...
Selman Genç
17

votes
1

answer
278

views

How is “as” operator translated when the right-side operand is generic?

I have just posted an answer to this question but I'm not entirely convinced of my answer.There are two things I'm wondering, consider this code: class Foo { void SomeMethod() { string str = 'foo'; Foo f = str as Foo; } } According to C# Specification 5.0, there are two different kinds of conversio...
Selman Genç
3

votes
2

answer
2.8k

views

MVCC_READ_CONFLICT when submitting multiple transactions concurrently

I have a conceptual question. I'm performing async requests to Composer REST and I'm getting message: 'error trying invoke chaincode. Error: Peer has rejected transaction \'552b42fa4d2cfd366ff1b7d01371878f53f7553b44f141187c6db86b75f68906\' with cdoe MVCC_READ_CONFLICT',. I got the same problem when...
Dan Selman
2

votes
3

answer
68

views

Why the C# compiler forces explicit initialization of all value type's fields in the constructor?

For a class, this is OK: class Point { private int _x, _y; public Point(int x) { _x = x; } } But if I use a value type the compiler complains that the _y is not initialized: struct Point { private int _x, _y; public Point(int x) { _x = x; } } I'm wondering what's the rationale behind this? Why can't...
Selman Genç
6

votes
2

answer
291

views

Why is my IDE complaining about new syntax after I've installed Roslyn?

I'm using Visual Studio 2013 currently and I write this simple code: class Program { private static void Main(string[] args) { Console.WriteLine(string error = 'Hello world!'); } } Obviously this is not a valid C# code, but the weird part is even though I see two errors, the code is compiling and wo...
Selman Genç
3

votes
2

answer
201

views

Why the generated IL code for a pointer and ref is same but signatures are different?

I'm trying to figure out how to reproduce the behaviour of ref modifier in C#. I have two methods: static void Foo(ref int x) { x = 25; } unsafe static void Foo(int* x) { *x = 25; } Even though the generated IL codes for these two method are the same, the signatures are different: The code for Foo(r...
Selman Genç
3

votes
1

answer
508

views

Why ref parameters can not be ignored like out parameters?

Is there a specific reason why C# 7 bring inlining out parameters but not ref? The following is valid on C# 7: int.TryParse('123', out _); But this is invalid: public void Foo(ref int x) { } Foo(ref _); // error I don't see a reason why the same logic can't be applied to ref parameters.
Selman Genç
4

votes
5

answer
200

views

Can string.Empty ever be equal to null?

I was discovering a open source operating system's code that has been written in C#, and I saw the following check: if (String.Empty == null) throw new Exception('Compiler didn't initialize System.String.Empty!'); It looked like a meaningless check to me but since I saw it in the source code of an o...
Selman Genç
23

votes
1

answer
421

views

Why the compiler adds an extra parameter for delegates when there is no closure?

I was playing with delegates and noticed that when I create a Func like the example below: Func func1 = (x, y) => x * y; The signature of the compiler generated method is not what I expected: As you can see it takes an object for it's first parameter. But when there is a closure: int z = 10; Func fu...
Selman Genç
12

votes
2

answer
447

views

Why Find method generates a TOP(2) query?

I'm using Entity Framework 6.1, and I have a code like this: Brand b; using(var ctx = new KokosEntities()) { try { b = ctx.Brands.Find(_brands[brandName].Id); return b; } catch (Exception ex) { _logger.Log(LogLevel.Error, ex); } } And this generates: N'SELECT TOP (2) [Extent1].[Id] AS [Id], [Ext...
Selman Genç
3

votes
1

answer
684

views

Why the same Access Token works for Media but doesn't work for Feed?

I'm using InstaSharp to get all medias from my account. This code works without any error: var user = new InstaSharp.Endpoints.Media.Authenticated(config, authInfo); var media = user.Popular(); Now if I do the same with Users: var user = new InstaSharp.Endpoints.Users.Authenticated(config, authInfo)...
Selman Genç
12

votes
2

answer
5.6k

views

IntelliJ IDEA - What is the keyboard shortcut for 'git pull' command?

Since Intellij relies on keyboard shortcuts a lot,I was wondering if there is one for 'git pull' command. That would save couple of seconds. I am using Intellij Version 15.0.4 on Windows.
selman
2

votes
4

answer
167

views

Is class member declaration not a statement?

I thought the class member declarations are declaration statements. But when I look at the declaration statements from the spec. I found this: declaration-statement: local-variable-declaration; local-constant-declaration; Obviously a class member declaration neither local variable nor local constant...
Selman Genç
7

votes
1

answer
260

views

Why can't the compiler optimize closure variable by inlining?

I have a Main method like this: static void Main(string[] args) { var b = new byte[1024 * 1024]; Func f = () => { new Random().NextBytes(b); return b.Cast().Average(); }; var avg = f(); Console.WriteLine(avg); } Since I am accessing a local variable b here the compiler creates a class to capture tha...
Selman Genç
2

votes
1

answer
1.1k

views

First element in object is undefined using += operator

I have a problem to use the operator += in an object. Because i have to change the variable dynamically i use an object as variable. But if i use the += operator the first element in the output always gets undefined. I think thats because the object is initialized empty. What is the best solution to...
selman
12

votes
5

answer
41.6k

views

Disk Space in Linux Server [closed]

How do we check the disk space left in a disk. Suppose if we have total disk space as below [[email protected] ~]# fdisk -l|grep Disk Disk /dev/sda: 250.0 GB, 250058268160 bytes How do we find how much is free in this 250GB disk.
Mohammed Selman
2

votes
1

answer
54

views

Not able to get any output from awk command in shell script [duplicate]

This question already has an answer here: Using awk with variables 3 answers I am trying to write a shell script to get certain data from below sample logs.. Below is a sample log: 2014-07-08 16:08:25,684: |ABC_130|1|10123ffffff2|P|489440201 2014-07-08 17:08:25,684: |ABC_130|1|aaaaaxx...
Mohammed Selman
1

votes
2

answer
2.3k

views

How to run a console app in MVC

I have Console Application written in C# that is scheduled to run everyday so using the Built in Windows Task Scheduler. Every time it runs the black console box pops up for the duration of it's execution and then closes. I am not writing anything to the console. 1.I've found other questions with se...
Selman
1

votes
3

answer
163

views

Is there a way to determine length of a base64 encoded value without knowing the encoding of decoded value?

I have a base 64 encoded value and I would like to know the lenght of the decoded value by using the this value without knowing the encoding of the decoded value. For example, base 64 encoded value of 'foo' is Zm9v. When I decode it like this: var bytes = Convert.FromBase64String('Zm9v'); I get an a...
Selman Genç
7

votes
3

answer
12.1k

views

How can I apply long polling technique in ASP.NET MVC?

I search a lot about polling technique but i can't find anything about how to apply this technique in asp.net mvc. There are so many articles and documentation but most of them about php and ajax. I want to use this technique with my project in two places,one is the tweet system like twitter and oth...
Selman Genç
1

votes
3

answer
188

views

String.Split returns weird result

I noticed that if I Split a string by white-space that contains only white-spaces, it returns unexpected result.Consider this: var spaces = string.Join('',Enumerable.Repeat(' ', 10)); int lenght = spaces.Length; // 10 var result = spaces.Split(' '); lenght = result.Length; // 11 I couldn't figure o...
Selman Genç
13

votes
3

answer
653

views

When I use is operator why there is only a null-check in IL code?

I was wondering how is is operator implemented in C#.And I have written a simple test program (nothing special, just for demonstration purposes): class Base { public void Display() { Console.WriteLine('Base'); } } class Derived : Base { } class Program { static void Main(string[] args) { var d = ne...
Selman Genç
7

votes
2

answer
3.8k

views

How can I get bootstrap version via javascript?

Is there any way to get bootstrap version via calling a function? I did some research but couldn't find any way, the version information is included in the comments at the beginning like this: /*! * Bootstrap v3.3.7 (http://getbootstrap.com) * Copyright 2011-2016 Twitter, Inc. * Licensed under the M...
Selman Genç
2

votes
0

answer
255

views

How to parse query string of a Uri by keeping the encoding?

I'm tryig to parse a query string's parameters into a NameValueCollection, using HttpUtility.ParseQueryString method: var queryParams = HttpUtility.ParseQueryString(queryString); The problem is, when I have an encoded parameter value, such as '%3Cscript%3Ealert(%27abc%27)%3C%2Fscript%3E' and I try t...
Selman Genç
2

votes
4

answer
3.4k

views

Why Schannel fails to receive handshake from the server?

When I'm trying to pull from our git server I get this error: fatal: unable to access 'xxx': OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to xxx When this happened before I was able to solve it by simply restoring the system but this time my system restore points got deleted for some reason,...
Selman Genç
3

votes
1

answer
1.5k

views

How to authenticate to REST API and map to Fabric credentials

How can I create a new user account with username/password to authenticate against composer-rest-server? How would I authenticate with this newly created user account against composer-rest-server? How would I manage the session for that user? How can I map this user to a network participant? Can...
Dan Selman
7

votes
2

answer
212

views

html export different branch

I have org files in a github repository and using project pages future. Exporting org files to html for use in gh-pages like this; editing org files on master branch and committing exporting html to a temporary directory changing branch to gh-pages copying files from temporary directory and committi...
Selman Ulug
2

votes
1

answer
922

views

How can i add extra column to third table in Entity Framework?

Assume i have two entities, User and Notification: public class User { [Key] public int UserId { get; set; } // other public properties // Navigation Properties public virtual ICollection Notifications { get; set; } } public class Notification { [Key] public int NotificationId { get; set; } // other...
Selman Genç
1

votes
1

answer
90

views

Why that is possible to define a class named var or dynamic?

Today I noticed we can define a class named var or dynamic. First, I thought it's not possible because these are special keywords and cannot be used as a Class name.But then I tried it,and I'm surprised. Here is a strange situation,when I define two class: class var { } class dynamic { } And use th...
Selman Genç
8

votes
1

answer
613

views

Is there a way to get typeof Func<T, bool>?

Short version : We can get the typeof Func using: typeof(Func) but what if I want to get the type of Func, what should I use, or is it possible to do? Clearly this doesn't compile : typeof(Func) Long version : Consider the following scenario, I have two similar method and I want to get the second...
Selman Genç
2

votes
0

answer
168

views

Best way to detect a loss of connection to a server using Angular 4 and Nodejs

Essentially, I'm trying to work out the best way to ensure that a user is connected to the server / the internet and is thus able to make requests in my application without error. I have come across various solutions, but I can;t really decide what is the best performing or useful. Websockets, using...
Kyle Selman
3

votes
1

answer
447

views

How can I avoid accessing private members of a class using Reflection?

I was reading Security Considerations for Reflection and I saw the following line: Transparent code cannot use reflection to access security-critical members, even if the code is fully trusted. A MethodAccessException, FieldAccessException, or TypeAccessException is thrown. So, I've written a test p...
Selman Genç
4

votes
2

answer
116

views

How can I get a method that has an out parameter?

Let's assume I have two method in a class looks like this: class Foo { public void Convert(string s, int x){ } public void Convert(string s, double x) { } } If I use: var method = typeof (Foo) .GetMethod('Convert', new[] {typeof (string), typeof (int)}); I'm getting the correct method.But if I chang...
Selman Genç

View additional