
George E. P. Box said:"All models are false but some models are useful..."
My CMMI related white papers.
eric.mariacher@gmail.com
My innovation involved taking an idea from the telecommunications and banking industries, and applying that idea to transportation business. Frederick W. Smith |
One of the answer was:
3: public static int findNextValidInteger(String s) throws Exception {
4:
5: // detect 1st digit after start of string
6: int beginIndex=0;
7: int endIndex=1;
8: int length=s.length();
9: while(!s.substring(beginIndex,endIndex).matches("\\d")) {
10: beginIndex++;
11: endIndex++;
12: if(endIndex>length) {
13: throw new Exception("No digit found.");
14: }
15: }
16: int i_startNumber= beginIndex;
17:
18: // detect 1st non digit after start previously detected 1st digit
19: beginIndex=i_startNumber;
20: endIndex=i_startNumber+1;
21: while(s.substring(beginIndex,endIndex).matches("\\d")) {
22: beginIndex++;
23: endIndex++;
24: if(endIndex>length) {
25: break;
26: }
27: }
28: int i_endNumber= beginIndex;
29:
30: // return absolute value of integer
31: return Integer.valueOf(s.substring(i_startNumber, i_endNumber));
32: }
33:
Can also be done the following way, but may take lot of resources if String
is very long and you only need the 1st Integer.
35:
36: StringTokenizer str = new StringTokenizer("A 1965 Eric");
37:
38: while(str.hasMoreElements()) {
39: System.out.println(str.nextElement());
40: int i = Integer.parseInt(str.nextElement());
41: }
42:
I am proud that my team delivered firmware for the new Logitech illuminated keyboard.
This development was a challenge for our swiss team, as we are more specialized in developing wireless keyboards. We had to use a new chip that we had little experience with. The biggest obstacles we encountered was not because of the chip itself, but because of the compiler badly translating the C language to assembly code: "what you write, is not what you get". And this triggered some bugs that we had great difficulties to track and correct.
One of my job related questions is: "How long am I going to (suffer from?) using LotusNotes everyday?". Here are some various feedbacks that I got when asking:
"SharePoint is fast becoming the next IBM Lotus Notes — and not in a good way. For years people implemented Lotus Notes databases like crazy, seeing them as the best way to store and share information. Now you hear more about moving all the content and data into SharePoint. But what’s the point if you are just going from one messy datastore into another?"
Move Over Lotus Notes, SharePoint is Filling Yer Shoes1:rem Eric Mariacher
2:rem generate some charts and build a table of contents as 1st worksheet
3:Sub charts and TOC()
4: Dim ws As Worksheet
5: Dim cpt, cptpoint As Long
6: Dim color_index As Long
7: For Each ws In ActiveWorkbook.Worksheets
8: ActiveWorkbook.Activate
9: ws.Select
10: ws.Activate
11: Worksheets.Add
12: With ActiveSheet
13: .Name = "G" + ws.Name
14: Rem ch = .Controls.AddChart("B2:F7", "tagada")
15: End With
16: Charts.Add
17: ActiveChart.ChartType = xlColumnStacked
18: ActiveChart.SetSourceData Source:=Range(ws.Name), PlotBy:=xlColumns
19: With ActiveChart
20: .HasTitle = True
21: .ChartTitle.Characters.Text = ws.Name
22:
23: cpt = 1
24: For cpt = 1 To .SeriesCollection.Count
25: Select Case cpt
26: Case 1
27: color_index = 1
28: Case 2
29: color_index = 9
30: End Select
31: .SeriesCollection(cpt).Interior.ColorIndex = color_index
32: Next cpt
33: End With
34: ActiveChart.Location Where:=xlLocationAsObject, Name:="G" + ws.Name
35: With Worksheets("G" + ws.Name)
36: .ChartObjects(1).Width = 900
37: .ChartObjects(1).Height = 600
38: .ChartObjects(1).Left = .Columns("A").Left
39: .ChartObjects(1).Top = .Rows("2").Top
40: End With
41: Next ws
42:
43: Dim wsTOC As Worksheet
44: Dim Chart As Chart
45: Dim r As Long
46: Application.ScreenUpdating = False
47: Set wsTOC = ActiveWorkbook.Worksheets.Add _
48: (Before:=ActiveWorkbook.Sheets(1))
49: wsTOC.Name = "Table_of_Contents"
50: wsTOC.Range("A1") = "Table of Contents"
51: wsTOC.Range("A1").Font.Size = 18
52: wsTOC.Columns("A:A").ColumnWidth = 40
53: r = 3
54: For Each ws In ActiveWorkbook.Worksheets
55: If ws.Name <> wsTOC.Name And ws.Name Like "G*" Then
56: wsTOC.Hyperlinks.Add _
57: anchor:=wsTOC.Cells(r, 1), _
58: Address:="", _
59: SubAddress:=ws.Name & "!A1", _
60: TextToDisplay:=ws.Name
61: r = r + 1
62: ws.Hyperlinks.Add _
63: anchor:=ws.Cells(1, 1), _
64: Address:="", _
65: SubAddress:="Table_of_Contents!A1", _
66: TextToDisplay:="Table of Contents"
67: End If
68: Next
69: Application.ScreenUpdating = True
70:End Sub
Qui a dit que femme et informatique ne faisaient pas bon ménage? Ana Milosevic, jeune ingénieure d’intégration software de 26 ans pour logitech, nous explique en quoi son métier est passionnant.
Parole d'informaticienne: "C’est un métier excitant et plein de défis"
function table_print (tt, indent, done)
done = done or {}
indent = indent or 0
if type(tt) == "table" then
local sb = {}
for key, value in pairs (tt) do
table.insert(sb, string.rep (" ", indent)) -- indent it
if type (value) == "table" and not done [value] then
done [value] = true
table.insert(sb, "{\n");
table.insert(sb, table_print (value, indent + 2, done))
table.insert(sb, string.rep (" ", indent)) -- indent it
table.insert(sb, "}\n");
elseif "number" == type(key) then
table.insert(sb, string.format("\"%s\"\n", tostring(value)))
else
table.insert(sb, string.format("%s = \"%s\"\n", tostring (key), tostring(value)))
end
end
return table.concat(sb)
else
return tt .. "\n"
end
end
function to_string( tbl )
if "nil" == type( tbl ) then
return tostring(nil)
elseif "string" == type( tbl ) then
return tbl
elseif "table" == type( tbl ) then
return table_print(tbl)
else
tostring(tbl)
end
end
print(to_string({"Lua",user="Mariacher",{{co=coroutine.create(function() end),{number=12345.6789}},
func=function() end}, boolt=true}))
"Lua"
{
{
{
number = "12345.6789"
}
co = "thread: 0212B848"
}
func = "function: 01FC7C70"
}
boolt = "true"
user = "Mariacher"
Dans la plaine les baladins
S'éloignent au long des jardins
Devant l'huis des auberges grises
Par les villages sans églises
Et les enfants s'en vont devant
Les autres suivent en rêvant
Chaque arbre fruitier se résigne
Quand de très loin ils lui font signe
Ils ont des poids ronds ou carrés
Des tambours des cerceaux dorés
L'ours et le singe animaux sages
Quêtent des sous sur leur passage.
APOLLINAIRE