"Driver list already built" error message - driver

While trying to install a network driver on win server 2008, i received the following msg box:
{Unable to find any drivers for this device}
In addition, this was setupapi.app.log output:
>>> [Build Driver List - unknown device]
>>> Section start 2014/11/12 14:59:09.946
cmd: C:\windows\Explorer.EXE
! dvi: Driver list already built
<<< Section end 2014/11/12 14:59:09.946
<<< [Exit status: SUCCESS]
This driver was previously installed on win server 2003.
Here is the INF file:
; -- NETSF.INF --
;
; Passthru driver INF file - this is the INF for the service (protocol)
; part.
;
; Copyright (c) 1993-2001, Microsoft Corporation
;
; ----------------------------------------------------------------------
; Notes:
; 0. The term "filter" is used in this INF to refer to an NDIS IM driver that
; implements a 1:1 relationship between upper and lower bindings.
;
; 1. Items specifically required for a filter have been marked with
; "!!--Filter Specific--!!" keyword
; 2. In general a filter DOES NOT require a notify object for proper installation.
; A notify object is only required if one wants to have better control
; over binding operations or if one wants to receive notifications
; when other components get installed/removed/bound/unbound.
; Since Windows 2000 systems do not have support for CopyINF directive,
; a notify object is required to programmatically copy the miniport INF
; file to the system INF directory. Previous versions of this INF file
; erroneously used to copy the INF files directly by using the CopyFiles
; directive.
; On Windows XP, you can install a filter IM without a notify object.
; by following the instructions in (4).
;
; 3. If you want to use this INF file with your own IM driver, please
; make the following modifications:
; File netsf.inf
; --------------
; a. In section [SourceDiskFiles] and [Passthru.Files.Sys]
; change passthru.sys to the name of your own driver binary.
; b. In section [Passthru.ndi.AddReg], change values of
; BindForm and MiniportId to appropriate values.
; File netsf_m.inf
; ----------------
; a. Replace MS_PassthruMP with InfId of your miniport.
; b. In section [PassthruMP.AddService],
; change ServiceBinary appropriately.
; c. In section [PassthruMP.ndi.AddReg],
; change "Passthru" in the line having "Service"
; to reflect the appropriate name
;
;
; ----------------------------------------------------------------------
[Version]
Signature = "$Windows NT$"
Class = NetService
ClassGUID = {4D36E974-E325-11CE-BFC1-08002BE10318}
Provider = %Msft%
DriverVer = 06/24/1999,5.00.2071.1
[Manufacturer]
%Msft% = MSFT
[ControlFlags]
;=========================================================================
;
;=========================================================================
[MSFT]
%Passthru_Desc% = Passthru.ndi, ms_passthru
[Passthru.ndi]
AddReg = Passthru.ndi.AddReg, Passthru.AddReg
Characteristics = 0x4410 ; NCF_FILTER | NCF_NDIS_PROTOCOL !--Filter Specific--!!
CopyFiles = Passthru.Files.Sys
CopyInf = netsf_m.inf
[Passthru.ndi.Remove]
DelFiles = Passthru.Files.Sys
[Passthru.ndi.Services]
AddService = Passthru,, Passthru.AddService
[Passthru.AddService]
DisplayName = %PassthruService_Desc%
ServiceType = 1 ;SERVICE_KERNEL_DRIVER
StartType = 3 ;SERVICE_DEMAND_START
ErrorControl = 1 ;SERVICE_ERROR_NORMAL
ServiceBinary = %12%\passthru.sys
LoadOrderGroup = PNP_TDI
AddReg = Passthru.AddService.AddReg
[Passthru.AddService.AddReg]
; ----------------------------------------------------------------------
; Add any miniport-specific parameters here. These are params that your
; filter device is going to use.
;
;HKR, Parameters, ParameterName, 0x10000, "MultiSz", "Parameter", "Value"
;HKR, Parameters, ParameterName2, 0x10001, 4
; ----------------------------------------------------------------------
; File copy
;
[SourceDisksNames]
1=%DiskDescription%,"",,
[SourceDisksFiles]
passthru.sys=1
[DestinationDirs]
DefaultDestDir = 12
Passthru.Files.Sys = 12 ; %windir%\System32\drivers
[Passthru.Files.Sys]
passthru.sys,,,2
; ----------------------------------------------------------------------
; Filter Install
;
[Passthru.ndi.AddReg]
HKR, Ndi, HelpText, , %Passthru_HELP%
; ----------------------------------------------------------------------
; !!--Filter Specific--!!
;
; Note:
; 1. Other components may also have UpperRange/LowerRange but for filters
; the value of both of them must be noupper/nolower
; 2. The value FilterClass is required.
; 3. The value Service is required
; 4. FilterDeviceInfId is the InfId of the filter device (miniport) that will
; be installed for each filtered adapter.
; In this case this is ms_passthrump (refer to netsf_m.inf)
;
HKR, Ndi, FilterClass, , failover
HKR, Ndi, FilterDeviceInfId, , ms_passthrump
HKR, Ndi, Service, , Passthru
HKR, Ndi\Interfaces, UpperRange, , noupper
HKR, Ndi\Interfaces, LowerRange, , nolower
HKR, Ndi\Interfaces, FilterMediaTypes, , "ethernet, tokenring, fddi, wan"
[Passthru.AddReg]
; The following key is Required
; The following key is Passthru specific
HKR, Parameters, Param1, 0, 4
; ----------------------------------------------------------------------
[Strings]
Msft = "Microsoft"
DiskDescription = "Microsoft Passthru Driver Disk"
Passthru_Desc = "Passthru Driver"
Passthru_HELP = "Passthru Driver"
PassthruService_Desc = "Passthru Service"

The issue was caused due to a change in the Manufacturer's section.
Since Windows 2003 SP1, driver's INF files must contain the operating system's version (x86 or 64 versions).
INF Models Section
Important Starting with Windows Server 2003 SP1, INF files must
decorate models-section-name entries in the INF Manufacturer section,
along with the associated INF Models section names, with .ntia64 or
.ntamd64 platform extensions to specify non-x86 target operating
system versions. These platform extensions are not required in INF
files for x86-based target operating system versions or non-PnP driver
INF files (such as file system driver INF files for x64-based
architectures). Each entry in a Models section is sometimes called a
driver node.
Sample INF Models Sections for One or More Target Operating Systems
[Manufacturer]
%Msft% = Msft, NTx86.6.0, NTamd64.6.0
; ----------------------------------------------------------------------
; Models Section
; ----------------------------------------------------------------------
;For Windows 2000 and Windows XP
[Msft]
%NetVMini.DeviceDesc% = NetVMini.NTx86.ndi, root\NetVMini ; Root enumerated
%NetVMini.DeviceDesc% = NetVMini.NTx86.ndi, {b85b7c50-6a01-11d2-b841-00c04fad5171}\NetVMini ; Toaster Bus enumerated
;For Windows Vista and later
[Msft.NTx86.6.0]
%NetVMini.DeviceDesc% = NetVMini.NTx86.ndi, root\NetVMini ; Root enumerated
%NetVMini.DeviceDesc% = NetVMini.NTx86.ndi, {b85b7c50-6a01-11d2-b841-00c04fad5171}\NetVMini ; Toaster Bus enumerated
[Msft.NTamd64.6.0]
%NetVMini.DeviceDesc% = NetVMini.NTamd64.ndi, root\NetVMini ; Root enumerated
%NetVMini.DeviceDesc% = NetVMini.NTamd64.ndi, {b85b7c50-6a01-11d2-b841-00c04fad5171}\Ne

Related

Convert hdf5 to netcdf and rename dimensions

I have a set of HDF5 files that have the following header:
netcdf control-A-2017-05-12-090000-g1 {
dimensions:
phony_dim_0 = 16 ;
phony_dim_1 = 16 ;
phony_dim_2 = 200 ;
phony_dim_3 = 2 ;
phony_dim_4 = 1 ;
phony_dim_5 = 4 ;
variables:
...
Since it's HDF5, the dimensions are created as phony_dim_x. In this case, phony_dim_0 and phony_dim_1 are the y and x coordinates, respectively. I would like to rename the dimensions appropriately. Since renaming dimensions in HDF5 is not possible (since they don't technically exist), I need to convert to netcdf first. to do so I use ncks in.h5 out.nc.
However, the header info of the converted file is:
netcdf control-A-2017-05-12-090500-g1 {
dimensions:
phony_dim_0 = 16 ;
phony_dim_1 = 200 ;
phony_dim_2 = 2 ;
phony_dim_3 = 1 ;
phony_dim_4 = 4 ;
variables:
...
Here's the important part: the two phony_dim_[0,1] dimensions have been combined to a single dimension, phony_dim_0. I assume this is because they have the same value, and so the netcdf conversion assumes they're the same.
A variable that was listed in the hdf5 file as
ACCPA(phony_dim_0, phony_dim_1) ; is now ACCPA(phony_dim_0, phony_dim_0) ;, with two identical dimensions.
Thus, I am not able to rename the dimensions individually. If I do ncrename -d phony_dim_0,y out.nc, I get ACCPA(y, y) ;
Can anyone point me in the right direction to get around this?
The problem ended up being with ncks. Converting the file with ncks resulting in repeated dimensions (e.g. ACCPA(phony_dim_0, phony_dim_0) ;)
Using nccopy instead, the converted netCDF file did not produce repeated dimensions (ACCPA(phony_dim_0, phony_dim_1) ;)

Signability fails test for windows driver

This is the .inf file. It is just a sample from
https://github.com/microsoft/Windows-driver-samples/tree/master/print/OEM%20Printer%20Customization%20Plug-in%20Samples/C%2B%2B/bitmap
I have all the 3 files bitmap.DLL, bitmap.ini,bitmap.gdp all in the same folder at C:\windows.
Why does it complain about bitmap.gdp and bitmap.ini
I am getting this error:
Errors:
22.9.1: bitmap.gdp in [bitmapgdp] of Driver Package1\bitmap.inf is missing or cannot be decompressed from source media. Please verify all path values specified in SourceDisksNames, SouceDisksFiles, and CopyFiles sections resolve to the actual location of the file, and are expressed in terms relative to the location of the inf.
22.9.1: bitmap.ini in [bitmapini] of Driver Package1\bitmap.inf is missing or can
not be decompressed from source media. Please verify all path values specified in SourceDisksNames, SouceDisksFiles, and CopyFiles sections resolve to the actual location of the file, and are expressed in terms relative to the location of the inf.
; bitmap.INF
;
; INF file for bitmap Driver
; - for Windows XP (SP2), NT2003 (R2), Vista, Win7, NT2008 (x86 and x64)
;
; Copyright 2007-2010 MS
[Version]
Signature="$windows NT$"
ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318}
Class=Printer
Provider=MS
DriverVer=04/21/2010, 5.0.10.4211505
catalogfile = bitmapnew.cat
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Manufacturer Section
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[Manufacturer]
"Microsoft"=Microsoft, NTx86, NTamd64, NTia64, NTarm64
[Microsoft]
"Bitmap Driver" = BITMAP
[Microsoft.NTx86]
"Bitmap Driver" = BITMAP
[Microsoft.NTamd64]
"Bitmap Driver" = BITMAP
[Microsoft.NTia64]
"Bitmap Driver" = BITMAP
[Microsoft.NTarm64]
"Bitmap Driver" = BITMAP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Models Section
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[bitmapGDP]
bitmap.GDP
[bitmapINI]
bitmap.INI
[bitmapDLL]
bitmap.DLL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Install Section
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[BITMAP]
CopyFiles=bitmapGDP,bitmapINI,bitmapDLL
DataSection=UNIDRV_DATA
Include=NTPRINT.INF
Needs=UNIDRV.OEM,UNIDRV_DATA
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Source Media Section
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[DestinationDirs]
DefaultDestDir=66000
[SourceDisksFiles]
bitmap.DLL = 1,
bitmap.GDP = 1,
bitmap.INI = 1
[SourceDisksNames]
1 = %DiskName%,
2= %CWIN%
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Control Flags Section
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Strings Section
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[Strings]
DiskName="Disk Drive",
CWIN = "C:\Windows\bitmap"

How to create same tree except leaves?

I am making a parser for BGP Communities. I decided to make it with Antlr but I am totally new. This is my input:
NO_EXPORT do not to NTT
NO_EXPORT set to CNN
NO_EXPORT prepend except CNN
NO_EXPORT do not to CNN
LOCAL_PREFERENCE do not to NTT
LOCAL_PREFERENCE do not to CNN
That is my code:
expression
: action*
;
action
: no_export+
| local_preference+
| as_padding+
;
no_export
: 'NO_EXPORT' sentencenevdn+
| 'NO_EXPORT' sentencenevs+
| 'NO_EXPORT' sentencenevp+
;
local_preference
: ('LOCAL_PREFERENCE' sentencelp)+
;
as_padding
: ('AS_PADDING' sentenceap)+
;
sentencenevdn
: 'do not' prepdest+
;
sentencenevs
: ('set' prepdest)+
;
sentencenevp
: ('prepend' prepdest)+
;
sentencelp
: (verbs prepdest)+
;
sentenceap
: (verbs prepdest)+
;
verbs
: ('do not'|'set'|'prepend')+
;
prepdest
: 'to' dest+
| 'except' dest+
;
dest
: DESTINATION
;
This is output:
As you can see the first and the fourth "no_export" are the same execpt the "dest". I would like them to be the same child and this dest have two leaves: NTT and CNN
Anyone can help me? Thanks
Antlr is a tool primarily to lex/parse some input (syntactically), not to interpret the semantics. The resulting parse tree reflects the structure of your input data syntactically, not its semantic meaning. You are trying to gather pieces of information from different places in your input, however, to interpret them semantically.
Instead, simply use a second step when you have the tree above. Antlr will generate visitors or listeners for you if desired (use the -visitor or -listener command line options), with which you can easily traverse the tree to extract and collect your desired data in any data structure you convenient for you.

Storing data in RAM without avr-libc. How can I configure the proper memory sections using a custom linker script and initialization code?

Here's my linker script:
MEMORY {
text (rx) : ORIGIN = 0x000000, LENGTH = 64K
data (rw!x) : ORIGIN = 0x800100, LENGTH = 0xFFA0
}
SECTIONS {
.vectors : AT (0x0000) { entry.o (.vectors); }
.text : AT (ADDR (.vectors) + SIZEOF(.vectors)) { * (.text.startup); * (.text); * (.progmem.data); _etext = .; }
.data : AT (ADDR (.text) + SIZEOF (.text)) { PROVIDE (__data_start = .); * (.data); * (.rodata); * (.rodata.str1.1); PROVIDE (__data_end = .); } > data
.bss : AT (ADDR (.bss)) { PROVIDE (__bss_start = .); * (.bss); PROVIDE (__bss_end = .); } > data
__data_load_start = LOADADDR(.data);
__data_load_end = __data_load_start + SIZEOF(.data);
}
And this is my initialization code. init is called at reset.
.section .text,"ax",#progbits
/* Handle low level hardware initialization. */
.global init
init: eor r1, r1
out 0x3f, r1
ldi r28, 0xFF
ldi r29, 0x02
out 0x3e, r29
out 0x3d, r28
rjmp __do_copy_data
rjmp __do_clear_bss
jmp main
/* Handle copying data into RAM. */
.global __do_copy_data
__do_copy_data: ldi r17, hi8(__data_end)
ldi r26, lo8(__data_start)
ldi r27, hi8(__data_start)
ldi r30, lo8(__data_load_start)
ldi r31, hi8(__data_load_start)
rjmp .L__do_copy_data_start
.L__do_copy_data_loop: lpm r0, Z+
st X+, r0
.L__do_copy_data_start: cpi r26, lo8(__data_end)
cpc r27, r17
brne .L__do_copy_data_loop
rjmp main
/* Handle clearing the BSS. */
.global __do_clear_bss
__do_clear_bss: ldi r17, hi8(__bss_end)
ldi r26, lo8(__bss_start)
ldi r27, hi8(__bss_start)
rjmp .L__do_clear_bss_start
.L__do_clear_bss_loop: st X+, r1
.L__do_clear_bss_start: cpi r26, lo8(__bss_end)
cpc r27, r17
brne .L__do_clear_bss_loop
The problem is that the initialization code hangs sometime during the copying process. Here's an edited dump of my symbol table, if it's helpful to anyone.
00000000 a __tmp_reg__
...
00000000 t reset
...
00000001 a __zero_reg__
...
0000003d a __SP_L__
...
00000074 T main
0000009a T init
000000ae T __do_copy_data
000000c6 T __do_clear_bss
...
00000446 A __data_load_start
00000446 T _etext
0000045b A __data_load_end
00800100 D __data_start
00800100 D myint
00800115 B __bss_start
00800115 D __data_end
00800115 b foobar.1671
00800135 B ticks
00800139 B __bss_end
C is designed to work on von Neumann architectures. AVR is Harvard based. This means that C expects strings to be in RAM. As a consequence, if you ever take a look at the disassembly for any elf binary that would eventually be copied as a hex to your AVR chip, you will see two sections: __do_copy_data and __do_clear_bss [when required]. These routines, which are added in the linking stages, take care of the basic needs of the C language. As a consequence, what you are seeing here with your pointers is likely that they are pointing to the wrong addresses. In other words, they are either pointing to an address in program space but you are reading from data space [different address bus]. Or you are purposely reading from data space but have not copied the strings over.
See:
avr/pgmspace.h
FAQ: ROM Array and scroll down for strings
and of course, the AVR instruction set as provided by Atmel, especifically, the instruction to copy program memory over to data memory
Edited to reflect new question and comment: Your assembly for both sections look ok to me. I will have to take a look at your linker scripts with closer scrutinity to check if there any funny businesses going on there. Since you are writing a bootloader, do you mind if I ask if you have taken a look at bootloader support on AVR-libc?
http://deans-avr-tutorials.googlecode.com/svn/trunk/Progmem/Output/Progmem.pdf
This document may help to clarify the use of flash/ram memories of AVR.
I actually got it to work. All I had to do was enable reading from and writing to external RAM in the SREG. It was mindblowingly obvious and simple, I know, but it was buried in the data sheet and it was poorly documented.
This resource was helpful, but didn't have any documentation for my chip. If you're having this problem, look in the data sheet for your AVR and see how it is related. The process is not the same for all variations of AVRs.
How to use external RAM.

How to copy this portion of a text file out and put into a hash using rails? (VATsim datafile)

I'm trying to work out how i can cut out the section between !CLIENTS and the '; ;' and then to parse it into a hash in order to make an xml file. Honestly have no idea how to do it.
The file is as follows: vatsim-data.txt original file here
; Created at 30/12/2010 01:29:14 UTC by Data Server V4.0
;
; Data is the property of VATSIM.net and is not to be used for commercial purposes without the express written permission of the VATSIM.net Founders or their designated agent(s ).
;
; Sections are:
; !GENERAL contains general settings
; !CLIENTS contains informations about all connected clients
; !PREFILE contains informations about all prefiled flight plans
; !SERVERS contains a list of all FSD running servers to which clients can connect
; !VOICE SERVERS contains a list of all running voice servers that clients can use
;
; Data formats of various sections are:
; !GENERAL section - VERSION is this data format version
; RELOAD is time in minutes this file will be updated
; UPDATE is the last date and time this file has been updated. Format is yyyymmddhhnnss
; ATIS ALLOW MIN is time in minutes to wait before allowing manual Atis refresh by way of web page interface
; CONNECTED CLIENTS is the number of clients currently connected
; !CLIENTS section - callsign:cid:realname:clienttype:frequency:latitude:longitude:altitude:groundspeed:planned_aircraft:planned_tascruise:planned_depairport:planned_altitude:planned_destairport:server:protrevision:rating:transponder:facilitytype:visualrange:planned_revision:planned_flighttype:planned_deptime:planned_actdeptime:planned_hrsenroute:planned_minenroute:planned_hrsfuel:planned_minfuel:planned_altairport:planned_remarks:planned_route:planned_depairport_lat:planned_depairport_lon:planned_destairport_lat:planned_destairport_lon:atis_message:time_last_atis_received:time_logon:heading:QNH_iHg:QNH_Mb:
; !PREFILE section - callsign:cid:realname:clienttype:frequency:latitude:longitude:altitude:groundspeed:planned_aircraft:planned_tascruise:planned_depairport:planned_altitude:planned_destairport:server:protrevision:rating:transponder:facilitytype:visualrange:planned_revision:planned_flighttype:planned_deptime:planned_actdeptime:planned_hrsenroute:planned_minenroute:planned_hrsfuel:planned_minfuel:planned_altairport:planned_remarks:planned_route:planned_depairport_lat:planned_depairport_lon:planned_destairport_lat:planned_destairport_lon:atis_message:time_last_atis_received:time_logon:heading:QNH_iHg:QNH_Mb:
; !SERVERS section - ident:hostname_or_IP:location:name:clients_connection_allowed:
; !VOICE SERVERS section - hostname_or_IP:location:name:clients_connection_allowed:type_of_voice_server:
;
; Field separator is : character
;
;
!GENERAL:
VERSION = 8
RELOAD = 2
UPDATE = 20101230012914
ATIS ALLOW MIN = 5
CONNECTED CLIENTS = 515
;
;
!VOICE SERVERS:
voice2.vacc-sag.org:Nurnberg:Europe-CW:1:R:
voice.vatsim.fi:Finland - Sponsored by Verkkokauppa.com and NBL Solutions:Finland:1:R:
rw.liveatc.net:USA, California:Liveatc:1:R:
rw1.vatpac.org:Melbourne, Australia:Oceania:1:R:
spain.vatsim.net:Spain:Vatsim Spain Server:1:R:
voice.nyartcc.org:Sponsored by NY ARTCC:NY-ARTCC:1:R:
voice.zhuartcc.net:Sponsored by Houston ARTCC:ZHU-ARTCC:1:R:
;
;
!CLIENTS:
01PD:1090811:prentis gibbs KJFK:PILOT::40.64841:-73.81030:15:0::0::::USA-E:100:1:1200::::::::::::::::::::20101230010851:28:30.1:1019:
4X-BRH:1074589:george sandoval LLJR:PILOT::50.05618:-125.84429:10819:206:C337/G:150:CYAL:FL120:CCI9:EUROPE-C2:100:1:6043:::2:I:110:110:1:26:2:59:: /T/:DCT:0:0:0:0:::20101230005323:129:29.76:1007:
50125:1109107:Dave Frew KEDU:PILOT::46.52736:-121.95317:23877:471:B/B744/F:530:KTCM:30000:KLSV:USA-E:100:1:7723:::1:I:0:116:0:0:0:0:::GPS DIRECT.:0:0:0:0:::20101230012346:164:29.769:1008:
85013:1126003:Dmitry Abramov UWWW:PILOT::76.53819:71.54782:33444:423:T/ZZZZ/G:500:UUDD:FL330:ULAA:EUROPE-C2:100:1:2200:::2:I:0:2139:0:0:0:0:ULLI::BITSA DCT WM/N0485S1010 DCT KS DCT NE R22 ULWW B153 LAPEK B210 SU G476 OLATA:0:0:0:0:::20101229215815:62:53.264:1803:
;
;
!SERVERS:
EUROPE-C2:88.198.19.202:Europe:Center Europe Server Two:1:
;
; END
I want to format the xml with the tags with client being the parent and the nested tags as follows:
callsign:cid:realname:clienttype:frequency:latitude:longitude:altitude:groundspeed:planned_aircraft:planned_tascruise:planned_depairport:planned_altitude:planned_destairport:server:protrevision:rating:transponder:facilitytype:visualrange:planned_revision:planned_flighttype:planned_deptime:planned_actdeptime:planned_hrsenroute:planned_minenroute:planned_hrsfuel:planned_minfuel:planned_altairport:planned_remarks:planned_route:planned_depairport_lat:planned_depairport_lon:planned_destairport_lat:planned_destairport_lon:atis_message:time_last_atis_received:time_logon:heading:QNH_iHg:QNH_Mb:
Any help in solving this would be much appreciated!
You could do this with regex.
file = File.read("test.txt")
regex = Regexp.new(/!CLIENTS:.*;\n;/m)
parsed_text = regex.match(file)
parsed_text will then equal the matched text in that object.
Heres an example of the regex used to match
http://www.rubular.com/r/2mIRR4gozX
It looks like the text file uses : as a separator
So you could then take parsed_text and split it up.
#split the text on line breaks to an array
lines = parsed_text.to_s.split("\n")
#operate on each line
lines.each do |line|
#split each line into an array
line_array = line.split(":")
line_array.each do |item|
puts item
end
end
Then you would need to map each position of the array.

Resources