 |
|
C# WinApp Operator / เพิ่งรู้ว่ามันคำนวณมาแบบนี้ |
|
 |
|
|
 |
 |
|
จะต้องใส่วงเว็บครับ จะได้รู้ว่า คำนวณอันไหนก่อน
|
 |
 |
 |
 |
Date :
2016-12-13 09:54:47 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

แบบนี้ถือว่าแปลกไม๊ครับ
|
 |
 |
 |
 |
Date :
2016-12-13 10:09:33 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

ประมาณว่า ท่าน MS ไม่นับจำนวนเต็นเข้าไปอยู่ใน double หรือครับ
ถึงต้องให้ชี้ไปที่ double ก่อนถึงจะคำนวณได้
|
 |
 |
 |
 |
Date :
2016-12-13 10:19:16 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองใช้ RDBMS อทิเช่น
--- ORACLE
--- SQL Server
Code (SQL)
Select 1/2
Software ระดับโลกไม่น่าจะผิด
|
 |
 |
 |
 |
Date :
2016-12-13 12:40:15 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จาก #NO4
Code (SQL)
select 1/2 // ผลลัพธ์ 0
select 1/2.0 // ผลลัพธ์ 0.5
มันก็อีหรอบเดียวกัน
|
 |
 |
 |
 |
Date :
2016-12-13 12:46:30 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
หายไป 2 วันมั้ง (ถ้าผมจำไม่ผิด)
--- ได้งานมาอีกแล้ว (ตรูไม่มีปัญญาเวลาที่จะทำ)
--- เป็นบริษัทเล็กฯ พนักงานก็ประมาณ 400-500 คน
สิ่งที่ยากที่สุดคือ "เราไม่อาจรับและเราไม่อาจปฏิเสธได้"
วัยลุ่ยเซ็งมากฯ
ปล. วันหนึ่งมี 24 ชั่วโมง มันไม่เพียงพอสำหรับผม
|
 |
 |
 |
 |
Date :
2016-12-13 12:51:12 |
By :
หน้าอี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แสบสันต์ไหม?
--- ช่วยตรูหน่อยซิ โปรเจคนี้เงินดีนะ 60 ล้านบาทแน่ะ
--- ไอ้รุ่นน้องของผมมันบอกว่า "พี่ผมขอโทษ"
----- โปรเจคเล็กฯของผมหลัก "ร้อยล้าน" ต่ำกว่านี้ผมไม่เอา
----- ผมเซ็งมากฯเลย +55555
|
 |
 |
 |
 |
Date :
2016-12-13 12:54:54 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ความคิดดี
|
 |
 |
 |
 |
Date :
2016-12-13 13:15:36 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จาก #NO 6 "ความแพรวพราวในภาษาไทย"
--- หายไป 2 วันมั้ง (ถ้าผมจำไม่ผิด)
------ ระดับผมไม่คุยกับพนักงานอยู่แล้ว(ในบางเรื่อง) ส่วนใหญ่ผมคุยกับเจ้าของบริษัท
--------- เดี๋ยวจะหาว่าผม "ไม่มีมนุษย์เพศสำพันธ์"
------------ ผมเจอหัวหน้าฝ่าย/แผนกโน้นนั่นนี่ ผมก็ทักทายเป็นพิธี อทิเช่น
--------------- เจอผู้จัดการฝ่าย/แผนกบัญชี ที่เป็นผู้หญิงผมก็เอ่ยคำสุภาพว่า
------------------ ไม่ได้เจอกันนาน มีลูกกี่คนแล้วล่ะ? ผัวคนเดิมยังอยู่ไหม? (แน่นอนว่ามากผัว +55555)
...
...
...
|
 |
 |
 |
 |
Date :
2016-12-13 13:39:56 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จาก #NO11 - #NO12
--- ผมเคยถือ ย่ามให้กับคุณ อังคาร กัลยาณพงค์ มาก่อน (มือขวา)
--- ...
--- ...
--- ...
เพราะฉะนั้น ความพริ้วไหวในตัวอักษรภาษาไทย
--- ครู/อาจาย์ ที่สอนวิชาภาษาไทย สู้ผมไม่ได้หรอก (ในเชิงจินตนาการ)
เรื่องอื่นฯก็เช่นเดียวกัน
|
 |
 |
 |
 |
Date :
2016-12-13 14:16:15 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จาก #NO1 - #NO15
ผมได้อยากได้หมามาเฝ้าบ้าน
---x บางครั้งผมก็ลูบหัว
--- xบางครั้งผมก็ตบหัว
---x บางครั้งผมก็ตบหัวและลูบหลัง
---x = โปรแกรมเมอร์ +55555
|
 |
 |
 |
 |
Date :
2016-12-13 15:14:55 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ถ้าเอา int/int จะได้ int ครับ
ถ้าอยากได้ double ต้องมีตัวแปรที่เป็น double ด้วย 1 ตัว
|
 |
 |
 |
 |
Date :
2016-12-14 07:42:08 |
By :
fonfire |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ถ้าถามเหตุผล
ผมก็ไม่ทราบครับ 55555
เราคงต้องปรับตัวหามันอ่ะครับ
http://stackoverflow.com/questions/10851273/why-integer-division-in-c-sharp-returns-an-integer-but-not-a-float
Code
While it is common for new programmer to make this mistake of performing integer division when they actually meant to use floating point division, in actual practice integer division is a very common operation. If you are assuming that people rarely use it, and that every time you do division you'll always need to remember to cast to floating points, you are mistaken.
First off, integer division is quite a bit faster, so if you only need a whole number result, one would want to use the more efficient algorithm.
Secondly, there are a number of algorithms that use integer division, and if the result of division was always a floating point number you would be forced to round the result every time. One example off of the top of my head is changing the base of a number. Calculating each digit involves the integer division of a number along with the remainder, rather than the floating point division of the number.
Because of these (and other related) reasons, integer division results in an integer. If you want to get the floating point division of two integers you'll just need to remember to cast one to a double/float/decimal.
|
 |
 |
 |
 |
Date :
2016-12-14 08:52:09 |
By :
fonfire |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แต่ถ้าเป็น VB มันได้
1/5 = 0.2 น่ะครับ
|
 |
 |
 |
 |
Date :
2016-12-14 08:53:34 |
By :
fonfire |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ถ้ารู้จักใช้มันก็มีประโยชน์มหาศาล
LambdaExt.vb
Code (VB.NET)
Module LambdaExt
<System.Runtime.CompilerServices.Extension> _
Public Function LeftJoin(Of TSource, TInner, TKey, TResult)(source As IEnumerable(Of TSource),
inner As IEnumerable(Of TInner),
pk As Func(Of TSource, TKey),
fk As Func(Of TInner, TKey),
result As Func(Of TSource, TInner, TResult)) As IEnumerable(Of TResult)
Dim _result As IEnumerable(Of TResult) = Enumerable.Empty(Of TResult)()
_result = From s In source
Group Join i In inner
On pk(s) Equals fk(i) Into joinData = Group
From left In joinData.DefaultIfEmpty()
Select result(s, left)
Return _result
End Function
<System.Runtime.CompilerServices.Extension> _
Public Function RightJoin(Of TSource, TInner, TKey, TResult)(source As IEnumerable(Of TSource), inner As IEnumerable(Of TInner), pk As Func(Of TSource, TKey), fk As Func(Of TInner, TKey), result As Func(Of TSource, TInner, TResult)) As IEnumerable(Of TResult)
Dim _result As IEnumerable(Of TResult) = Enumerable.Empty(Of TResult)()
_result = From i In inner
Group Join s In source
On fk(i) Equals pk(s) Into joinData = Group
From right In joinData.DefaultIfEmpty()
Select result(right, i)
Return _result
End Function
<System.Runtime.CompilerServices.Extension> _
Public Function FullOuterJoin(Of TSource, TInner, TKey, TResult)(source As IEnumerable(Of TSource),
inner As IEnumerable(Of TInner),
pk As Func(Of TSource, TKey),
fk As Func(Of TInner, TKey),
result As Func(Of TSource, TInner, TResult)) As IEnumerable(Of TResult)
Dim left = source.LeftJoin(inner, pk, fk, result).ToList()
Dim right = source.RightJoin(inner, pk, fk, result).ToList()
Return left.Union(right)
End Function
End Module
LambdaExt.cs
Code (C#)
public static IEnumerable<TResult> LeftJoin<TSource, TInner, TKey, TResult>(this IEnumerable<TSource> source,
IEnumerable<TInner> inner,
Func<TSource, TKey> pk,
Func<TInner, TKey> fk,
Func<TSource, TInner, TResult> result)
{
IEnumerable<TResult> _result = Enumerable.Empty<TResult>();
_result = from s in source
join i in inner
on pk(s) equals fk(i) into joinData
from left in joinData.DefaultIfEmpty()
select result(s, left);
return _result;
}
public static IEnumerable<TResult> RightJoin<TSource, TInner, TKey, TResult>(this IEnumerable<TSource> source,
IEnumerable<TInner> inner,
Func<TSource, TKey> pk,
Func<TInner, TKey> fk,
Func<TSource, TInner, TResult> result)
{
IEnumerable<TResult> _result = Enumerable.Empty<TResult>();
_result = from i in inner
join s in source
on fk(i) equals pk(s) into joinData
from right in joinData.DefaultIfEmpty()
select result(right, i);
return _result;
}
|
 |
 |
 |
 |
Date :
2016-12-14 10:36:14 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (C#)
public static class LinqExtension
{
public static IEnumerable<TResult> LeftJoin<TSource, TInner, TKey, TResult>(this IEnumerable<TSource> source,
IEnumerable<TInner> inner,
Func<TSource, TKey> primaryKey,
Func<TInner, TKey> foreignKey,
Func<TSource, TInner, TResult> resultCollection)
{
var result = from s in source
join i in inner
on primaryKey(s) equals foreignKey(i) into joinData
from left in joinData.DefaultIfEmpty()
select resultCollection(s, left);
return result;
}
public static IEnumerable<TResult> RightJoin<TSource, TInner, TKey, TResult>(this IEnumerable<TSource> source,
IEnumerable<TInner> inner,
Func<TSource, TKey> primaryKey,
Func<TInner, TKey> foreignKey,
Func<TSource, TInner, TResult> resultCollection)
{
var result = from i in inner
join s in source
on foreignKey(i) equals primaryKey(s) into joinData
from right in joinData.DefaultIfEmpty()
select resultCollection(right, i);
return result;
}
public static IEnumerable<TResult> FullOuterJoin<TSource, TInner, TKey, TResult>(this IEnumerable<TSource> source,
IEnumerable<TInner> inner,
Func<TSource, TKey> primaryKey,
Func<TInner, TKey> foreignKey,
Func<TSource, TInner, TResult> resultCollection)
{
IEnumerable<TSource> sourceCollection = source as IList<TSource> ?? source.ToList();
IEnumerable<TInner> innerCollection = inner as IList<TInner> ?? inner.ToList();
var left = sourceCollection.LeftJoin(innerCollection, primaryKey, foreignKey, resultCollection).ToList();
var right = sourceCollection.RightJoin(innerCollection, primaryKey, foreignKey, resultCollection).ToList();
return left.Union(right);
}
public static IEnumerable<TResult> LeftExcludingJoin<TSource, TInner, TKey, TResult>(this IEnumerable<TSource> source,
IEnumerable<TInner> inner,
Func<TSource, TKey> primaryKey,
Func<TInner, TKey> foreignKey,
Func<TSource, TInner, TResult> resultCollection)
{
var result = from s in source
join i in inner
on primaryKey(s) equals foreignKey(i) into joinData
from left in joinData.DefaultIfEmpty()
where left == null
select resultCollection(s, left);
return result;
}
public static IEnumerable<TResult> RightExcludingJoin<TSource, TInner, TKey, TResult>(this IEnumerable<TSource> source,
IEnumerable<TInner> inner,
Func<TSource, TKey> primaryKey,
Func<TInner, TKey> foreignKey,
Func<TSource, TInner, TResult> resultCollection)
{
var result = from i in inner
join s in source
on foreignKey(i) equals primaryKey(s) into joinData
from right in joinData.DefaultIfEmpty()
where right == null
select resultCollection(right, i);
return result;
}
public static IEnumerable<TResult> FullOuterExcludingJoin<TSource, TInner, TKey, TResult>(this IEnumerable<TSource> source,
IEnumerable<TInner> inner,
Func<TSource, TKey> primaryKey,
Func<TInner, TKey> foreignKey,
Func<TSource, TInner, TResult> resultCollection)
{
IEnumerable<TSource> sourceCollection = source as IList<TSource> ?? source.ToList();
IEnumerable<TInner> innerCollection = inner as IList<TInner> ?? inner.ToList();
var left = sourceCollection.LeftExcludingJoin(innerCollection, primaryKey, foreignKey, resultCollection).ToList();
var right = sourceCollection.RightExcludingJoin(innerCollection, primaryKey, foreignKey, resultCollection).ToList();
return left.Union(right);
}
}
ยังหัดๆ LINQ อยู่ เหมือนกันครับ
|
 |
 |
 |
 |
Date :
2016-12-14 10:50:33 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
+55555
------ คำว่า "กระหรี่" แตกต่างกับคำว่า "โสเภณีตรงไหน"
------ ผมรู้คำตอบอยู่แล้ว
------ ...
------ ...
------ ...
เวลาผมคิด(ควยต้องการของผม) ผมมักจะคิดมากกว่าคนอื่นเสมอ +- 200 ปีเป็นอย่างต่ำ
|
 |
 |
 |
 |
Date :
2016-12-14 16:39:55 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมไม่รู้ว่าคุณดมหีเมียเป็นหรือไม่ (ผมขอโทษถ้าคุณคิดว่ามันมีเพศที่ 3 ชาย - หญิง) มันมีเพศอื่นฯ เช่น
--- ชายรักชาย
--- หญิงรักหญิง (ไม่รู้ว่าเขาเรียกขานภายในว่าอะไร เดาฯเอาก็ ตีฉาบ)
ทุกฯสำเนียงกลิ่น..(หี) ผมรับรู้หมด?
--- หีมีกี่ประเภท ผมจำแนกได้หมด
--- เพราะอะไร? บิดามารดาของผมตั้งชื่อผมว่า
--- ผมชื่อ "หน้าฮี"
ปล. ผมพิเศษกว่าคนอื่นตรงที่ ผมรับรู้กลิ่น (หี) ด้วยลิ้นของผมเอง +55555 (สัปดนมาก)
|
 |
 |
 |
 |
Date :
2016-12-14 16:48:36 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คอมพิวเตอร์มันโง่ครับ มันไม่มีคอมมอนเซ็นเหมือนคนเรา
เราเป็นคนเขียนโปรแกรม อยากได้แบบไหนก็ต้องสั่งมันแบบนั้นครับ
|
 |
 |
 |
 |
Date :
2016-12-14 17:03:25 |
By :
Luz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
@lamaka.tor, Luz
บางครั้งคำว่า "มี" มันอยู่นอกอะเรย์ เช่น --> Array("คุณธรรม", "คุณธรรม")
คนเราในคราวจำเป็นจริงฯ (รู้จักเอาตัวรอดในทุกฯสถานะการณ์)
--- เราก็อย่าไปให้น้ำหนักมันมากนักกับคำว่า "มีคุณธรรม"/ไม่มีคุณธรรม
------ ทำอย่างไรก็ได้เพื่อให้คนอื่นฯ เดือดร้อนน้อยที่สุด ก็เพียงพอแล้ว
------ (มนุษย์คือสัตว์สงคราม)
ปล. ความจริงในบางครั้งมันก็น่าจะเป็นเพียงสิ่งสมมุติ และในทางกลับกัน
แต่ในความเป็นจริงมันไม่ได้เป็นอย่างนั้น
|
 |
 |
 |
 |
Date :
2016-12-22 20:11:12 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จาก #NO 28
ผมกำลังจะอธิบายว่า "ความดีและความชั่วมันคือสิ่งเดียวกัน"
--- ถ้ามองในแง่นี้มันจะไม่มีสอง ทุกฯอย่างต้องเป็นหนึ่ง
แต่ข้อแย้งในคำอธิบายของผม มันกลับกัน/ขัดแย้งกัน "ทุกฯสรรพสิ่งไม่มีหนึ่งแต่มันคือสอง"
--- ถ้ามองในแง่นี้มันจะไม่มีหนึ่ง ทุกฯอย่างต้องเป็นสอง
----- ยกตัวอย่างกำกับในเบื้องต้น เช่น คุณทำบุญตักบาตร/ให้ทาน
------- ...
------- ...
------- ...
...
...
...
|
 |
 |
 |
 |
Date :
2016-12-22 20:28:35 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จาก #NO 28 - #NO 29
ผมต้องการสื่อผ่านจิตวิญญานของคน(เพื่อให้ คิดด้วยตัวเอง)
--- มันคือความจริงหรือ?
กาลเวลาจะเป็นจะบอกเราเองว่ามันจริงหรือไม่จริง ในทุกฯสถานะการณ์
--- จริงหรือเท็จ มันขึ้นอยู่กับ กาลเวลา
ปล. ผมก็เมาไปเรื่อยเปื่อย บางครั้งเมีย(ภรรยา) ก็ไล่ผมออกจากบ้าน
บางครั้งเมีย(ภรรยา) ก็บอกว่า วันนี้พี่กลับบ้านไหม?
|
 |
 |
 |
 |
Date :
2016-12-22 20:39:04 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
[font=Verdana]เล่าเรื่องจริงให้ฟังนะ (ตลกขำขัน)[/font]
--- ผมบอกรุ่นน้องของผมว่า "หยิบคอมพิวเตอร์ให้พี่หน่อยซิ"
--- พี่พกยาจุดกันมาด้วยหรือ? (มันหัวเราะใส่หน้าผม โดนเมียไล่ออกจากบ้านอีกแล้วซิ)
ผมก็หัวเราะตาม (แม่งรู้ทันตรูทุกเรื่อง) +55555
ที่เล่ามามันเป็นจริงนะ (+55555)
|
 |
 |
 |
 |
Date :
2016-12-22 20:46:21 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จาก #NO 31 ผมพิมพ์ตกยุงคำว่าไป "ยาจุดกันยุง"
--- เดี๋ยวจะหาว่าผม ทำให้หัวเราะไม่มีที่มาที่ไป
|
 |
 |
 |
 |
Date :
2016-12-22 20:57:17 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมรู้แล้วว่าทำไมคนถึงไม่เข้าใจว่ายุงมันต้องการอะไรเวลามันมาบินวนแถวๆหูคน
เพิ่งกระจ่างแก่ใจนี่เอง 5555
|
 |
 |
 |
 |
Date :
2016-12-23 16:04:00 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|