w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Error copying and pasting data from a file to another
Sorry to bump this question, but I really like question that are marked as answered. JoachimPileborg answer seems to have worked for you: Also, instead of seeking and checking sizes and allocating memory, why not just do e.g. data_out << data_in.rdbuf();? This will copy the whole input file to the output. – Joachim Pileborg Jul 29 at 17:26 A reference http://www.cplusplus.com/reference/ios/ios/rdbuf/ and an example: #include <fstream> #include <string> #include <vector> int main(int argc, char** argv) { typedef std::vector<std::string> Filenames; Filenames vecFilenames; // Populate the list of file names vecFilenames.push_back("Text1.txt"); vecFilenames.push_back("Text2.txt"); vecFilenames.push_back("Text3.txt"); // Merge the fil

Categories : C++

Copying data on assets folder to data folder of application throws no such file or directory error
/*I m using this code for copy data from assets folder just try it */ public class DataBaseHelper extends SQLiteOpenHelper{ private static String DB_PATH = "/data/data/com.astrobix.numerodaily/databases/"; private static String DB_NAME = "Astrobix"; private static final String tag = "DatabaseHelperClass"; public static SQLiteDatabase myDataBase; public final Context myContext; public static String Table_Name="Prediction"; public static final String COL_ID="ID"; public static final String COL_HEAD="HEAD"; public static final String COL_VALUE="VALUE"; private static final String TABLE_QUESTIONS ="Prediction"; private static final String Create_Table="create table if not exists " +Table_Name +"("

Categories : Java

How to optimize vlookup for high search count ? (alternatives to VLOOKUP)
I considered the following alternatives: VLOOKUP array-formula MATCH / INDEX VBA (using a dictionary) The compared performance is: VLOOKUP simple formula : ~10 minutes VLOOKUP array-formula : ~10 minutes (1:1 performance index) MATCH / INDEX : ~2 minutes (5:1 performance index) VBA (using a dictionary) : ~6 seconds (100:1 performance index) Using the same reference sheet 1) Lookup sheet: (vlookup array formula version) A B 1 2 key51359 {=VLOOKUP(A2:A10001;sheet1!$A$2:$B$100001;2;FALSE)} 3 key41232 formula in B2 4 key10102 ... extends to ... ... ... 99999 key4153 ... cell B100001 100000 key12818 ... (select whole range, and press 100001 key35032 ... CTRL+SHIFT+ENTER to make it a

Categories : Performance

Excel VBA Vlookup - Unable to Get the Vlookup Property
That can mean any number of things. It may simply mean your Data(i, 4) value is not found in LookupRange. Run-time error '1004': Unable to get the VLookup property of the WorksheetFunction class is equivilent to getting #N/A From =vlookup("A",A1:B3,2,false) Set a breakpoint on the line test(i) = Application.WorksheetFunction.VLookup(Data(i, 4), LookupRange, 3, 0) and set a watch on Data(i, 4) as well as a watch on i. See if the value in Data(i, 4) exists in your lookup range. See if i is greater than 1, if it has run some iterations of the loop correctly. As a side note your code wont run anyway since Test is an empty variant not an array. You need a line like ReDim Test(LBound(Data, 1) To UBound(Data, 1)) before the for loop for it to work. Read up on error handling here. You

Categories : Excel

How to error handle 1004 Error with WorksheetFunction.VLookup?
There is a way to skip the errors inside the code and go on with the loop anyway, hope it helps: Sub new1() Dim wsFunc As WorksheetFunction: Set wsFunc = Application.WorksheetFunction Dim ws As Worksheet: Set ws = Sheets(1) Dim rngLook As Range: Set rngLook = ws.Range("A:M") currName = "Example" On Error Resume Next ''if error, the code will go on anyway cellNum = wsFunc.VLookup(currName, rngLook, 13, 0) If Err.Number <> 0 Then ''error appeared MsgBox "currName not found" ''optional, no need to do anything End If On Error GoTo 0 ''no error, coming back to default conditions End Sub

Categories : Excel

Excel VLOOKUP N/A error
There's nothing wrong with the formula. The problem is that the value in A2 is text and treated as text when comparing to the number in F3. If you can't change your values in column A, then you can use this array formula: =SUM((F3=VALUE(A2:A3))*(C2:C3)) Enter with CTRL+SHIFT+ENTER This will convert the values in A2:A3 as numbers for the comparison against F3.

Categories : Excel

Run-time error ‘1004’ – for VLOOKUP
It appears the problem was with the syntax of VLOOKUP, which should be: VLOOKUP(lookup_value,table_array,col_index_num,range_lookup) in particular with the construction of the col_index_num parameter. Hence …:$I," & PosEmailD & ",FA... rather than ` …:$I,(,""" & PosEmailD & """ ),FA… seems to have worked. (Two pairs of double quotes, one pair of parentheses and a comma surplus).

Categories : Excel

Vlookup translation error in multiple sheets
You're using VLOOKUP wrong. The tooltip for VLOOKUP shows that the brackets should be ("lookup_value", "table_array", "col_index_num", "[range_lookup]"). So it will attempt to match your first variable, the lookup_value, to the first instance found in the first column of your second variable, the table_array. It then returns the value that is in the cell displaced by the col_index_num-1 (ie, to return the Q1 value you would use a col_index_num of 2). The final part, [range_lookup] is optional and it allows fuzzy matching of the value you use which is normally not what you want. Unfortunately this defaults to TRUE (fuzzy matching) and you nearly always want to set this to FALSE. In your example in the OP you attempt to add 1 to the value found in B1 which is a string. Obviously you can't

Categories : Excel

Excel - Error with vlookup across multiple workbooks
When you are using that syntax to define your ranges on the "Income" sheet, you need to specify the sheet for both the .Range and the (Cells(x,y)). You should also declare your variables. It can get ridiculous typing the fully qualified sheet name each time, so you should also declare a worksheet variable. Try this: Dim ws As Worksheet Dim j As Integer Dim i As Integer Set ws = ThisWorkbook.Sheets("Income") j = 3 For i = 1 To 46 ws.Range(ws.Cells(6, j), ws.Cells(51, j)).Formula = _ "=VLOOKUP($B6,[" & ws.Cells(5, i + 2).Value & ".xlsx]2 Intercompany markup!$A$1:$E$70,4,FALSE)" j = j + 1 Next i

Categories : Excel

2-Way Table Look Up in Excel Using VLOOKUP and MATCH Returning Error
Credit to @barryhoudini and @DaveSexton for the solution... I'm just documenting it officially. First off, the error I was receiving was due to the formatting of the source cell. So, per Barry's suggestion, I concatenated a "" to the end of my cell reference, which formatted the source cell as text, allowing the function to work. New code: =VLOOKUP(A97,A4:L10,MATCH(B96&"",A4:L4,0),FALSE) Second, per Dave's suggestion, I abandoned the VLOOKUP/MATCH approach in favor of the INDEX/MATCH/MATCH approach. E.G: =INDEX(A1:E14, MATCH(H2,A1:A14,0), MATCH(H3,A1:E1,0)) Thanks both for your help.

Categories : Excel

Vlookup error message when comparing 2 opened workbooks
You need to set the CPTRange's External attribute of the Address property to true. I would also use the Evaluate method for this: myResult = Evaluate("VLookup(""" & lookValue & """," & CPTRange.Address(External:=True) & ",2,False)")

Categories : Excel

Want to fetch some data from an excel sheet to another using VLookup and macro
Below is the formula. It will only work if both the workbook are opened in same instance. =VLOOKUP(A2,[Book1]Sheet1!A$1:B$3,2,0) If multiple instance of excel is running then task manager would show more than one image name as EXCEL.EXE in task manager processes window.

Categories : Excel

Error Copying from Assest Folder to my Current Database path..Input Stream Error
try this one public final static String APP_PATH_SD_CARD = "/database"; private static final String DATABASE_NAME = "photodb.db"; private boolean checkDataBase(){ boolean checkdb = false; try{ String myPath = context.getFilesDir().getAbsolutePath().replace("files", "databases")+File.separator + DATABASE_NAME; File dbfile = new File(myPath); checkdb = dbfile.exists(); } catch(SQLiteException e){ System.out.println("Database doesn't exist"); } return checkdb; }

Categories : Android

Excel is copying all data even if the Autofilter criteria matches no data entry
I would check if the filter produced any results/rows by comparing the number of rows in the table to the number of rows in the filtered table. 'assuming the table starts from A1, MsgBox Range("A1").CurrentRegion.Rows.Count 'confirms the number of rows in the table. 'After trying AutoFilter, MsgBox ActiveSheet.AutoFilter.Range.Columns(1).SpecialCells(xlCellTypeVisible).Count 'confirms the number of filtered rows. Store these two values in variables and compare them, or just check if the second value is 1 (the header row). If it is one, don't attempt the Copy.

Categories : Xml

Loss of data warning when copying to a data structure of smaller type
You can put #pragma to suppress the specific warning. > #pragma warning(push) > #pragma warning(disable: 4244) // possible loss of data > #include <algorithm> > #pragma warning(pop) This is of course compiler specific.

Categories : C++

SqlBulkCopy not copying any data
It looks like you're never committing the transaction. You need to store a reference to the transaction that you started, and commit it: var transaction = sqlConn.BeginTransaction(); SqlBulkCopy bulkCopy = new SqlBulkCopy( sqlConn, SqlBulkCopyOptions.TableLock, transaction ); and then transaction.Commit(); after the call to execute the bulk copy and before you close the connection.

Categories : C#

Copying data from one table in SQL
This is your query. The subquery is returning more than one row: UPDATE CHARTER SET CHAR_TOT_CHG = (SELECT MOD_WAIT_CHG FROM MODEL JOIN AIRCRAFT USING(MOD_CODE) JOIN CHARTER USING(AC_NUMBER) ); You have to decide how you want to convert this to one row. First possibility is that the subquery is wrong (because it is returning all the rows from the three tables). If you really don't mean to have a different copy of the charter in the subquery, then make it a correlated subquery so you are no returning all rows in all the tables: UPDATE CHARTER SET CHAR_TOT_CHG = (SELECT MOD_WAIT_CHG FROM MOD

Categories : SQL

Copying strided data in C++
Is there any way to efficiently perform strided memory copy in C++ performing at least as a standard for loop? Edit 2: There is no function for strided copying in the C++ libraries. Since strided copying is not as popular a memory copying, chip manufacturers nor language designs have specialized support for strided copying. Assuming a standard for loop, you may be able to gain some performance by using Loop Unrolling. Some compilers have options to unroll loops; it's not a "standard" option. Given a standard for loop: #define RESULT_SIZE 72 #define SIZE_A 48 #define SIZE_B 24 unsigned int A[SIZE_A]; unsigned int B[SIZE_B]; unsigned int result[RESULT_SIZE]; unsigned int index_a = 0; unsigned int index_b = 0; unsigned int index_result = 0; for (index_result = 0; index_result &l

Categories : C++

Syntax Error Copying CSV to Postgres
The delimiter passed to COPY is ',' but looking at the faulty line, there's no comma in it. It looks like the delimiter is a tab character instead. Try instead: COPY "Mobility Survey2" FROM 'C:\Users\Public\2011-2.csv' WITH CSV HEADER DELIMITER E' '; As for the HEADER keyword, it's needed if the first line of the data file consists of the column names, otherwise it should be removed.

Categories : Postgresql

Copying Worksheets in VBA Copy Error
Yes, I have exactly the same problem in some code that I use, though it's never been pressing enough for me to do what is (apparently) necessary for me to fix it. The issue is described in this knowledgebase article. The article suggests that: To resolve this problem, save and close the workbook periodically while the copy process is occurring I note that you said that you are "saving and reopening the workbook when copying" but I assume that you're doing that before you run the code since I don't see any indication of it being done during the loop. One way of doing it inside the loop itself would be: Implement error handling by having an On Error Goto line early in the procedure; then Putting an Exit Function ErrorHandler: block at the bottom. Inside the error handler i

Categories : Vb.Net

copying folder to another path getting error
You can't create a folder and subfolder at the same time, the parent folder must exists before you can create the sub-folder. You put a forward slash (/) in the folder name instead of a backslash () in the strFolder path. (Typo?!) Hope that helps

Categories : Vbscript

C# copying distinct data from 1 datatable to another
You can group the items on the given columns and then grab the first (or last, or whichever) row from each group. secondTable = firstTable.AsEnumerable() .GroupBy(row => new { Key = row.Field<string>("Key"), Country = row.Field<string>("Country"), }) .Select(group => group.First()) .CopyToDataTable();

Categories : C#

need help copying data from asset folder
Your database must have a table called android_metadata. If you create your database programmatically, this special table will be generated automatically. This table should have two columns: rowid your primary key (integer) locale = en_US as text (or an other locale code). Here is a tutorial that solves your problem

Categories : Android

copying raw mysql data from on server to another
You can't hot-copy these files and expect them to magically work. You can use the innobackupex tool to create a stable snapshot. This will take care of adjusting the files as necessary to be consistent and complete.

Categories : Mysql

copying skb->data to multiple descriptors
In the function **rtl8139_start_xmit() ** of 8139 driver, it first check whether the length of skb->data is larger than TX_BUF_SIZE, which is the MAX_ETH_FRAME_SIZE. If it is larger than TX_BUF_SIZE, the driver drops the packet. if (likely(len < TX_BUF_SIZE)) { if (len < ETH_ZLEN) memset(tp->tx_buf[entry], 0, ETH_ZLEN); skb_copy_and_csum_dev(skb, tp->tx_buf[entry]); dev_kfree_skb(skb); } else { dev_kfree_skb(skb); tp->stats.tx_dropped++; return 0; } Generally, if the packet you try to send is larger than MAX_ETH_FRAME_SIZE, the IP layer of the protocol stack will fragment the packet, like you said "break XXX up". But when packet goes down to driver, it won't be broken up any more. More infomation: IP fragmentation on wikipedia

Categories : Linux

excel Worksheet_SelectionChange - copying data
it looks to me like you could replace all three routines with Private Sub Worksheet_SelectionChange(ByVal Target As Range) On Error GoTo ExitSubCorrectly 'turn off multiple recurring changes Application.EnableEvents = False 'do not allow range selection If Target.Cells.Count > 1 Then GoTo ExitSubCorrectly 'only allow selection within our range Set myRange = Range("B8:B24") If Not Application.Intersect(Target, myRange) Is Nothing Then ' At least one cell of Target is within the range myRange. ' Carry out some action. With Cells(Target.Row, Target.Column) Select Case .Style Case "Normal" .Style = "Accent1" .Offset(0, 1).Resize(, 3).Value = Worksheets("Sheet2").Cells(getRow, getCol).Offset(0,

Categories : Excel

Copying of data skipping blanks
highlight, press F5, click "special" select either "constants" or "formulas" depending on if it is hardcoded or formulaic data, then hit ok. this will leave all blank cells out of the selection, then copy paste as normal to the other workbook. if your doing it in vba this is all available in the object model as Selection.SpecialCells(xlCellTypeConstants, 23).Select Selection.SpecialCells(xlCellTypeFormulas, 23).Select UPDATE: I forgot about the bug (design flaw?) in excel that makes it error out when you try to copy a non-rectangular selection. See here (the article is older but appears to apply to 2013): http://support.microsoft.com/kb/100715 I believe there are macros available on the internet to deal with this problem, one of them is here http://www.extendoffice.com/documents/exce

Categories : Excel

copying database file from /assets to /data/data folder in file explorer - Android
Try using below code to copy database from assets to data/data/package directory package com.example.myapp; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; public class DataBaseHelper1 extends SQLiteOpenHelper{ private static String DB_PATH = "/data/data/com.example.myapp/databases/"; private static String DB_NAME = "myDB.sqlite"; private SQLiteDatabase myDataBase; private final Context myContext; public DataBa

Categories : Android

VBA excel code for copying sheets error
In your code you used "x" which is a string. If you want to use x as an index you need to use it without the quotation marks. Edit Using x as a sheet index: ActiveWorkbook.ActiveSheet.Copy Before:=ActiveWorkbook.Sheets(x) Using the name of a sheet to get its index: ActiveWorkbook.ActiveSheet.Copy Before:=ActiveWorkbook.Sheets(Sheets("Sheet1").Index) Using the number of sheets as the index: ActiveWorkbook.ActiveSheet.Copy Before:=ActiveWorkbook.Sheets(Sheets.Count) If you are trying to change the name of the sheet after you copy it you need to add code that does this. Example: ActiveWorkbook.ActiveSheet.Copy Before:=ActiveWorkbook.Sheets(Sheets.Count) ActiveSheet.Name = x

Categories : Excel

Run-time error '9' when copying worksheet to another workbook
The Workbooks collection refers to all currently open workbooks. If the workbook isn't open you will need to do this first. Set CopyFromBook = Workbooks.Open("C:Some LocationAllBugs.xlsx")

Categories : Excel

Copying Data from one table into another and simultaneously add another column
You didn't mention your database. Here is an example for MS SQL SELECT Col1,Col2,Col3,'text field' as NEW_COL INTO NEW_TBL FROM OLD_TBL; This query will create new table NEW_TBL and add all data from OLD_TBL with additional text field NEW_COL. The type of the new field depends on constant type for example if you need INT type you can use 0 instead of 'text field' constant. SQLFiddle demo

Categories : SQL

Excel VBA - Issue copying data to the same Worksheet
When you insert each new query table from the web, it is inserting columns each time. That's why it kept pushing each added table over to the right. You can use RefreshStyle=xlOverwriteCells to keep overwriting the table on a dummy sheet (can even be hidden if needed). In between each overwrite, copy and paste the data from the dummy sheet and put it on your desired output sheet. I've adapted your code above to do just that. It uses Sheet3 as the dummy sheet. Sub copyFightStats() Dim wsO As Worksheet Set wsO = ActiveSheet Dim ws2 As Worksheet: Set ws2 = Worksheets("Sheet2") Dim ws3 As Worksheet: Set ws3 = Worksheets("Sheet3") Dim iTableRow As Integer Dim iTableCol As Integer Dim iCopyRow As Integer Dim iURLRow As Integer Dim sURL As String Dim xlURLRange As Range Dim xlCell As Range

Categories : Excel

How do I concatenate pandas DataFrames without copying the data?
You can't (at least easily). When you call concat, ultimately np.concatenate gets called. See this answer explaining why you can't concatenate arrays without copying. The short of it is that the arrays are not guaranteed to be contiguous in memory. Here's a simple example a = rand(2, 10) x, y = a z = vstack((x, y)) print 'x.base is a and y.base is a ==', x.base is a and y.base is a print 'x.base is z or y.base is z ==', x.base is z or y.base is z Output: x.base is a and y.base is a == True x.base is z or y.base is z == False Even though x and y share the same base, namely a, concatenate (and thus vstack) cannot assume that they do since one often wants to concatenate arbitrarily strided arrays. You easily generate two arrays with different strides sharing the same memory like so

Categories : Python

VBA Blank Cells offsetting data when copying
"I think i have some of the syntax wrong" is not helpful. You need to tell us the error message you receive and the line that this error refers to. But this is probably wrong: WS.Range(.Cells(10, 7)) unless .Cells(10, 7) happens to contain a cell address. If you want further assistance you need to ask a specific question. Added If Cells(10, 7) = "" Then I assume this should be looking in the "Macro Test Sheet" so this should also be preceded by a dot, otherwise it is looking in whatever is currently the ActiveSheet.

Categories : Vba

Copying data from a sharepoint site into Excel using VBA
You may want to look at JavaScript and make it to work with all browsers. Look at this library https://github.com/stephen-hardy/xlsx.js and the related site https://github.com/stephen-hardy/xlsx.js

Categories : Excel

Excel macro not copying the data into the right cells
Here you have a simple code copying (and transposing) a range between two sheets. Dim fromRange As Range, toRange As Range Set fromRange = Sheets("Sheet1").Range("A1:A3") Set toRange = Sheets("Sheet2").Range("A1") fromRange.Copy toRange.PasteSpecial Paste:=xlPasteValues, Transpose:=True You can call this code recursively (while iterating through all the columns in the original range). Bear in mind that ranges can also be defined through Cell and thus: Set fromRange = Sheets("Sheet1").Range(Sheets("Sheet1").Cells(1, 1), Sheets("Sheet1").Cells(3, 1)) This code is identical to the Set fromRange above, although this one might be more helpful when being in a loop. For example: Dim iniRow As Integer, maxRow As Integer, col As Integer, maxCol As Integer iniRow = 1 maxRow = 20 col = 0 ma

Categories : Excel

Searching for matching cells and copying row data
This should get you started. Was the statement within the If block a typo? I think you might have meant to copy from one workbook/worksheet to the other (not from the same one)? Sub Firm_Number_Transfer() Dim i As Integer Dim x As Integer Dim row As Integer Dim oldRow As Integer Dim found As Boolean Dim xlBook As Workbook, xlBook2 As Workbook Dim xlSheet As Worksheet, xlSheet2 As Worksheet Dim rng As Range, cell As Range, rng2 As Range, cell2 As Range xlBook2 = Workbooks("PM Firms - Step 1 - REVEIWED") xlSheet2 = xlBook2.Worksheets("Sheet1") Set rng2 = xlSheet2.Range("B2:B4843") xlBook = Workbooks("PM Firm Contacts - Step 2 - REVIEWED") xlSheet = xlBook.Worksheets("Sheet2") Set rng = xlSheet.Range("B

Categories : Excel

HDFS Error while copying the file : Could only be replicated to 0 nodes, instead of 1
Some times the data node may be starting up slowly and this may cause the above issue.. keep some wait time after the start of dfs and mapred demons. bin/hadoop namenode -format bin/start-dfs.sh wait for some 5 min(data node will be up in the time) bin/start-mapred.sh

Categories : Hadoop

R programming: avoid copying the whole data frame when amending?
You should use data.table for this, it is done for exactly this purpose. And read this reference post R) dt<-data.table(x=1:10,y=1:10) R) .Internal(inspect(dt)) @0x000000000dce56c0 19 VECSXP g0c7 [OBJ,NAM(1),ATT] (len=2, tl=100) @0x000000000ebc4100 13 INTSXP g0c4 [NAM(2)] (len=10, tl=0) 1,2,3,4,5,... @0x000000000ebc41b0 13 INTSXP g0c4 [NAM(2)] (len=10, tl=0) 1,2,3,4,5,... ATTRIB: @0x000000000e6c2d00 02 LISTSXP g0c0 [] TAG: @0x00000000003b0088 01 SYMSXP g1c0 [MARK,LCK,gp=0x4000] "names" (has value) @0x000000000cc99fd0 16 STRSXP g0c7 [NAM(2)] (len=2, tl=100) @0x00000000003ddbb8 09 CHARSXP g1c1 [MARK,gp=0x61] [ASCII] [cached] "x" @0x000000000734f4d8 09 CHARSXP g1c1 [MARK,gp=0x61] [ASCII] [cached] "y" TAG: @0x00000000003b1d98 01 SYMSXP g1c0 [MARK,LCK,gp=0x400

Categories : R

Copying specific condition meeting data from one worksheet to another
Step 1: In your 'Worksheet 1' you could include one more column as 'Count' and do the following; Drag the formula down Step 2: In 'Worksheet 2' you could do this; ie For each column; 'Name' ="Personal"&ROW(P1) 'Cheque No' =IFERROR(VLOOKUP(A2,Sheet1!$B$2:$F$9,2,FALSE),"") 'Date' =IFERROR(VLOOKUP(A2,Sheet1!$B$2:$F$9,3,FALSE),"") 'Amount' =IFERROR(VLOOKUP(A2,Sheet1!$B$2:$F$9,4,FALSE),"") 'Currency' =IFERROR(VLOOKUP(A2,Sheet1!$B$2:$F$9,5,FALSE),"") Drag the formulae down. Step 3: In 'Worksheet 3' do this; Under the 'name' column replace 'personal' in the formula to 'business'. The rest would be the same. Make sure to drag the formulae down to get your results This is how my 'personal' (Worksheet 2) and 'business' (Worksheet 3) worksheets look like; Sorry about the

Categories : Excel



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.