Is it possible to keep code state across pages in an ePub? More specifically do readers like iBooks allow this type of state?
spine.js
+---------+----------+
| | |
+--------+ +--------+ +--------+
| Page 1 | | Page 2 | | Page |
| Quiz1 | | Quiz2 | | (n) |
| | | | | Result |
| | | | | |
+--------+ +--------+ +--------+
In this example, the last page could contain a score but state is required. WebSQL is out of the question since it's not supported by webkit ereaders and websockets demand a connection. Any thoughts?
No. Each HTML file is independent. To share information, you'll need to use some kind of local storage such as window.localStorage, but it's very hard to find out what device supports what level of HTML5.
UPDATE: This thread says localStorage is in fact supported.
Related
We currently capture data from HL7 messages like below and then insert the same in database. This is easy as it is value from a single segment
var vACC_NO =checkSize("ACC",msg['PID']['PID.3']['PID.3.1'].toString(),20);
INSERT INTO adt_tab ( SITEID,ACC_NO) VALUES (vSITEID,vACC_NO);
Now I need to capture DG1 segment data, where we have multiple DG1 segments in HL7 message. And also need to store in Database
| DG1 | 1 | ICD10 | I22.8^MYOCARDIAL INFARCT^ICD10 | MYOCARDIAL | | | | | | | | | | | |
| INFARCTION | 201702010437 | B | | | | | | | | | 7 | | | | |
| DG1 | 2 | ICD10 | A44.9^ORGANISM^ICD10 | ORGANISM | 20170201 0437 | B | | | | | | | | | 7 |
So in my database table I have now more columns - SITEID, ACC_NO, CODE1, CODE2...
From the above message I need to insert I22.8 into CODE 1, A44.9 into CODE2 and so on ..
How I should first capture these codes in loop from multiple DG1 segments in the message ?
And then how I should store it in the database ?
Thanks
You can iterate over the segments like this
for each (dg1 in msg['DG1']){
variable1 = dg1['DG1.3']['DG1.3.1'];
variable2 = dg1['DG1.3']['DG1.3.2'];
// database call with the previus
databaseCall(variable1,variable2, ...
}
For each segment you are going to do an insert.
Apart from this, I do not think is a good idea to make more columns in the same row by adding variable1, variable2, variable3 ... as it is not normalized and it not a good database design practice.
I'm a new with Rails and I'm having trouble with some types of associations that seem a bit more complex than the ones I've been exposed to so far.
Zombie_users Body_parts_status Body_parts
| id | name | | id | user_id | body_part_id | recovery | | id | name |
|-----------| --> |----------------------------------------| --> |---------------|
| 1 | Joe | | 1 | 1 | 2 | 10% | | 1 | left leg |
| 2 | Max | | 2 | 1 | 3 | 43% | | 2 | brain |
| 3 | hair |
| 4 | blue eye |
Zobmie_users Recovery_tools Body_parts_impacts
| id | name | | id |user_id| name | | id|recovery_tool_id| body_part_id | impact |
|-----------|-->|-------------------|-->|--------------------------------------------|
| 1 | Joe | | 1 | 1 |hammer| | 1 | 1 | 2 | 10% |
| 2 | Max | | 2 | 1 |magic | | 2 | 2 | 3 | 43% |
graphic illustration of the needed functionality
We have users and a list of body parts.
I need that the users will be able to create recovery tools with which they can through Body Parts impact recover their body parts status :)
and be able to check what part of the body still need to be fixed(compared to the list) and what body parts they have already corrected.
My problem is that I do not know how to implement such connections.
because I need to have some kind of clone of the body parts to body parts status for each user.
But how I reference it so it also works with Body Parts impacts
I do not have even a concept of where to start :)
body parts table is just a long listing of all the parts of the human body
and each user should have their own "copy" of all these parts.
I am running this query (bisac_code is uniquely indexed).
Execution time is more than 2.5 minutes.
52 main codes are selected from almost 4000 in total.
The total number of wokas is very large, 19 million nodes.
Are there any possibilities to make it run faster?
neo4j-sh (?)$ MATCH (b:Bisac)-[r:INCLUDED_IN]-(w:Woka)
> WHERE (b.bisac_code =~ '.*000000')
> RETURN b.bisac_code as bisac_code, count(w) as wokas_count
> ORDER BY b.bisac_code
> ;
+---------------------------+
| bisac_code | wokas_count |
+---------------------------+
| "ANT000000" | 13865 |
| "ARC000000" | 32905 |
| "ART000000" | 79600 |
| "BIB000000" | 2043 |
| "BIO000000" | 256082 |
| "BUS000000" | 226173 |
| "CGN000000" | 16424 |
| "CKB000000" | 26410 |
| "COM000000" | 44922 |
| "CRA000000" | 18720 |
| "DES000000" | 2713 |
| "DRA000000" | 62610 |
| "EDU000000" | 228182 |
| "FAM000000" | 42951 |
| "FIC000000" | 474004 |
| "FOR000000" | 41999 |
| "GAM000000" | 8803 |
| "GAR000000" | 37844 |
| "HEA000000" | 36939 |
| "HIS000000" | 3908869 |
| "HOM000000" | 5123 |
| "HUM000000" | 29270 |
| "JNF000000" | 40396 |
| "JUV000000" | 200144 |
| "LAN000000" | 89059 |
| "LAW000000" | 153138 |
| "LCO000000" | 1528237 |
| "LIT000000" | 89611 |
| "MAT000000" | 58134 |
| "MED000000" | 80268 |
| "MUS000000" | 75997 |
| "NAT000000" | 35991 |
| "NON000000" | 107513 |
| "OCC000000" | 42134 |
| "PER000000" | 26989 |
| "PET000000" | 4980 |
| "PHI000000" | 72069 |
| "PHO000000" | 8546 |
| "POE000000" | 104609 |
| "POL000000" | 309153 |
| "PSY000000" | 55710 |
| "REF000000" | 96477 |
| "REL000000" | 133619 |
| "SCI000000" | 86017 |
| "SEL000000" | 40901 |
| "SOC000000" | 292713 |
| "SPO000000" | 172284 |
| "STU000000" | 10508 |
| "TEC000000" | 77459 |
| "TRA000000" | 9093 |
| "TRU000000" | 12041 |
| "TRV000000" | 27706 |
+---------------------------+
52 rows
198310 ms
And the response time is not consistent.
After a while drops to less than half of a minute.
52 rows
31207 ms
In Neo4j 2.3 there will be index support for prefix LIKE searches but probably not for postfix ones.
There are two ways of making #user2194039's solution faster:
Use path expression to count the Woka per Bisac:
MATCH (b:Bisac) WHERE (b.bisac_code =~ '.*000000')
WITH b, size((b)-[:INCLUDED_IN]->()) as wokas_count
RETURN b.bisac_code as bisac_code, wokas_count
ORDER BY b.bisac_code
Mark the Bisac's with that pattern with a label
MATCH (b:Bisac) WHERE (b.bisac_code =~ '.*000000') SET b:Main;
MATCH (b:Main:Bisac)
WITH b, size((b)-[:INCLUDED_IN]->()) as wokas_count
RETURN b.bisac_code as bisac_code, wokas_count
ORDER BY b.bisac_code;
The slow speed is caused by your regular expression pattern matching (=~ ). Although your bisac_code is indexed, the regex match causes the index to be ineffective. The index only works when you are matching full bisac_code values.
Cypher does include some string manipulation facilities that might let you get by without using a regex =~, but I doubt it would make any difference, because the index will still be useless.
I might suggest considering if you can further categorize your bisac_codes so that you do not need to do a pattern match. Maybe an extra indexed property that somehow denotes those codes that end in 000000?
If you do not want to add properties, you may try matching only the Bisacs first, and then including the Wokas. Something like this:
MATCH (b:Bisac) WHERE (b.bisac_code =~ '.*000000')
WITH b
MATCH (b)-[r:INCLUDED_IN]-(w:Woka)
RETURN b.bisac_code as bisac_code, count(w) as wokas_count
ORDER BY b.bisac_code
This may help Cypher stick to the 4000 Bisac nodes while doing the pattern match, before getting involved with all 19 million Woka nodes, but I am not sure if this will make a material difference. Even slogging through 4000 nodes (effectively without an index) is a slow process.
Hash Tables in Database Indexing
The reason that your index is ineffective for regex pattern matching is that Neo4j likely uses a hash table for indexing properties. This is common of many databases. Wikipedia has an article here.
The basics though are that the index is not storing all of the properties that you want to search through. It is storing values that represent the properties you want to search through, and the representation is only valid for the whole property. If you are searching for only a part of the property value, the hashes stored in the index are useless, and the database must search through the properties the old-fashioned way -- one by one.
Edit re: your edit
The improvement in response time after running this query multiple times is certainly due to caching. Neo4j is remembering that you access the Bisac nodes and bisac_code properties frequently, and is keeping them in memory. This makes future queries faster because the values do not need to be read off disk.
However, eventually, those nodes a properties will likely be dropped from the cache, as Neo4j finds you manipulating different nodes, which it will cache instead. There are only so many nodes Neo4j can cache before running out of memory, so it picks the most recent and/or frequently used data.
I resolved the following question but
I have another issue. I would like to
analyse "Likert Scale" questionaire
which is measured 1 to 5 ( agree,
strongly agree etc ). I tried many
ways but I didn't combine all results.
Have you got any idea to analyze
likert scale?
Does anybody help us to define following type of question in SPSS variable view?
( looks like array question, user answers non unique which they can enter text )
QUESTION 1:
Allows a table of text inputs
+----------------------------------------------+
| Speed Design Accuracy |
+----------+---------+----------+--------------+
| Google | | | |
+----------+---------+----------+--------------+
| Yahoo | | | |
+----------+---------+----------+--------------+
| Bing | | | |
+----------+---------+----------+--------------+
I had the same problem. Fortunately, it is easy to solve ;)
If you have your data in the table - you have to "restructure" it (Menu - Data - Restructure). This option allows you to create multidimansional variables. You can find some tutorial on youtube for data restructuring.
In your case, you have to make it manually. You just repeat your identifying variable accordng to the amount of likert scale questions. Let's assume you have 3 questions to "Speed", 3 questions to "Design", and 3 questions to "Accuracy". Your table should look like this:
+----------------------------------------------+
| Speed1 Speed2 Speed3 | Duration1 | Duration2 | ...
+----------+---------+----------+--------------+
| Google | | | | | |
+----------+---------+----------+--------------+
| Yahoo | | | |
+----------+---------+----------+--------------+
| Bing | | | |
+----------+---------+----------+--------------+
You can restructure the data later to perform statistical analysis.
In the case of repeated measurement (e.g. you asked your Likert scale question in the same company 3 times over time), your table might look like this:
+----------------------------------------------+
| Speed1 Speed2 Speed3 | Duration1 | Duration2 | ...
+----------+---------+----------+--------------+
| Google | | | | | |
+----------+---------+----------+--------------+
| Google | | | |
+----------+---------+----------+--------------+
| Google | | | |
+----------+---------+----------+--------------+
| Yahoo | | | |
+----------+---------+----------+--------------+
| Yahoo | | | |
+----------+---------+----------+--------------+
| Yahoo | | | |
+----------+---------+----------+--------------+
| Bing | | | |
+----------+---------+----------+--------------+
...
I hope, it helped!
Best,
Eugene
I am not sure I know what you are asking, but I believe you are looking for some guidance as to what the "dataset" might need to look like. If you run the following syntax, you should get a better idea of how I would structure it.
DATA LIST LIST (",") / browser (A30) type (A30) score.
BEGIN DATA
Google, Speed, 123
Yahoo, Speed, 34
Bing, Design, 23
Google, Accuracy, 231
Yahoo, Design, 12
END DATA.
Likert scale data should be analyzed using non-parametric methods. Two ways to handle this.
1). Rank the cases and then perform ANOVA on the ranked values
2). Perform Kruskal Wallis on the Likert scale data
Regards
When providing a link to a PDF file on a website, is it possible to include information in the URL (request parameters) which will make the PDF browser plugin (if used) jump to a particular bookmark instead of just opening at the beginning?
Something like: http://www.somehost.com/user-guide.pdf?bookmark=chapter3 ?
If not a bookmark, would it be possible to go to a particular page?
I'm assuming that if there is an answer it may be specific to Adobe's PDF reader plugin or something, and may have version limitations, but I'm mostly interested in whether the technique exists at all.
Yes, you can link to specific pages by number or named locations and that will always work if the user's browser uses Adobe Reader as plugin for viewing PDF files.
For a specific page by number:
Link text
For a named location (destination):
Link text
To create destinations within a PDF with Acrobat:
Manually navigate through the PDF for the desired location
Go to View > Navigation Tabs > Destinations
Under Options, choose Scan Document
Once this is completed, select New Destination from the Options menu and enter an appropriate name
RFC 3778 section 3 specifies "Fragment Identifiers" that can be used with PDF files, which include nameddest and page.
There are multiple query parameters that can be handled.
Full list below:
Source
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| Syntax | Description | Example |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| nameddest=destination | Specifies a named destination in the PDF document | http://example.org/doc.pdf#Chapter6 |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| page=pagenum | Specifies a numbered page in the document, using an integer | http://example.org/doc.pdf#page=3 |
| | value. The document’s first page has a pagenum value of 1. | |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| comment=commentID | Specifies a comment on a given page in the PDF document. Use | #page=1&comment=452fde0e-fd22-457c-84aa- |
| | the page command before this command. | 2cf5bed5a349 |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| collab=setting | Sets the comment repository to be used to supply and store | #collab=DAVFDF#http://review_server/Collab |
| | comments for the document. This overrides the default comment | /user1 |
| | server for the review or the default preference. The setting is of the | |
| | form store_type#location, where valid values for store_type are: | |
| | ● DAVFDF (WebDAV) | |
| | ● FSFDF (Network folder) | |
| | ● DB (ADBC) | |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| zoom=scale | Sets the zoom and scroll factors, using float or integer values. For | http://example.org/doc.pdf#page=3&zoom=200,250,100 |
| zoom=scale,left,top | example, a scale value of 100 indicates a zoom value of 100%. | |
| | Scroll values left and top are in a coordinate system where 0,0 | |
| | represents the top left corner of the visible page, regardless of | |
| | document rotation | |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| view=Fit | Set the view of the displayed page, using the keyword values | http://example.org/doc.pdf#page=72&view=fitH,100 |
| view=FitH | defined in the PDF language specification. For more information, | |
| view=FitH,top | see the PDF Reference. | |
| view=FitV | Scroll values left and top are floats or integers in a coordinate | |
| view=FitV,left | system where 0,0 represents the top left corner of the visible | |
| view=FitB | page, regardless of document rotation. | |
| view=FitBH | Use the page command before this command. | |
| view=FitBH,top | | |
| view=FitBV | | |
| view=FitBV,left | | |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| viewrect=left,top,wd,ht | Sets the view rectangle using float or integer values in a | |
| | coordinate system where 0,0 represents the top left corner of the | |
| | visible page, regardless of document rotation. | |
| | Use the page command before this command. | |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| pagemode=bookmarks | Displays bookmarks or thumbnails. | http://example.org/doc.pdf#pagemode=bookmarks&page=2 |
| pagemode=thumbs | | |
| pagemode=none | | |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| scrollbar=1|0 | Turns scrollbars on or off | |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| search=wordList | Opens the Search panel and performs a search for any of thewords in the specified word list. | #search="word1 word2" |
| | The first matching word ishighlighted in the document. | |
| | The words must be enclosed in quotation marks and separated byspaces. | |
| | You can search only for single words. You cannot search for a string of words. | |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| toolbar=1|0 | Turns the toolbar on or off. | |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| statusbar=1|0 | Turns the status bar on or off. | |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| messages=1|0 | Turns the document message bar on or off. | |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| navpanes=1|0 | Turns the navigation panes and tabs on or off. | |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| highlight=lt,rt,top,btm | Highlights a specified rectangle on the displayed page. Use the | |
| | page command before this command. | |
| | The rectangle values are integers in a coordinate system where | |
| | 0,0 represents the top left corner of the visible page, regardless of | |
| | document rotation | |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| fdf=URL | Specifies an FDF file to populate form fields in the PDF file beingopened. | #fdf=http://example.org/doc.fdf |
| | Note: The fdf parameter should be specified last in a URL. | |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
It's worth adding that Wayne's solution also works in:
Chrome (since v. 14 from 2011, see this issue for details) (tested on v. 87 and v. 44),
Firefox (tested on v. 84.0.1 and v. 40),
Opera (tested on v. 73 and v. 31),
Safari (tested on v. 14.0.2, it didn't work on v. 8),
(Updated with the current versions as of January 2021.)
PDF Open Parameters documents the available URL fragments you can use.