Click here to Skip to main content
15,440,014 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Manipulating of .txt file Pin
Richard Andrew x642-Jul-17 2:59
professionalRichard Andrew x642-Jul-17 2:59 
GeneralRe: Manipulating of .txt file Pin
Artur Grabowski2-Jul-17 4:18
MemberArtur Grabowski2-Jul-17 4:18 
GeneralRe: Manipulating of .txt file Pin
Richard Andrew x642-Jul-17 5:14
professionalRichard Andrew x642-Jul-17 5:14 
GeneralRe: Manipulating of .txt file Pin
Artur Grabowski2-Jul-17 5:34
MemberArtur Grabowski2-Jul-17 5:34 
GeneralRe: Manipulating of .txt file Pin
Richard Andrew x642-Jul-17 5:52
professionalRichard Andrew x642-Jul-17 5:52 
GeneralRe: Manipulating of .txt file Pin
Artur Grabowski2-Jul-17 6:41
MemberArtur Grabowski2-Jul-17 6:41 
QuestionRe: Manipulating of .txt file Pin
David Crow2-Jul-17 17:36
MemberDavid Crow2-Jul-17 17:36 
AnswerRe: Manipulating of .txt file Pin
Artur Grabowski3-Jul-17 19:00
MemberArtur Grabowski3-Jul-17 19:00 
This is a script to do this in ruby :
#!env ruby

def parse(text)
  text.split(',').map do |item|
    key, value = item.split(':')
    [key.to_i, value.to_f]
  end.to_h
end

input_data = File.read(ARGV[0]).gsub("\r", "")

id = nil
entries = {}

input_data.split("\n").each do |line|
  columns = line.split("|")

  id = columns[0].to_i if columns.size == 3
  entries[id] ||= {}

  if columns.size == 3 || columns.size == 1
    entries[id].merge! parse(columns.last)
  elsif columns.size != 0
    puts "? #{line}"
  end
end


entries.sort_by { |k,v| k }.each do |key, weights|
  puts
  puts
  puts "# neuron #{key}"

  puts "source\tweight"
  weights.sort_by { |k, v| k }.each do |source, weight|
    puts "#{source}\t#{weight.to_s.gsub('.',',')}"
  end
end

Thanks for help !!!
QuestionChecksum Generators With Advanced Functions Pin
Member 1328723330-Jun-17 8:49
MemberMember 1328723330-Jun-17 8:49 
AnswerRe: Checksum Generators With Advanced Functions Pin
Richard Andrew x6430-Jun-17 10:08
professionalRichard Andrew x6430-Jun-17 10:08 
GeneralRe: Checksum Generators With Advanced Functions Pin
Member 132872331-Jul-17 1:28
MemberMember 132872331-Jul-17 1:28 
GeneralRe: Checksum Generators With Advanced Functions Pin
Richard MacCutchan1-Jul-17 1:32
mveRichard MacCutchan1-Jul-17 1:32 
AnswerRe: Checksum Generators With Advanced Functions Pin
Randor 30-Jun-17 23:11
professional Randor 30-Jun-17 23:11 
GeneralRe: Checksum Generators With Advanced Functions Pin
Member 132872331-Jul-17 1:28
MemberMember 132872331-Jul-17 1:28 
AnswerRe: Checksum Generators With Advanced Functions Pin
jschell2-Jul-17 7:25
Memberjschell2-Jul-17 7:25 
QuestionException Handling MFC detail information Pin
ForNow28-Jun-17 4:40
MemberForNow28-Jun-17 4:40 
AnswerRe: Exception Handling MFC detail information Pin
Randor 28-Jun-17 5:11
professional Randor 28-Jun-17 5:11 
GeneralRe: Exception Handling MFC detail information Pin
ForNow28-Jun-17 15:45
MemberForNow28-Jun-17 15:45 
AnswerRe: Exception Handling MFC detail information Pin
Victor Nijegorodov29-Jun-17 8:33
MemberVictor Nijegorodov29-Jun-17 8:33 
GeneralRe: Exception Handling MFC detail information Pin
ForNow29-Jun-17 10:13
MemberForNow29-Jun-17 10:13 
GeneralRe: Exception Handling MFC detail information Pin
Victor Nijegorodov29-Jun-17 10:26
MemberVictor Nijegorodov29-Jun-17 10:26 
GeneralRe: Exception Handling MFC detail information Pin
ForNow29-Jun-17 10:49
MemberForNow29-Jun-17 10:49 
GeneralRe: Exception Handling MFC detail information Pin
Randor 29-Jun-17 10:52
professional Randor 29-Jun-17 10:52 
GeneralRe: Exception Handling MFC detail information Pin
ForNow29-Jun-17 15:51
MemberForNow29-Jun-17 15:51 
QuestionRe: Exception Handling MFC detail information Pin
David Crow29-Jun-17 17:37
MemberDavid Crow29-Jun-17 17:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.