Reading information from multiple arrays efficiently
So I'm trying to make a flash application about number of felonies of different trafic violations from different years, example:
In 2002 there was 9631 drunk drivers, 13481 driving without a license, 9863 speeders and 18862 who broke other laws
In 2003 there was 8593 drunk drivers, 12785 driving without a license, 12217 speeders and 19196 who broke other laws
The list goes on and I've made 5 different arrays, one for year, one for drunk drivers, one for driving without a license,
I call them:
var arTab:Array = new Array();
arTab[0] = new Array(2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012);
var promilleTab:Array = new Array();
promilleTab[0] = new Array(9631, 8593, 8363, 8128, 8514, 8534, 8560, 8146, 8241, 8019, 8759);
var forerkortTab:Array = new Array();
forerkortTab[0] = new Array(13481, 12785, 12585, 12492, 13470, 14181, 14622, 14082, 14287, 13640, 14180);
var hastighetTab:Array = new Array();
hastighetTab[0] = new Array(9863, 12217, 14920, 14929, 15425, 18010, 15909, 14197, 13276, 11158, 12264);
var trafikklovenTab:Array = new Array();
trafikklovenTab[0] = new Array(18862, 19196, 20101, 20026, 21381, 21845, 20005, 19446, 20900, 19346, 20265);
After that I added 2 comboboxes, one for the year and one to pick felony, but when I try to write out the information in a text box I have to add ALOT of code, example:
function skrivUt(Event:MouseEvent)
var arListe:int = arKombo.selectedItem.data;
var bruddListe:int = bruddKombo.selectedItem.data;
if(bruddListe == 1)
if(arListe == 1)
txtSvar.text = "I " + arTab[0][0] + " ble det anmeldt " + promilleTab[0][0] + " for promillekjøring";
if(arListe == 2)
txtSvar.text = "I " + arTab[0][1] + " ble det anmeldt " + promilleTab[0][1] + " for promillekjøring";
if(arListe == 3)
txtSvar.text = "I " + arTab[0][2] + " ble det anmeldt " + promilleTab[0][2] + " for promillekjøring";
And I would have to make tons of almost the same line which works, but my question is:
Is there any way I can write this in a more efficient way?
You could look for a pattern that follows your current code. For what you show already I see...
function skrivUt(Event:MouseEvent)
var arListe:int = arKombo.selectedItem.data;
var bruddListe:int = bruddKombo.selectedItem.data;
if(bruddListe == 1)
txtSvar.text = "I " + arTab[0][arListe-1] + " ble det anmeldt " + promilleTab[0][arListe-1] + " for promillekjøring";
Similar Messages
-
After installing the reportservice/database i cannot use the Configuration Manager Console 2012 anymore with my own AD account. (The accounts of my colleagues are stil working)
When i login i get the following message:
The user account running the Configuration Manager console has insufficient permissions to read information from the Configuration Manager site database. The account must belong to a security role in Configuration Manager. The account must also have
the Windows Server Distributed Component Object Model (DCOM) Remote Activation permission for the computer running the Configuration Manager site server and the SMS Provider.
I checked the following:
I am a administrative user in SCCM (Full Administrator)
I am a member of the administrator group on the server
Deleted HKEY_CURRENT_USER\Software\Microsoft\ConfigMgr10
I tried to start it on multiple workstations and deleted my roaming profile
Any more suggestions?Hi,
Maybe you could have a look on the below blog.
http://blog.nimbo.com/how-to-disable-user-account-control-in-windows-server-2012/
(Note: Microsoft provides third-party contact information to help you find technical support. This contact information
may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.)
Best Regards,
Joyce Li
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place. -
Get information from an array saved into a text file
I am trying to get information from an array saved as a text file to extract the information to build an string. This string will go out from the serial port to a device which will listen this message and it will answer the question. All the information sended sequencially it has to be obtained from that array. Every row contain one instruction and this has to be sended one after one.
Could you tell me if is possible to make this driver? And if you have a similar driver, Where can I get it from?The VIs that I would suggest using are found in the String Function Pallet:
Spreadsheet String To Array
Array To Spreadsheet String
The delimiter should be the termination character. These VIs will adapt to a string array.
For the Spreadsheet String To Array wire an empty string array and use %s as the format. The delimiter should be the termination character of the text file, most likely a end of line (\r\n).
For the Array To Spreadsheet String the delimiter should be the termination required for your serial device.
Using a combination of these two VIs should provide you the functions required to make the driver. -
Without loops how can i read data from associative Array??
Hi all,
I am facing scenario like...
i need to read data from associative array without using loops is it possible,
CREATE OR REPLACE PACKAGE BODY test_pkg IS
TYPE t1 IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
-- in array we can expect more than one row or sometimes no data also.
FUNCTION test1(vt1 T1 DEFAULT CAST(NULL AS t1)) RETURN NUMBER IS
BEGIN
-- basically in array we'll get data of column2
-- this loop should satisfies table1.colum2 = nvl(NULL, table2.colum2 )if array is null.
-- if array is not null then only compare with array values
FOR i IN (SELECT t1.colum1,t1.column2
FROM table1 t1, table1 t2
WHERE t1.colum1 = t2.column1
AND t1.colum2 = nvl(vt1, t2.colum2)
LOOP
generateTEXT(i.colum1, i.colum2);
END LOOP;
END test1;
END test_pkg;
in table1 we have date like...
colum1 column2
Jan 1
Feb 2
Mar 3
if i call select test_pkg.test1(1) from dual then output should
be Jan..
and
select test_pkg.test1(null) from dual then it should display all elements from table1.
Jan 1
Feb 2
Mar 3,
Thanks for your quick replay..i need to read data from associative array without using loops is it possible,
No - you would need to create a SQL type and then use the TABLE operator to unnest the collection.
create or replace TYPE my_nums IS TABLE OF INTEGER;
DECLARE
-- TYPE my_nums IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER;
v_nums my_nums := my_nums(1, 2, 3);
v_total number;
BEGIN
select sum(column_value) into v_total from table(v_nums);
DBMS_OUTPUT.PUT_LINE
('Sum of the numbers is ' || TO_CHAR(v_total));
END;
Sum of the numbers is 6 -
1456 the remote management agent is unable to read information from edirectory
I have novell 6.5 sp6 and Zfd 7sp1.
From consoleOne I can done the action "remote control" when the
workstation is already turn on.
I can do the "remote wakeup" but after I can't do the login. I can't see
the window novell login.
When the machine is up I have tried to do the action "remote control" but
I have this error:
1456 the remote management agent is unable to read information from
eDirectory.verify the workstation object is valid and the middle tier
server is up and running.
Into the event log I have seen this (under application):
Remote operator: cn=moni.ou=mio.o=mytree.t=tree
console address: CN=P30g-0510_1_1_1.ou=workstation.o=mytree.t=tree
invalid NDS authentication informatiom.
Please, Can sonmeone help me?
thanks for all and excuse me for my poor english I'm italian.
Regards
MonicaI have found my problem:
On my server there isn't SLP configured.
Now my problem became how to configure SLP !!!
thanks for all
Regards
Monica -
Read data from multiple sheets
Hi,
Can anyone tell me how to read data from multiple excel sheets?
Thanks.Hi,
go through this link this may help u.
https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/readmultiplesheetsofanExcelfileintoSAPthroughABAP&focusedCommentId=92930268
Thanks
Edited by: tarangini katta on Apr 23, 2009 2:34 PM -
Get information from multiple lists
Hi,
Environment: - SharePoint 2013
Question :- My client needs a get information from multiple list from the same site to be displayed on the page,
they would need a dropdown list with the user names , and once a user is selected all the tasks and calendar entries of the user must be filtered and displayed.
Please suggest how this can be achieved.
Satyam.Hi,
According to your post, my understanding is that you wanted to get information from multiple lists once a user was selected.
There is no out of the box way to accomplish this with SharePoint.
As a workaround, I recommend to create a list to store the user names. Then you can create relationships between lists using the browser UI. Once you select the user name in the parent list, the associated items will be displayed in the child lists.
Here are two great articles for you to take a look at:
http://office.microsoft.com/en-in/sharepoint-server-help/create-list-relationships-by-using-unique-and-lookup-columns-HA101729901.aspx#_Toc270607416
http://msdn.microsoft.com/en-us/library/ff394632.aspx
Best Regards,
Linda Li
Linda Li
TechNet Community Support -
Best way to control and read data from multiple instruments?
Hello,
I'm building an application to test power supplies involving multiple pieces of equipment over a couple of different comm busses. The application will also send control instructions to some of the instruments, and read data from some of the instruments. The reading and control profiles will not run on the same schedule (variable length control steps, configurable read interval).
I was thinking of using a queued statemachine (producer/consumer) for the control profile and another to read the data, but I got concerned that there would be collisions between sending control commands and read commands to the same machine. Is there a suggested design pattern for implementing something like this?
Timing of the commands isn't critical down to the milisecond, but I need to collect reasonably accurate timestamps when the data is read. The same is true for the control commands.
Here are the instruments I'm going to use, if the are control, read, or both, and the communication method
Instrument Funtions Comm Method
Power Supply Read data Communicates to PMBus Adapter
PMBus to USB Adapter Read data USB (Non-Visa)
Switch control relays USB (VISA)
Power Dist. Unit read data/control outlets SNMP (Ethernet)
Electronic Load read data/control load GPIB (VISA)
Thermal Chamber read data/control temp Ethernet (VISA)
Thanks,
SimonHello, there is a template in LV called "Continuous measurement and Logging".
It can give you some idea how to properly decouple the "GUI Event handler" top loop (where your Event structure is) from the DAQ and other loops.
You do not need to totally replicate the above example, but you can find there nice tricks which can help you at certain points.
The second loop from the top is the "UI message loop". It handles the commands coming from the top loop, and regarding to the local state machine and other possible conditions and states, it can command the other loops below.
During normal run, the different instrument loops just do the data reading, but if you send a control command from the top loop to a certain instrument loop (use a separate Queue for every instrument loops), that loop will Dequeue the control command, execute it, and goes back to data reading mode (in data reading mode the loop Dequeu itself with a "data read" command automatically). In this way the control and data read modes happen in serial not in parallel which you want to avoid (but I think some instrument drivers can even handle parallel access, it will not happen in really parallel...).
In every instrument loop when you read a value, attach a TimeStamp to it, and send this timestamp/value couple to the DataLogging loop via a Queue. You can use a cluster including 3 items: Source(instrument)/timestamp/value. All the instrument loops can use the same "Data logging" Queue. In the Datalogging while loop, after Dequeue-ing, you can Unbundle the cluster and save the timestamp and data-value into the required channel (different channel for every instrument) of a TDMS file.
(Important: NEVER use 2 Event structures in the same top level "main" VI!) -
How read information from other clients (other systems) of sap
Hi
I have a requiremt to read the roles assigned to a user id in production system to the developemet system.
So how i can get this production system information from development.
Could please please let me know how to call the remote function calls., How to go about this.
guys could you please help me out in this.
regards,
Steve.Hi
-A) Trx SM59:
Choose R/3 connection and search the production system connection.
If there isn'r basis t, u or your basis should create it.
-B) Create a program using a RFC function module to pick up the user roles:
CALL FUNCTION <FUNCTION> DESTINATION <DEST>.
Where <DEST> is the name of the production system connection defined in SM59.
The function <FUNCTION> has to be a RFC (Remote Function Call) like a BAPI.
MAx -
I'm trying to generate a random picture half the time from
one array and half the time from another array.
I've get as far as this and it doesn't work. Any help would
be useful
var ranArrays: Array = new Array ("bluePixs", "redPixs");
var bluePixs:Array = new Array ("bluePix1.swf",
"bluePix2.swf", "bluePix3.swf");
var redPixs:Array = new Array ("redPix1.swf", "redPix2.swf",
"redPix3.swf");
function randomBackground(){
var randomArray = random (ranArrays.length);
var randomNumber = random (randomArray.length);
_root.pix.loadMovie (randomArray[randomNumber]);
randomBackground();Hi,
Your SQL would be something like:
SELECT M.MONEY, DRINKS.NAME, DRINKS.PRICE, F1.PRODUCT, F1.PRICE, F2.PRODUCT, F2.PRICE, DESERT.PRODUCT, DESERT.PRICE
FROM MONEY M
CROSS JOIN DRINKS
CROSS JOIN F1
CROSS JOIN F2
CROSS JOIN DESERT
WHERE DRINKS.PRICE + F1.PRICE + F2.PRICE + DESERT.PRICE <= M.MONEYThat may return multiple results - as there may be a number of combinations less than your MONEY value. You can restrict this to return just one:
SELECT M.MONEY, DRINKS.NAME, DRINKS.PRICE, F1.PRODUCT, F1.PRICE, F2.PRODUCT, F2.PRICE, DESERT.PRODUCT, DESERT.PRICE
FROM MONEY M
CROSS JOIN DRINKS
CROSS JOIN F1
CROSS JOIN F2
CROSS JOIN DESERT
WHERE DRINKS.PRICE + F1.PRICE + F2.PRICE + DESERT.PRICE <= M.MONEY
AND ROWNUM = 1As you then only want to return a single string for display to the user, you will have to concatenate the items found into a single string:
SELECT DRINKS.NAME || ' ' || DRINKS.PRICE || ' ' || F1.PRODUCT || ' ' || F1.PRICE || ' ' || F2.PRODUCT || ' ' || F2.PRICE || ' ' || DESERT.PRODUCT || ' ' || DESERT.PRICE X
FROM MONEY M
CROSS JOIN DRINKS
CROSS JOIN F1
CROSS JOIN F2
CROSS JOIN DESERT
WHERE DRINKS.PRICE + F1.PRICE + F2.PRICE + DESERT.PRICE <= M.MONEY
AND ROWNUM = 1Obviously, you would want to replace the spaces (' ') with something more meaningful to the user
Andy -
How to read information from Exchange server ?
Hi,
I would like to retrieve some information from my exchange server (mailbox size for example). But i need also to retrieve those information for a lot of people. How can i do that ?
Thanks in advance.
IbouddhaPlease don't [url http://forum.java.sun.com/thread.jspa?threadID=699492&messageID=4059659#4059659]cross post.
-
Xml creation and copying information from multiple documents
Hi
I havent used java in at least a couple of years and im really rusty,
i have a xml document that specifies the layout of a word document it has a specific table that needs to be filled,
what i would like to do is design some code in java to
(1)access a word document
(2)copy some specific information from it and
(3) paste this information into the xml sheet at appropriate locations so that i can populate the table,
(4)i would also like for when there is more then one set of information for the table to be copied and pasted further down the word document so it can be populated, and this would continue till all elements from the origional document have been copied,
i hope tha makes sense
Its just i dont even know where to startAnother approach, where you only need a subset of Flow A from various other documents, is to tag the source documents so that the subsets are uniquely identified by Condition Codes.
In the documents that re-use the content, import the entire Flow A's from all the source documents, and switch off the conditions not of interest.
I do this with domestic vs. export manuals, where the export manual body imports the entire Flow A of the domestic, and turns off the condition code for domestic-only content.
Text inset caveats still apply.
CC count could get unwieldy. -
Read email from multiple machines
Hi, I have an intel macbook and imac and am looking for an efficient way to read email from both machines. I currently use POP and have to check both machines to be sure I don't miss any mail. Is there a simple way of making the imac an IMAP mail server and use the macbook to read only?
If you set up an IMAP email account, you can read, send and delete your mail on any mac, which has your IMAP account set up. Because all your mail data etc is stored on the server, not on your computer. Think of it as a form of "web mail" but accessible through your email program (Mail and Entourage)
Cheers -
Read files from multiple directories
Hy to all! I have a little problem with reading files from a hierarchy of directories,something like this: directory A contains: 4 filed and directory B, and also B contains 3 files and 2 directories and so on. i want to make a method that reads all the files from directory A (including all files from subdirectory). I know i have to use recursive programming, i need a method that will be use to do this. Can U help me to do this????? Thank you all.
Can U help me to do this?Sure. First, review basic File IO in Java: [http://java.sun.com/docs/books/tutorial/essential/io/file.html]
Second, have a look at the numerous examples available on the Internet: [http://www.google.com/search?q=java+traverse+directory]
Third, let us know if you run into any specific problems.
Good luck! -
Using ResultSet to read records from multiple tables
Im using a ResultSet object to read records from tables.
I have a database with 5 tables. Initially, I got it to work fine with one of those tables. What Im exactly trying to do is check if there is a record in a table which matches a given string, and if it does, display some text on some JTextFields. I got that to work fine with one table.
Problem is, how do I get it to work with all 5 tables at the same time?
i.e. instead of searching through one table, I want it to look through all 5 tables and look for the matches.
Any help greatly appreciated.
ThanksAfter the first interaction with the first table, I
used a stmt.getMoreResults() followed by instructions
to get data from the second table, and so on.
Worked fine.Sounds remarkably inefficient. (Potential for lots of network traffic.)
is this another way of doing it?Sounds more like a document search type of thing than a database query. What about Lucene? Could it help here?
%
Maybe you are looking for
-
Export to excel apex 4.0
Hi, Apex with 4.0 can't export my reports to excel? only appears a blank worksheet or just ";". Does anyone know how to solve this? in the old version case not problem. sorry for my english. Thanks Rafael
-
Hello, when I boot my PC, on some days several minutes after the boot I get this error, even when I do nothing! I there a way to detect which application is involved in this error? Or which runtime library? I can see that I have this libraries: Micro
-
Hot back up and archive mode with RMAN
Just diving back into back up world... I know I can do a hot back up of the Database with no archivelog option not using RMAN. Just wonder if I can do it with RMAN with no Archivelog option? TIA
-
In the Batch menu I'd like to save "Batch PreSets", so I can save correct Action Set and also save File Naming options.Or just all options in the Batch dialog. It's a pain to set all the file naming parameters every time I change Action Set.
-
Trying to RDP to XP PC from Mac
Okay, I have read other posts regarding this and cannot find a solution. I am trying to use the Remote Desktop for MAC to connect to my XP PC from my MacBook Pro. This works from within my network but not when I am outside with my MBpro. I know there