Difference between revisions of "User:Kbjarkefur"

Jump to: navigation, search
 
(113 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Kbjarkefur is a Data Coordinator at DIME.


His full name is Kristoffer Bjärkefur.
== About me==
*Kristoffer Bjärkefur
*Work with developing best practice and software tools at DIME
*See https://github.com/worldbank/ietoolkit
*kbjarkefur@worldbank.org


Check out his GitHub page: https://github.com/kbjarkefur
== Pages on this wiki I frequently need: ==


{| class="wikitable"  style="margin-left: auto; margin-right: auto; border: none;"
*Stylesheet : [[MediaWiki:Common.css]]
|+ The parts of a survey form name
*Javascript : [[MediaWiki:Common.js]]
|-
 
! colspan="4" Meaning
== List example ==
! Part of name
 
! Description
'''Spacing between a list and the following paragraph needs to be increased. And the indentation infront of an ordered list and a non-ordered list should be the same.'''
! Other examples
 
|-
*ul list item 1
|colspan="4" style="text-align:center;"|Example survey name : KBMAP_BL_HH_v1
*ul list item 2
|-
Not a part of the list
|Project
 
| KBMAP
#ol list item 1
| The name of the project, use an abbreviation or other short form.
#ol list item 2
A server is usually linked to only one project, so this part does not matter as much on the server. But all data associated with this questionnaire will be tagged with this name, and there the project name is indeed useful.
Not a part of the list
| Any project name. Do not use survey round (baseline, follow up, back check etc.) or unit of observation (household, village, school etc.)
 
|-
'''Strangely this works with second level bullet points'''
| Survey round
*level 1
| BL
*level 1
| Indicates which survey this is within the project.  
** level 2
Since a difference in name here indicates a different data set on the server, then we want to differentiate between baseline and baseline pilot, as we do not want to mix pilot data with real data.
** level 2
| Baseline (BL), Baseline pilot (BLpilot), Endline (EL), monitoring data, population listing etc.
This text is not a part of the list
|-
 
| Unit of observation
'''Example where his gets confusing where the text after the list looks like a part of the list (problem is not as big with numbered lists as the indentation is bigger, but it still looks weird)'''
| HH
 
| What type of respondents will be interviewed? Household, school, etc. It is both needed to separate multiple survey within a survey round (doctor/patient, teacher/school), but it is also helpful documentation to anyone using the data set in the future.
*The first reason is that it possible to run all code related to a project by running only one dofile. This is incredible important for replicability.
| Household (HH), village, civil servant, etc.
*The second purpose is to set up globals with folder paths that enables dynamic file paths that in turn allows multiple users run the same code, it shortens the file paths as well as making it possible to move files and folders with minimal updates to the code.
|-
*The third purpose is that this file is the main map to the DataWork folder.
| Version
Each of these purposes are described in more detail below.
| v1
 
| This is different from the setting version. When you are developing a questionnaire you use the version setting to indicate to the server that you have made updates. After you are happy with your updates (that usually takes testing several uploads) you update the version number in the name, and download this new version to the tablets. The reason why this is important is explained below (KB: link to that section).
#The first reason is that it possible to run all code related to a project by running only one dofile. This is incredible important for replicability.
| Number them in natural order, v1, v2 etc.
#The second purpose is to set up globals with folder paths that enables dynamic file paths that in turn allows multiple users run the same code, it shortens the file paths as well as making it possible to move files and folders with minimal updates to the code.
|}
#The third purpose is that this file is the main map to the DataWork folder.
Each of these purposes are described in more detail below.
 
== Code snippet example ==
 
The first example is using the regular <nowiki><code></nowiki> tag which is great when writing code in the middle of a sentence:
 
'''Ex.1''' Use the ''egen'' function <code>rowtotal()</code> when aggregating variables.
 
However, the <nowiki><code></nowiki> tag is not great when writing multiple lines of code because there is a space in the formatting between the lines. It doesn't feel like a single code snippet.
 
'''Ex.2'''
 
<code>
gen varA = .<br>
replace varA = 1 if gender == 1<br>
replace varA = 0 if gender == 0
</code>
 
One solution to this that I found was to use the <nowiki><pre></nowiki> tag. Multiple lines displays really nice (and I like the color better):
 
'''Ex.3'''
<pre>
gen varA = .
replace varA = 1 if gender == 1
replace varA = 0 if gender == 0
</pre>
 
However, the <nowiki><pre></nowiki> tag is no good for when writing code in the middle of a sentence. '''Ex.4''' is the same code as '''Ex.1''' but with a <nowiki><pre></nowiki> tag instead of a <nowiki><code></nowiki> tag (this was supposed to have been on one line):
 
'''Ex.4''' Use the ''egen'' function <pre>rowtotal()</pre> when aggregating variables.
 
 
'''Summary and suggested solution:''' What I have done in my examples I uploaded today was to use <nowiki><pre></nowiki> for multi-line code examples and <nowiki><code></nowiki> for inline code examples, but as they look quite different in color I do not think it is a great solution. It won't be obvious that both are code examples. Not our top priority perhaps, but since there will be plenty of code examples we should decide on a standard for how we do this.
 
Both the <nowiki><pre></nowiki> tag and the <nowiki><code></nowiki> tag are HTML elements that can be formatted with CSS (I checked the page source and in the HTML they do inteed have those tags). I think Ritesh's team should be able to quite easily format one of them to look more similar to the other. The only issue would be if these tags are used as something else already somewhere on the wiki and changing them will mess up what they are also used for.
 
I do not like the red in the <nowiki><code></nowiki> tag that much as it looks like an error so I'd prefer both of them to be like the <nowiki><pre></nowiki> but keep both of them working as they are now in terms of position and line break.

Latest revision as of 15:49, 18 January 2018

About me

Pages on this wiki I frequently need:

List example

Spacing between a list and the following paragraph needs to be increased. And the indentation infront of an ordered list and a non-ordered list should be the same.

  • ul list item 1
  • ul list item 2

Not a part of the list

  1. ol list item 1
  2. ol list item 2

Not a part of the list

Strangely this works with second level bullet points

  • level 1
  • level 1
    • level 2
    • level 2

This text is not a part of the list

Example where his gets confusing where the text after the list looks like a part of the list (problem is not as big with numbered lists as the indentation is bigger, but it still looks weird)

  • The first reason is that it possible to run all code related to a project by running only one dofile. This is incredible important for replicability.
  • The second purpose is to set up globals with folder paths that enables dynamic file paths that in turn allows multiple users run the same code, it shortens the file paths as well as making it possible to move files and folders with minimal updates to the code.
  • The third purpose is that this file is the main map to the DataWork folder.

Each of these purposes are described in more detail below.

  1. The first reason is that it possible to run all code related to a project by running only one dofile. This is incredible important for replicability.
  2. The second purpose is to set up globals with folder paths that enables dynamic file paths that in turn allows multiple users run the same code, it shortens the file paths as well as making it possible to move files and folders with minimal updates to the code.
  3. The third purpose is that this file is the main map to the DataWork folder.

Each of these purposes are described in more detail below.

Code snippet example

The first example is using the regular <code> tag which is great when writing code in the middle of a sentence:

Ex.1 Use the egen function rowtotal() when aggregating variables.

However, the <code> tag is not great when writing multiple lines of code because there is a space in the formatting between the lines. It doesn't feel like a single code snippet.

Ex.2

gen varA = .
replace varA = 1 if gender == 1
replace varA = 0 if gender == 0

One solution to this that I found was to use the <pre> tag. Multiple lines displays really nice (and I like the color better):

Ex.3

gen varA = .
replace varA = 1 if gender == 1
replace varA = 0 if gender == 0

However, the <pre> tag is no good for when writing code in the middle of a sentence. Ex.4 is the same code as Ex.1 but with a <pre> tag instead of a <code> tag (this was supposed to have been on one line):

Ex.4 Use the egen function

rowtotal()

when aggregating variables.


Summary and suggested solution: What I have done in my examples I uploaded today was to use <pre> for multi-line code examples and <code> for inline code examples, but as they look quite different in color I do not think it is a great solution. It won't be obvious that both are code examples. Not our top priority perhaps, but since there will be plenty of code examples we should decide on a standard for how we do this.

Both the <pre> tag and the <code> tag are HTML elements that can be formatted with CSS (I checked the page source and in the HTML they do inteed have those tags). I think Ritesh's team should be able to quite easily format one of them to look more similar to the other. The only issue would be if these tags are used as something else already somewhere on the wiki and changing them will mess up what they are also used for.

I do not like the red in the <code> tag that much as it looks like an error so I'd prefer both of them to be like the <pre> but keep both of them working as they are now in terms of position and line break.