|
Thanks friend!
I was thinking this way. But I have no idea "How do this method "Example--- How store pdf file to SQl.. and how retrieve pdf file to C#... You can teach me-- how write this
|
|
|
|
|
naylynn wrote: How do you do! I'm beginner of C# language
First step - learn basics of putting and getting stuff from the database.
And do not use a PDF when learning that. Instead use int and string.
AFTER you are comfortable with that then learn how to put and get a blob.
|
|
|
|
|
|
Hi
I'm looking for an implementation of ToObservable and ToEnumerable
can you pls help with this
thx
|
|
|
|
|
kaminem wrote: I'm looking for an implementation of ToObservable and ToEnumerable That's a different statement than in the title.
Are you trying to convert an Observable to an Enumerable, or something else? Can you show us some code that shows what you want to convert?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
There is a simple (by MSDN's standards) of ToObservable here[^]. Likewise, in the opposite direction, here[^]
Note that these are really conversions (as opposed to casts): ToObservable takes the value from the IEnumerable on the basis of the IScheduler , whereas ToEnumerable produces the "list" from the Observable 's updates.
“Education is not the piling on of learning, information, data, facts, skills, or abilities - that's training or instruction - but is rather making visible what is hidden as a seed” “One of the greatest problems of our time is that many are schooled but few are educated”
Sir Thomas More (1478 – 1535)
|
|
|
|
|
This blog[^] might help you as well.
|
|
|
|
|
|
Is it possibe to display column A FROM TABLE 1 IN database ABC AND COLUMN B from table 2 of database XYZ IN a single gridview USING c# code...i got the column data in a datatable 1 and 2 respectively..joined them and assigned it to an object.Tried binding it but got "Make sure your datasource has content"...Can anyone help.Thanks in advance
|
|
|
|
|
JOIN the tables before loading them into a collection. You'll have two SQL statements now; paste 'em both, and we'll make a single statement of it. Prerequisite would be that you're using Sql Server (adding in the other DB as a linked database)
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Currently, I use IMAPI library to get the used space of DVD disc on Win7. The calculation is start when insert DVD (handle by WM_DEVICECHANGE window event).
However, with multi session disk (disk that is write many time without finalize), sometime it takes long time to get used space (double when comparing with Window Explorer).
I also investigated and found some other ways to get used space (use IOCTL_DISK_GET_DRIVE_GEOMETRY, IOCTL_SCSI_PASS_THROUGH_DIRECT). The calculating time is improved but result is different from Window result.
I also wonder there is any way that I can reuse the result of window (window also calculated the used space right after insert DVD) without re-calculating? Or any one else to calculate the used space?
Thank you for your interested and helping me.
|
|
|
|
|
WMI may come to your aid - check out the Win32_CDROMDrive class[^].
|
|
|
|
|
Can you explain more detail?
I search and found the way to get all properties from Win32_CDROMDrive. However, the capacity information of DVD Drive seems not to be retrieved.
|
|
|
|
|
Hey guys got a ? that I know is going to get a very objective answer, but here goes anyways. I'm deploying to Afghanistan soon, so I'll have some time at nights to read without interruption from the kids. I'm a beginner programmer, learning the basics of c#. Should I get a book on ASP.net MVC 4, or WFP 4.5? I'm down with learning both desktop development and web development.
Thanks for any input!
|
|
|
|
|
If you are wanting to learn the basics I'd get one of the "Learn C# in XX days" books, and then it really is a preference where you go from there. WPF has a lot of cool things you can do, but its only visible to those you send the executable to. ASP is a good skill to have and MVC can be translated to WPF when you get into that.
There isn't a "this is the one" answer, but if you are starting with basics then get basic books. Learning the back-end of a language before you work on the pretty front end will save you a lot of headaches later.
BTW, thanks for serving and stay safe out there.
|
|
|
|
|
Ron,
Thank you for your reply and safe wishes. I am no longer serving our country in the military though. I just separated from the US Navy, and am now going back out to Afghanistan to support the troops as a contractor.
I'm currently reading two books to learn the basics of C#, Rob Miles C# Yellow Pages and Pro C# 2012 and .NET 4.5
The Pro C# 2012 book has a section on WPF. How much information do I need on WPF to be able to put together a small program?
Thanks,
Jeramy
|
|
|
|
|
You really don't need much. WPF is XML with a .CS code behind. You can use the visual designer to make a form without writing any code at all, but it really gets more powerful if you hand code the XML. There are tools to help though, Microsoft Expression Blend can do some pretty bad-ass stuff without the need to hand code.
|
|
|
|
|
Awesome. I will definitely look into WPF more.
|
|
|
|
|
In my opinion you're better off with a book on .Net with C# (so more general). Something that starts with "Hello world" and builds up from there.
Start with console applications, then winforms, then ASP.NET (web development adds a bunch of complexity) and if that all works out you can check out WPF, LINQ, WCF, ... which is already pretty specific.
I'm pretty sure amazon has some cool books to start out with, make sure to check out the rating.
I would recommend to also install VS express and SQL Server express (incl. management studio), which are free (need to register though) and very easy to use.
hope this helps.
|
|
|
|
|
V,
Thank you for the reply. I think I have a great .Net with C# book (I guess I'll find out once I've read it all the way through).
I was unaware that I could get SQL Server Express. That's definitely good to know.
Thanks,
Jeramy
|
|
|
|
|
You should learn HTML5 and JQuery first. DON'T BE that "developer" who doesn't understand what we're doing here. ASP, MVC, PHP, etc, are all just fancy ways to get HTML, CSS, and Javascript into the browser. If you don't understand that goal, you're going to be a lousy web developer regardless of what other languages you know. The WWW is written in HTML, CSS, and Javascript. Get solid on those basics before tackling higher-level stuff.
TRUST ME. I've had people fired for not knowing HTML, in an ASP.Net shop. Learn to hand-code HTML - it's your bread and butter as a web developer.
For Windows Desktop apps, it's a little different - the foundation of that is basic C# or VB code. Learn the basics by making console apps, and do that for a long time, before you add the complexity of Forms, Events, and all that. Event-based programming is a little hard to understand sometimes, but it's how Windows Desktop apps work, so the idea is to be solid on the basics, so that stuff doesn't trip you up as you learn the higher level stuff.
|
|
|
|
|
My 2c
Choose either one and learn it, ignoring the other. The two are very different (and very similar!) and I would wait until you are comfortable with one, then convert to the other.
If it was me, I'd go the ASP route to start with.
My route (and this will get me downvoted, I'm sure) will be what someone alludes to below;
Start by getting familiar enough with html and css to knock up a static web page.
Learn a bit about Javascript and JQuery so you can 'play' with the page contents.
Now you have a web page that does stuff you start looking at the ASP side and interacting with the server.
MVVM # - I did it My Way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011
.\\axxx
(That's an 'M')
|
|
|
|
|
I'm coming up with a different way than the one I previously posted with subject "usb device in use".
I've enumerated the usb device, while filtering out the usb device with vendor & product id. These devices are not volume type (i.e. thumb drives, external hard drives, etc). It is the communication box that communicates with RFID.
I've acquired these usb path from 2 devices from List<strings>:
[0] = "\\\\?\\hid#vid_0483&pid_0003#8&374204f5&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"
[1] = "\\\\?\\hid#vid_0483&pid_0003#8&f40948&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"
From what I can see and understand that these numbers "374204f5" and "f40948" are serial numbers. The question is on how do I acquire these serial numbers using one of those USB methods? Or I would just find through string.substring method?
I was looking online and saw WMI class. I couldn't figure out which Win32 class to use. Most examples online I could find are for volume drives
P.S. If you want me to post the code, I would be glad to.
modified 4-Jun-13 14:07pm.
|
|
|
|
|
Be careful...What you're calling a serial number CAN be the device serial number IF it's in the hardware and can be picked up by PnP. If not, a serial number is randomly generated. So, what you see here might be the actual serial number of the device, or it may not. There is no way to tell from the device instance path.
Also, plugging the exact same device into a different post will assign it a different serial number if its not available.
You really have to explain what your doing and why. Just by looking at this post and your last one, "usb device in use", there's no way to determine what the goal of all this is.
|
|
|
|
|
What I was trying to do is to have my software to connect up to 4 USB Communication Box. This box would communicate with RFID tag. In some cases, the USB box would somehow loses connection and the software would detect the loss of communication to the box. Also that when the USB box is reconnected, the software would re-connect and re-communicate again. This software would ensure that the "address" would be unique from other 3 USB devices.
here's my sample code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using HID_API_Library;
using System.Security.Permissions;
namespace USB_Device_Connect_Disconnect_Test
{
public partial class Form1 : Form
{
public enum WM : uint
{
WM_DEVICECHANGE = 0x0219,
WM_PARENTNOTIFY = 0x0210,
DBT_DEVTYP_DEVICEINTERFACE = 5,
DBT_DEVTYP_HANDLE = 6,
DBT_DEVICEARRIVAL = 0x8000,
DBT_DEVICEQUERYREMOVE = 0x8001,
DBT_DEVICEREMOVECOMPLETE = 0x8004,
DBT_DEVTYP_VOLUME = 0x00000002,
DBT_DEVNODES_CHANGED = 7,
BROADCAST_QUERY_DENY = 0x424D5144,
}
byte[] Read_Input = new byte[9];
byte[] DeviceFirmwareVersion = new byte[9];
byte[] inputReport = new byte[9];
HID_API[] hid = new HID_API[4];
GroupBox[] gbDevice = new GroupBox[4];
List<string> usbDevices;
public Form1()
{
InitializeComponent();
MonitorUSBDevices();
}
int ReadPort(int deviceID, ref byte data)
{
int status = hid[deviceID].ExchangeInputAndOutputReports(ref Read_Input, ref inputReport, deviceID);
if (status == 1)
{
data = inputReport[1];
}
else
status = -530;
return status;
}
int GetDeviceFirmwareVersion(int deviceID, ref byte versionDeviceFirmware)
{
byte[] result = new byte[9];
int status = hid[deviceID].ExchangeInputAndOutputReports(ref DeviceFirmwareVersion, ref result, deviceID);
if (status == 1)
versionDeviceFirmware = result[0];
else
{
versionDeviceFirmware = 0x00;
status = -510;
}
return status;
}
int GetBoxID(int deviceID, ref byte boxId)
{
int status = ReadPort(deviceID, ref boxId);
if (status == 1)
{
boxId = (byte)~boxId;
boxId &= 0x0F;
if ((boxId & 0x08) == 0x08)
{
boxId &= 0x06;
boxId >>= 1;
boxId += 1;
}
else
{
boxId = 0;
status = -520;
}
}
else
status = -521;
return status;
}
void CreateGroupBoxes()
{
int yLoc = 12;
for (int i = 0; i < 4; i++)
{
gbDevice[i] = gb_Device0;
gbDevice[i].Location = new Point(218, yLoc);
yLoc += 106;
}
this.Controls.AddRange(gbDevice);
}
List<string> SeekHIDDevices()
{
HID_API hid_api = new HID_API();
return hid_api.EnumerateUSBDevices(0x0003, 0x0483);
}
private void MonitorUSBDevices()
{
usbDevices = SeekHIDDevices();
byte boxID = 0x00;
for (int i = 0; i < usbDevices.Count; i++)
{
hid[i] = new HID_API();
hid[i].OpenUSBDrive(usbDevices[i]);
hid[i].RegisterHidNotification(this.Handle);
}
if (usbDevices.Count >= 1)
{
GetBoxID(0, ref boxID);
lbl_BoxID0.Text = boxID.ToString("X2");
if (usbDevices.Count >= 2)
{
GetBoxID(1, ref boxID);
lbl_BoxID1.Text = boxID.ToString("X2");
if (usbDevices.Count >= 3)
{
GetBoxID(2, ref boxID);
lbl_BoxID2.Text = boxID.ToString("X2");
if (usbDevices.Count == 4)
{
GetBoxID(3, ref boxID);
lbl_BoxID3.Text = boxID.ToString("X2");
}
}
}
}
}
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
protected override void WndProc(ref Message m)
{
int devType = 0;
switch ((WM)m.Msg)
{
case WM.WM_DEVICECHANGE:
{
switch ((WM)m.WParam)
{
case WM.DBT_DEVICEARRIVAL:
{
break;
}
case WM.DBT_DEVICEREMOVECOMPLETE:
{
break;
}
case WM.DBT_DEVNODES_CHANGED:
{
HID_API hid_api = new HID_API();
List<string> usbPath = hid_api.EnumerateUSBDevices(0x0003, 0x0483);
break;
}
}
break;
}
}
base.WndProc(ref m);
}
}
}
|
|
|
|
|