Id
int64
34.6M
60.5M
Title
stringlengths
15
150
Body
stringlengths
33
36.7k
Tags
stringlengths
3
112
CreationDate
stringdate
2016-01-01 00:21:59
2020-02-29 17:55:56
Y
stringclasses
3 values
39,111,122
Remove background of an image in imageview in xcode.
How can i edit the background of an image (not imageview) and set it to be transparent. I had search a lot but can find nothing. Any help??
<swift><imageview>
2016-08-23 21:41:07
LQ_EDIT
39,112,457
Same STL files with different compilers
<p>There are two binary files obtained from the same source file: one compiled with clang++-3.6 and the other one with g++-4.8. In a call to a function from the stl (std::unique, in particular) gdb brings me to the same file: /usr/include/c++/4.8/bits/stl_algo.h.</p> <p>I expected that the implementations would be different for each compiler though. Do clang and gcc share parts of their C++ implementations?</p>
<c++><stl>
2016-08-24 00:02:10
LQ_CLOSE
39,112,805
Removing multiple of 3 index from list
I want to remove multiple of 3 indexes from list. For Example: list1 = list(['a','b','c','d','e','f','g','h','i','j']) After removing indexes which are multiple of three the list will be: ['a','b','d','e','g','h','j'] How can I achieve this?
<python><list>
2016-08-24 00:51:18
LQ_EDIT
39,112,868
Make mssql query
help me please with query: **select * from sc84 as nom join sc319 as p on p.PARENTEXT = nom.id join sc219 as pt on p.sp327 = pt.id join _1SCONST as c on c.objid=p.id** As a result approximately such table Car / price_base / 08-08-2016:13-40 / 100 / Car / price_base / 08-08-2016:14-40 / 150 / Car / price_base / 08-09-2016:13-40 / 190 / Car / price_super / 08-09-2016:18-40 / 210 / Car / price_super / 08-10-2016:13-40 / 290 / That is goods, types of the price of date and their value. Prompt please how to receive the last (the actual price for each type of the price and each goods) tried options with group but there is obviously not enough skill. nom.id - PK SKU pt.id - PK price type p.id -PK price p.parentext - parent price (sku) p.sp327 - FK to price type date = date column
<sql><sql-server><sql-server-2008><pymssql>
2016-08-24 01:00:25
LQ_EDIT
39,113,218
SQL:How return regularity N rows in Oracle?
I want to return follow result: num random month char 1 33 Jan a 2 76 Feb b 3 784 Mar c 4 53 Apr d 5 34 May e Now [I only know how return num and random row][1]. SELECT LEVEL num, dbms_random.RANDOM random FROM DUAL CONNECT BY LEVEL <= 5 [1]: http://stackoverflow.com/questions/1973676/sql-query-to-return-n-rows-from-dual
<sql><oracle>
2016-08-24 01:50:18
LQ_EDIT
39,114,038
c++ Realloc() doest not working
i have this code Perro **obj = NULL; obj = (Perro**)malloc(10*sizeof(Perro*)); for (int i = 0; i < 10; i++) { obj[i] = new Perrito((char*)"d",i); } realloc(obj,12*sizeof(Perro*)); for (int i = 9; i < 12; i++) { obj[i] = new Perrito((char*)"d",i); } for (int i = 0; i < 12; i++) { Perrito *p; p = (Perrito*)obj[i]; cout << p->getEdad() << endl; } why when i'm reading my object a see a memori dumpd ( segmentation fault ) when i comend the line of realloc and reduce the last for length item it works normaly but a need to ude realloc for increase my polifirmist object length please help mee thanks!
<c++>
2016-08-24 03:40:36
LQ_EDIT
39,115,281
Java: Converting 12 hour time to 24 hour time
<p>Is there a simple function to convert a time that's like this: 10:30pm 17 Aug 2016 NZST to 2016-8-17-2230</p>
<java>
2016-08-24 05:45:50
LQ_CLOSE
39,115,374
is possible to use finish() in to return in previous activities like C>B>A?
Technically i have a MainActivity A then then i'll go to next activity which is activity B then there is the other activity which is Activity C but when i use finish, the activity B and C returns to each other instead backing to the main activity
<java><android>
2016-08-24 05:52:18
LQ_EDIT
39,115,701
Show embed youtube video from database to web using php
<p>i want to display embed video from database and display it to web browser but the syntax eror "Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\iklan2\vid2.php on line 3"</p> <p><a href="http://i.stack.imgur.com/OPnSf.png" rel="nofollow">this is the eror</a></p>
<php>
2016-08-24 06:16:29
LQ_CLOSE
39,115,949
jqury on table div
I have table as follows: <table class="mytable"> <div> <tr> <th>h1</th> <th>h1-1</th> <th>h1-2</th> </tr> <tr> <th>h2</th> <th>h2-2</th> <th>h2-3</th> </tr> </div> <div> <tr> <td>1</td> <td>1</td> <td>1</td> </tr> <tr> <td>2</td> <td>2</td> <td>2</td> </tr> </div> </table> Now i want two jquery as follows: 1) jquery to get all div present in table. 2) jquery to get first tr's td data in every div. it may be in loop. Please help me any body i am new to jquery.
<javascript><jquery>
2016-08-24 06:31:10
LQ_EDIT
39,116,366
Convert an int** array into a char** array of a different size / composition
<p>I'm trying to convert an int** array that looks like the below, into a char** array that is made up from the number of rows and is comma seperated. </p> <pre><code>1 2 3 4 5 6 7 8 9 3 2 1 </code></pre> <p>An example of what I would like the char** array to be represented as would be something like [['1','1','2','3','4'], ['2','5','6','7','8'] , ['3','9','3','2','1']] where every 0'th index is represented as the row number. I'm not really sure how I would be able to achieve this, is there any known methods that are good for converting an int** into something like this? Thanks.</p>
<c><arrays><csv><multidimensional-array><char>
2016-08-24 06:56:36
LQ_CLOSE
39,116,913
Rounded Corner Crop Image Using Jquery
<p>Does anyone knows a library to crop an image to achieve a rounded corner output? I've found this <a href="https://foliotek.github.io/Croppie/" rel="nofollow">https://foliotek.github.io/Croppie/</a> but it only crops the image to cicrle. I want to crop the image to this shape: <a href="http://harboarts.com/shirtdesigner/jpg_design_exports/square_rounded_corners%20_vector-graphic_1331986667453.jpg" rel="nofollow">http://harboarts.com/shirtdesigner/jpg_design_exports/square_rounded_corners%20_vector-graphic_1331986667453.jpg</a></p>
<javascript><jquery><crop>
2016-08-24 07:24:53
LQ_CLOSE
39,118,456
cannot resolve the symbol R
Not a duplicate of http://stackoverflow.com/questions/31071568/cannot-resolve-the-symbol-r-in-android-studio and related questions to above. i am trying to use the location services in my app. I am following the tutorials http://www.androidwarriors.com/2015/10/fused-location-provider-in-android.html and also the google android developer guide on how to setup google apis. after changing gradle and manifest, i encounter the error that the symbol R can not be resolved. i added the following line to gradle app file compile 'com.google.android.gms:play-services:9.4.0' and this line to manifest <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> i tried cleaning project restarting android studio sync project with gradle re importing the packages among others to be tried i am not sure why is this apeparing and how to fix it.
<android><android-studio><gradle>
2016-08-24 08:42:10
LQ_EDIT
39,118,585
what is the difference between static SQL and dynamic SQL?
<p>What is the actual difference between static and dynamic sql? I'm not getting a clear picture about it. Is this just using the sql statements in inline queries and in stored procedures? Expecting a clear answer with example.</p>
<sql><sql-server>
2016-08-24 08:48:28
LQ_CLOSE
39,119,560
Angularjs add a viariable to an object in a jsonarray
I'm looking for a solution to add a viariable to an object in a jsonarray. my json file: [ { "BasketDetail_ID": "91", "Pos": "1", "BasketBasket_ID": "17", }, { "BasketDetail_ID": "92", "Pos": "2", "BasketBasket_ID": "17", }, { "BasketDetail_ID": "93", "Pos": "3", "BasketBasket_ID": "17", }, { "BasketDetail_ID": "94", "Pos": "4", "BasketBasket_ID": "17", }, { "BasketDetail_ID": "95", "Pos": "5", "BasketBasket_ID": "17", }, { "BasketDetail_ID": "96", "Pos": "6", "BasketBasket_ID": "17", }, { "BasketDetail_ID": "97", "Pos": "7", "BasketBasket_ID": "17", }, { "BasketDetail_ID": "98", "Pos": "8", "BasketBasket_ID": "17", } ] My objects do not have names. I tried to make a push for each object: var length = basketDetails.length; for (var i = 0; i < length; i++) { $scope.basketDetails[i].push({'detailTotalPrice': $scope.detailTotalPrice}); } Here I always get an error: $scope.basketDetails[i].add is not a function the updated json should look like: [ { "BasketDetail_ID": "91", "Pos": "1", "BasketBasket_ID": "17", "detailTotalPrice": "100", }, { "BasketDetail_ID": "92", "Pos": "2", "BasketBasket_ID": "17", "detailTotalPrice": "100", }, { "BasketDetail_ID": "93", "Pos": "3", "BasketBasket_ID": "17", "detailTotalPrice": "100", }, { "BasketDetail_ID": "94", "Pos": "4", "BasketBasket_ID": "17", "detailTotalPrice": "100", }, { "BasketDetail_ID": "95", "Pos": "5", "BasketBasket_ID": "17", "detailTotalPrice": "100", }, { "BasketDetail_ID": "96", "Pos": "6", "BasketBasket_ID": "17", "detailTotalPrice": "100", }, { "BasketDetail_ID": "97", "Pos": "7", "BasketBasket_ID": "17", "detailTotalPrice": "100", }, { "BasketDetail_ID": "98", "Pos": "8", "BasketBasket_ID": "17", "detailTotalPrice": "100", } ] have somebody an idea to fix this problem?
<javascript>
2016-08-24 09:35:20
LQ_EDIT
39,120,829
i have given a timer, to start from zero and end at 10th second and after 10th second timer should become 0
if (coinMag == true) { Timer += 1 * Time.deltaTime; if (Timer >= 10) { coinMag = false; Timer = 0; } } what i want is when the CoinMag is true the timer should start...i have intialized timer as public float Timer=0.0f; ..and after timer starts exactly after 10 seconds timer should be reinitialized to 0.
<c#><unity3d><timer>
2016-08-24 10:31:29
LQ_EDIT
39,121,489
save data to database asp.net mvc
this is the error message : (46,12) : error 2019: Member Mapping specified is not valid. The type 'Edm.String[Nullable=True,DefaultValue=,MaxLength=Max,Unicode=True,FixedLength=False]' of member 'SEJ_STARDATE' in type 'HotelSearch.APP_SEJOUR' is not compatible with 'SqlServer.date[Nullable=True,DefaultValue=,Precision=0]' of member 'SEJ_STARDATE' in type 'CodeFirstDatabaseSchema.APP_SEJOUR'. (47,12) : error 2019: Member Mapping specified is not valid. The type 'Edm.String[Nullable=True,DefaultValue=,MaxLength=Max,Unicode=True,FixedLength=False]' of member 'SEJ_ENDDATE' in type 'HotelSearch.APP_SEJOUR' is not compatible with 'SqlServer.date[Nullable=True,DefaultValue=,Precision=0]' of member 'SEJ_ENDDATE' in type 'CodeFirstDatabaseSchema.APP_SEJOUR'. (112,12) : error 2019: Member Mapping specified is not valid. The type 'Edm.String[Nullable=True,DefaultValue=,MaxLength=Max,Unicode=True,FixedLength=False]' of member 'PRIX_PRICE' in type 'HotelSearch.RFS_PRIX_R' is not compatible with 'SqlServer.date[Nullable=True,DefaultValue=,Precision=0]' of member 'PRIX_PRICE' in type 'CodeFirstDatabaseSchema.RFS_PRIX_R'. how can i fix it ?
<c#><asp.net><sql-server><entity-framework>
2016-08-24 11:00:46
LQ_EDIT
39,121,904
Oracle Database connectivity with java
<p>Connectivity code</p> <pre><code>username="system"; password="oracle11"; url="jdbc:oracle:thin:@localhost:1523:system"; Driver="oracle.jdbc.driver.OracleDriver"; Class.forName(this.Driver); this.con=DriverManager.getConnection(this.url,this.username,this.password); System.out.println("Connect"); </code></pre> <p>In the url "system" is globally connect to the oracle it access all the tables so no database security or sepration is there so how to differentiate it.I want to create diffrent database for diffrent projects how to make it in oracle and how to access with java </p>
<java><oracle><apache><tomcat><netbeans-7>
2016-08-24 11:19:34
LQ_CLOSE
39,121,973
C#: Modifying the list
<p>I'm having a table(date is in mm/dd/yyyy format): </p> <pre><code>FromID ToID FromDate ToDate S1 S2 1/1/2016 1/15/2016 S2 S3 2/1/2016 3/14/2016 S1 S2 1/5/2016 1/20/2016 S2 S3 1/25/2016 2/25/2016 S1 S2 1/21/2016 1/25/2016 </code></pre> <p>I need to combine the rows such that the overlapping dates of the repeating fromId and ToId. For eg, for this table, the output should be:</p> <pre><code>FromID ToID FromDate ToDate S1 S2 1/1/2016 1/25/2016 S2 S3 1/25/2016 3/14/2016 </code></pre> <p>I have tried the following C# code to do it but it won't work.</p> <pre><code> public class MergeLists { static void Main(String[] args) { List&lt;ItemDetails&gt; theTempList = new List&lt;ItemDetails&gt;(); List&lt;ItemDetails&gt; theOriList = new List&lt;ItemDetails&gt;(); DateTime minDate = new DateTime(2016, 1, 1); DateTime maxDate = new DateTime(2016, 1, 1); int count; theOriList.Add(new ItemDetails("S1","S2", new DateTime(2016,1,1), new DateTime(2016,1,15))); theOriList.Add(new ItemDetails("S2", "S3", new DateTime(2016, 2, 1), new DateTime(2016, 2, 14))); theOriList.Add(new ItemDetails("S1", "S2", new DateTime(2016, 1, 5), new DateTime(2016, 1, 20))); theOriList.Add(new ItemDetails("S2", "S3", new DateTime(2016, 1, 25), new DateTime(2016, 2, 25))); theOriList.Add(new ItemDetails("S1", "S2", new DateTime(2016, 1, 21), new DateTime(2016, 1, 25))); theOriList = theOriList.OrderBy(x =&gt; x.fromId).ThenBy(x=&gt; x.toId).ToList(); int addnew = 0; for (int i = 0; i &lt; theOriList.Count; i++) { for (int j = i + 1; j &lt; theOriList.Count; j++) { if ((theOriList[i].fromId == theOriList[j].fromId) &amp;&amp; (theOriList[i].toId == theOriList[j].toId)) { if ((theOriList[i].fromDate &lt;= theOriList[j].fromDate) &amp;&amp; (theOriList[j].fromDate &lt;= theOriList[i].toDate)) { if (theOriList[j].toDate &gt; theOriList[i].toDate) { maxDate = theOriList[j].toDate; minDate = theOriList[i].fromDate; } else if (theOriList[j].toDate &lt; theOriList[i].toDate) { maxDate = theOriList[i].toDate; minDate = theOriList[i].fromDate; } } else if (theOriList[i].fromDate &gt; theOriList[j].fromDate) { if (theOriList[i].toDate &lt;= theOriList[j].toDate) { maxDate = theOriList[j].toDate; minDate = theOriList[j].fromDate; } else if (theOriList[i].toDate &gt; theOriList[j].toDate) { maxDate = theOriList[i].toDate; minDate = theOriList[j].fromDate; } } else if ((theOriList[j].fromDate &gt; theOriList[i].toDate)) { //Add directly addnew = 1; } } } if (addnew != 1) { theTempList.Add(new ItemDetails(theOriList[i].fromId, theOriList[i].toId, minDate, maxDate)); } else if (addnew == 1) theTempList.Add(new ItemDetails(theOriList[i].fromId, theOriList[i].toId, theOriList[i].fromDate, theOriList[i].toDate)); } theTempList = theTempList.OrderBy(x =&gt; x.fromId).ThenBy(x =&gt; x.toId).ToList(); foreach (ItemDetails x in theTempList) { Console.WriteLine("FromId: " + x.fromId + "\tToId: " + x.toId + "\tFromDate:" + x.fromDate + "\tToDate:" + x.toDate); } Console.ReadKey(); } } </code></pre>
<c#>
2016-08-24 11:22:25
LQ_CLOSE
39,122,868
Passing through a function, but not getting the right value
I having trouble understanding what is happening. The value of second token is some random number instead of 1. Why does the value of second token not the value in the function? struct player { char name[20]; enum cell token; unsigned score; }; BOOLEAN init_player2(struct player *second, enum cell token) { token = 1; } int main() { struct player second; init_player2(&second, second.token); printf("The value of second token is: %d\n", second.token); return 0; }
<c>
2016-08-24 12:06:27
LQ_EDIT
39,124,214
Construct regular expression that matches numeric expressions like 5+65
<p>I'm looking for a way to construct regular expressions to match two integers with mathematical operation, like 6+36 85*52 </p>
<regex>
2016-08-24 13:07:14
LQ_CLOSE
39,124,372
Unreacable code @ Cell cell = cellIterator.next();
Help please. I am coding a program to format the contents of an excel file. Eclipse is saying that the code is unreachable and I don't understand why.Where did I go wrong? Thanks for the help. :) private String formatExcel(File excel) { this.statusLabel.setText("formatting..."); try { FileInputStream file = new FileInputStream(excel); try { this.workbook = WorkbookFactory.create(file); } catch (InvalidFormatException ex) { file.close(); } int excelType = 0; if ((this.workbook instanceof HSSFWorkbook)) { excelType = 1; } int sheetNum = 0; try { sheetNum = Integer.parseInt(this.sheetNumber.getText()); } catch (NumberFormatException e) { file.close(); } if ((sheetNum < 1) || (sheetNum > this.workbook.getNumberOfSheets())) { file.close(); return "Please input a valid sheet number."; } Sheet sheet = this.workbook.getSheetAt(sheetNum - 1); sheet.setZoom(17, 20); Iterator<Row> rowIterator = sheet.iterator(); int startRow = Integer.MAX_VALUE; Iterator<Cell> cellIterator; for (; rowIterator.hasNext(); cellIterator.hasNext()) { Row row = (Row)rowIterator.next(); cellIterator = row.cellIterator(); continue; Cell cell = (Cell)cellIterator.next(); switch (cell.getCellType()) { case 4: break; case 0: break; case 1: if (cell.getStringCellValue().trim().equalsIgnoreCase("Condition Code")) { startRow = cell.getRowIndex(); } if ((cell.getRowIndex() > startRow + 1) && (cell.getColumnIndex() > 0) && (cell.getColumnIndex() < 5)) { if (excelType == 0) { cell.setCellValue(formatCellXSSF( cell.getStringCellValue(), cell.getColumnIndex())); } else { cell.setCellValue(formatCellHSSF( cell.getStringCellValue(), cell.getColumnIndex())); } } if (!cell.getStringCellValue().trim().equalsIgnoreCase("<<Test Data>>")) { if (!cell.getStringCellValue().trim().equalsIgnoreCase("<<Screenshots>>")) { break; } } break; } } sheet.autoSizeColumn(5); file.close(); FileOutputStream out = new FileOutputStream(excel); this.workbook.write(out); out.close(); return ""; } catch (FileNotFoundException ex) { return "Error. File is open. Please close it first."; } catch (IOException ex) {} return "Cannot format file because it is open. Please close it first."; }
<java>
2016-08-24 13:13:59
LQ_EDIT
39,126,491
Get id for use as variable data in ajax call JQUERY
I cannot get the id from links calling the same ajax function. The 30+ links are generated dynamically, as follows:- <a href="javascript:void(0)" id="105">Item 105</a> <a href="javascript:void(0)" id="379">Item 379</a> <a href="javascript:void(0)" id="534">Item 534</a> etc This is my latest attempt, after much googling, including http://stackoverflow.com/questions/11687217/variable-data-in-ajax-call-jquery):- $(this).click(function(){ var $id = $(this).attr('id'); $.ajax({url: "somefile.asp", data: {sellerid: <%=sellerid%>, uid: <%=uid%>, itinid: $id}, success: function(result){ $("#content").html(result); }}); }); The ajax works fine (but with fixed result) for each link when I test with for example:- var $id = 379; Grateful for any help! Thanks
<javascript><jquery><ajax>
2016-08-24 14:44:42
LQ_EDIT
39,129,281
AWS EC2 launches, works, then doesnt
I can successfully create a new EC2 instance using an AMI. Briefly after launching, the EC2 is view-able through the browser and SSH. Consistently, if I try to view it 10 minutes after launch, the EC2 is completely inaccessible. This happens even with a static IP. What could be causing this? This is reproducible many times.
<amazon-web-services><amazon-ec2><bitnami>
2016-08-24 17:09:36
LQ_EDIT
39,129,980
Split the character vector into two parts
<p>Consider the following character vector of the length 1:</p> <pre><code>l &lt;- "http://www.idealo.de/preisvergleich/OffersOfProduct/4983410_-iphone-se-64gb-spacegrau-apple.html" </code></pre> <p>I desire to split it into two parts, so that the first part should be:</p> <pre><code>p1 &lt;- "http://www.idealo.de/preisvergleich/OffersOfProduct/4983410" </code></pre> <p>and the second one:</p> <pre><code>p2 &lt;- "_-iphone-se-64gb-spacegrau-apple.html" </code></pre> <p>Surely, one must use regexp to solve the problem. Please could you give me some insight where I can learn manipulation with regular expressions easily. For any help I will be sincerely thankful.</p>
<regex><r><split>
2016-08-24 17:52:58
LQ_CLOSE
39,130,886
Grails security without spring
<p>Can someone provide code for registering account,loggin in and out from an account but without spring?</p>
<grails>
2016-08-24 18:46:06
LQ_CLOSE
39,130,984
segmantaion fault (core dumped) programming c
I was solving hackerrank problem given here : -- https://www.hackerrank.com/challenges/bigger-is-greater Program statement is as follow : " Given a word , rearrange the letters of to construct another word in such a way that is lexicographically greater than original one . In case of multiple possible answers, find the lexicographically smallest one among them. " If you don't understand then just go to the link, they have explained with examples. I made the program as given below. In this program i have made two dimensional array. And variable 't' decides number of row and column number is fix. Code is running as it should be when t = 1; But when t is greater than 1 or some large number it gives "segmentation error" Code is as below : #include <stdio.h> #include <string.h> #include <stdlib.h> int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int i,j,n,rot; int t; scanf("%d",&t); char c[t][100]; char temp; for(int i=0;i<t;i++) { scanf(" %s",c[i]); } rot=t; for(int t=0;t<rot;t++) { n = strlen(c[t]); //printf("%d\n",n); for(i=n-1;i>=0;i--) { for(j=i-1;j>=0;j--) { //printf("comparint %c and %c\n",c[t][i],c[t][j]); //FOR DEBUG if(c[t][i]>c[t][j]) goto gotit; } } printf("no answer\n"); continue; gotit: temp = c[t][i]; c[t][i]=c[t][j]; c[t][j]=temp; n = (n-1)-j; //printf("%s\n",c[t]); //FOR DEBUG //printf("%d %d %d\n",i,j,n); //FOR DEBUG for(i=0;i<n-1;i++) { for(int k=0;k<n-1;k++) { // printf("comparint %c and %c\n",c[t][j+k+1],c[t][j+k+2]); if(c[t][j+k+1]>c[t][j+k+2] ) { temp = c[t][j+k+1]; c[t][j+k+1]=c[t][j+k+2]; c[t][j+k+2]=temp; } } } printf("%s\n",c[t]); } return 0; }
<c>
2016-08-24 18:51:47
LQ_EDIT
39,131,274
I Broke My Eclipse Please H3LP
So, I managed to break my eclipse, not really sure how it happened. I have travelled from one end of google to the other trying to find a resolution this issue. I have asked coworkers how to fix this issue, none of them have ran into this before. As a last resort I turn to the all mighty, all knowing stackoverflow community in hopes to find an eclipse guru. So this is whats happening... Anytime I make a change to my code, or even something as simple as inserting/removing a breakpoint.. I need to then close my java project, reopen it and clean it. Then, and only then can I run my project or class without it running the PREVIOUS version of the file(s) I changed. Saving it does nothing.. refreshing it does nothing. Why did eclipse decide to start trolling me all of a sudden?
<eclipse>
2016-08-24 19:08:53
LQ_EDIT
39,132,682
What do I need to learn to develop a simple login app for android os?
<p>I know programming with java and the basics of android studio.I need to know how to store user data from android app and make the app interactive.Also please let me know if there are any tutorials for any such development released recently.</p>
<android>
2016-08-24 20:40:30
LQ_CLOSE
39,133,833
Regex to accept any 3 combinations is must but no space
I wanted to allow regex to accept minimum of 8 characters and any 3 combinations out of following 4 categories. 1. One uppercase alpha character 2. One lowercase alpha character 3. One numeric character 4. One special character The good thing is, there are many regex available for my requirement but most of them allows **space**. I got this [Regex][1] from [here][2]. I tried to modify this in several ways but I couldn't succeed in writing a proper regex to validate a space along with 3 combinations as i mentioned above. [1]: https://regex101.com/r/vB7eF3/6 [2]: http://stackoverflow.com/questions/5950756/regex-for-checking-that-at-least-3-of-4-different-character-groups-exist
<regex>
2016-08-24 22:15:18
LQ_EDIT
39,134,053
Part of code execute every 5 minutes C++
I am try to implement wait in c++. I cannot use sleep since it stop the current execution. For eg. do { if(something) { //Do something } if(something) { //Do something } if(every 5 minutes) { //Do something only once after 5 minutes } } while(true) I cannot use sleep since it will stop the execution. Can you help me with this since I need to implement this in this do while loop. I would have used threads with detach but I want to this 1 a single do while loop.
<c++><embedded>
2016-08-24 22:38:10
LQ_EDIT
39,134,319
Linked list not working in c++
<p>So i'm trying to get the linked list and this is my code so far. Everything look fine when i'm adding a node at the front of my list, but when i try to add my first node at the back, my code compile but return me -1. I'm not sure what's wrong with it but I know it's in the insertBack() function. And by the way, if there's anything else wrong let me know, it's my first try on linked list! Thanks!</p> <pre><code>#include "LinkedList.h" #include &lt;iostream&gt; #include &lt;stddef.h&gt; LinkedList::LinkedList() { head=NULL; length=0; } void LinkedList::InsertFront(int item) { Node *temp = new Node; temp-&gt;data = item; temp-&gt;next = head; head = temp; length++; } void LinkedList::InsertBack(int item) { Node *temp1 = new Node; temp1 = head; while(temp1-&gt;next != NULL) { temp1 = temp1-&gt;next; } Node *temp = new Node; temp-&gt;data = item; temp-&gt;next = NULL; temp1-&gt;next = temp; length++; } void LinkedList::MakeEmpty() { Node *temp; while(head!= NULL) { temp = head; head = head-&gt;next; delete temp; } length; } void LinkedList::ShowItems() { Node *temp = head; while(temp != NULL) { std::cout&lt;&lt;temp-&gt;data&lt;&lt;std::endl; temp = temp-&gt;next; } } LinkedList::~LinkedList() { MakeEmpty(); } </code></pre>
<c++><linked-list>
2016-08-24 23:04:59
LQ_CLOSE
39,134,457
Java Why isn't it allowed to set a protected final field from a subclass constructor?
<p>Why isn't it allowed to set a protected final field from a subclass constructor?</p> <p>Example:</p> <pre><code>class A { protected final boolean b; protected A() { b = false; } } class B extends A { public B() { super(); b = true; } } </code></pre> <p>I think it would make sense in some cases, wouldn't it?</p>
<java><constructor><subclass><final><protected>
2016-08-24 23:23:31
LQ_CLOSE
39,136,176
CMD asking for input when importing the webbrowser module
I'm having a small, yet quite annoying issue with python. When I import the webbrowser module in a python program, it works perfectly fine in the idle, but when I try to run the program outside the idle, it opens, runs the code before the import (which there normally isn't since I begin the program with the imports), and then, when it is time to import the webbrowser module, the program just stops and waits for me to input something. As an example, I made the most basic of program just to show what is happening step by step. Pastebin to the program : http://pastebin.com/8GsQZ1Ti . Here is what happens when I launch the program : http://imgur.com/a/lXtwV and finally, here is a screenshot of the program after I enter some text and press enter : * third link will be in a comment to this post since I need 10 rep to post more than 2 links in a single post * . Why is it that it stops when importing the webbrowser module? I only want the program to import the module and to continue normally.
<python><windows><python-3.x><windows-console>
2016-08-25 03:19:55
LQ_EDIT
39,136,620
phplist on Ubuntu 16.04.1 server - Initialise the Database no reaction
I got a new server with Ubuntu 16.04.1 installed. It comes with php7 I installed phplist-3.2.5 in the root of the host pr.xxx.com I tried in the config file: $pageroot = '/'; and $pageroot = ''; http://pr.xxx.com/admin let me fill out the PhpList initialisation, but the button [Continue] does not show me any reaction. No log file (syslog, apache error) gives me a clue. login to the mysql shows that the table has not been created either. Maybe related: On the right side I get the information: Error on line 66 of /var/www/pr.xxx.com/admin/ui/dressprow/onyx-rss.php: PHP's XML Extension is not loaded or available. How can I track down this problem?
<php><ubuntu-server><phplist>
2016-08-25 04:16:26
LQ_EDIT
39,136,767
How ca we do Jason parsing with authorization in objective c
NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfig delegate:self delegateQueue:[NSOperationQueue mainQueue]]; NSURL *url = [NSURL URLWithString:@"http://192.168.1.37:8000/sap/opu/odata/sap/ZGW_BANK_DATA_SRV/BankSet?$filter=(BankCtry%20eq%20%27IN%27)&$format=json"]; NSMutableURLRequest *request= [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0]; // NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://192.168.1.37:8000/sap/opu/odata/sap/ZGW_BANK_DATA_SRV/BankSet?$filter=(BankCtry%20eq%20%27US%27)&$format=json"]]; // NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL URLWithString: // [NSString stringWithFormat: // @"%@/%@/%@", // @"http://192.168.1.37:8000/sap/opu/odata/sap/ZGW_BANK_DATA_SRV/BankSet?$filter=(BankCtry%20eq%20%27IN%27)&$format=json", // @"abaper", // @"initial@1234"]]]; [request setHTTPMethod: @"GET" ]; // [request setHTTPBody:self.requestData]; [request setValue:@"abaper" forHTTPHeaderField:@"username"]; [request setValue:@"xyz..." forHTTPHeaderField:@"password"]; [request setValue:[[NSUserDefaults standardUserDefaults]valueForKey:@"Auth"] forHTTPHeaderField:@"Authorization"]; [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; NSError *error ; NSHTTPURLResponse *responseCode = nil; NSData *oResponseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&responseCode error:&error]; if([responseCode statusCode] != 200){ NSLog(@"Error getting %@, HTTP status code %li", url, (long)[responseCode statusCode]); } else{ NSDictionary *responsedata = [NSJSONSerialization JSONObjectWithData:oResponseData options:NSJSONReadingAllowFragments error:&error]; NSLog(@"%@",responsedata); } // // NSHTTPURLResponse * response = nil; // NSError * error = nil; // NSData * data = [NSURLConnection sendSynchronousRequest:request // returningResponse:&response // error:&error]; // // NSLog(@"Response code: %ld", (long)[response statusCode]); // // if ([response statusCode] >= 200 && [response statusCode] < 300) // { // // NSString *responseData = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding]; // NSLog(@"Response ==> %@", responseData); // // // } }
<objective-c><json><nsurlsession><nsurl><nsurlrequest>
2016-08-25 04:37:10
LQ_EDIT
39,137,461
How to plot three sets of comparative data in R
<p>I have this dataframe called <code>mydf</code> where I have column <code>Gene_symbol</code> and three different columns (cancers), <code>AML</code>,<code>CLL</code>,<code>MDS</code>. I want to plot the percentage of each gene in these cancers. What would be the good way to represent this in plot?</p> <pre><code>mydf &lt;- structure(list(GENE_SYMBOL = c("NPM1", "DNMT3A", "TET2", "IDH1", "IDH2"), AML = c("28.00%", "24.00%", "8.00%", "9.00%", "10.00%" ), CLL = c("0.00%", "8.00%", "0.00%", "3.00%", "1.00%"), MDS = c("7.00%", "28.00%", "7.00%", "10.00%", "3.00%")), .Names = c("GENE_SYMBOL", "AML", "CLL", "MDS"), row.names = c(NA, 5L), class = "data.frame") </code></pre>
<r><ggplot2>
2016-08-25 05:40:27
LQ_CLOSE
39,138,049
Navigation in iOS
<p>How to navigate from one ViewController to Another in iOS.As i was previously working on Android It was intent. I am not able to see proper documentation for iOS using swift. So please help me how to navigate from one view controller to another on a button click ! (I know button click func)</p>
<ios><swift>
2016-08-25 06:22:37
LQ_CLOSE
39,138,459
How to call an vector inside a list without explicitly referencing object's name?
<p>I have a list mylist and I know how to call one of its object by its name</p> <pre><code>head(mylist$"26533") [1] 39.67125 33.33558 33.75013 51.71748 47.86691 35.98055 </code></pre> <p>But when I try to get the same result with using x,</p> <pre><code>x &lt;- "26533" head(mylist$x) </code></pre> <p>R tells me the result is NULL. Can anyone tell me what is the problem?</p>
<r>
2016-08-25 06:48:02
LQ_CLOSE
39,139,843
A list in the column header with ASP NET and Linq
<p>I have this structure <a href="https://i.stack.imgur.com/3Uf14.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3Uf14.png" alt="enter image description here"></a></p> <p>and i want to get the following result <a href="https://i.stack.imgur.com/RD2wJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RD2wJ.png" alt="enter image description here"></a></p> <p>this means that i need to put the list of job in the header with Linq / C# , can you guys help with it ? i hope that my question is clear :)</p>
<c#><sql><asp.net><linq><linq-to-sql>
2016-08-25 08:05:36
LQ_CLOSE
39,142,288
Spring tutorial
<p>I am looking for a comprehensive tutorial for developing a web application with the Spring Framework. <a href="https://docs.spring.io/docs/Spring-MVC-step-by-step/overview.html" rel="nofollow">This</a> looks good, but seems a bit dated and uses Ant. Is there a more recent tutorial out there using Gradle or Maven?</p>
<spring><web-applications>
2016-08-25 10:04:54
LQ_CLOSE
39,142,384
When we use zevenzip.dll in my code using c#, geting error The runtime has encountered a fatal error.
when we use zevenzip.dll in my code using #, geting error The runtime has encountered a fatal error. The address of the error was at 0xdf7535b8, on thread 0x2224. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common source My code is SevenZipExtractor.SetLibraryPath(@"D:\\Projects\\XML2U\\WindowsFormsApplication1\\WindowsFormsApplication1\\bin\\Debug\\SevenZipSharp.dll"); SevenZipCompressor compressor = new SevenZipCompressor(); compressor.ArchiveFormat = OutArchiveFormat.Zip; compressor.CompressionMode = CompressionMode.Create; compressor.TempFolderPath = System.IO.Path.GetTempPath(); compressor.VolumeSize = 10000000; compressor.CompressDirectory(backupFolder, destination);
<c#>
2016-08-25 10:08:54
LQ_EDIT
39,142,655
Find Difference Between Two Numbers in Comma Separated Array
Suppose I have a MySQL table which has two rows and two columns. Column 1 = ID Column 2 = NUMBERS NUMBERS field in first row & second row has following comma separated value: NUMBERS(Row 1) = 1,2,3,4,5,6,7,8 NUMBERS(Row 2) = 6,7,8,9,10,11 Now I need to find all the numbers which are between 1 & 11. I have tried MYSQL BETWEEN function but it has not returned desired results. Is there a way I can get desired result?
<php><mysql>
2016-08-25 10:21:00
LQ_EDIT
39,145,472
xml parsing and spliting in scala
I want to split a **sub xml from mail xml** with the help of the node name can some one help? sample.xml <div> <a>A <b>B <c>C</c> </b> <d>D</d> </a> </div> I want to split the sub xml that contains B using scala?please help
<xml><scala><xml-parsing><filesplitting>
2016-08-25 12:34:34
LQ_EDIT
39,145,665
Python Finding Missing Elements among a range of number lines.
Let's say I have a list of ranges (ie. [[1,100][102, 200], etc]]. I want to find the number of missing elements in the total range. I have a working algorithm below: def missing(numranges): (minimum, maximum) = (min(map(lambda x: x[0], numranges)), max(map(lambda x: x[1], numranges))) (count, i) = (0, minimum) while i < maximum: if any(j <= i <= k for j, k in numranges): count += 1 i += 1 return maximum - minimum - count The problem is if you have say a number line that say is like [[1, 10000], [10002, 20000]], then i goes over over all 20,000 elements and it seems to me that this is very inefficient. I'm trying to find a way to make the algorithm better but I'm a bit stumped.
<python><python-2.7>
2016-08-25 12:43:01
LQ_EDIT
39,146,046
weird typecasting ((ClassPathXmlApplicationContext) context).close();
<p>I am learning java and spring on the way, I have the following code for which I do not understand how typecasting works:</p> <pre><code>public class App { public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("com/voja/spring/test/beans/beans.xml"); ((ClassPathXmlApplicationContext) context).close(); } } </code></pre> <p>So the following:</p> <pre><code>((ClassPathXmlApplicationContext) context).close(); </code></pre> <p>is what I don't get.</p> <p>My thinking is that it should be like:</p> <pre><code>(ClassPathXmlApplicationContext) context.close(); </code></pre> <p>But that gives an error.</p> <p>The way it is now it's how it's supposed to be, but I don't get how is the method invoked on it, and why is <code>(ClassPathXmlApplicationContext) context</code> inside brackets, and once again how can a method be appended to this?</p>
<java>
2016-08-25 12:59:51
LQ_CLOSE
39,146,416
Get 1 year old data from begining of month
<p>I want to get 1 year old data from database till current date but from the beginning of month.if today is 25-08-2016 i have to get data from 01-08-2015 till now</p>
<php><mysql><codeigniter>
2016-08-25 13:16:40
LQ_CLOSE
39,146,720
Initializer block not executing
<p>In the code below why is the initializer block not called? But if the main() is removed from this class and when it is loaded from another class, the initializer block executes.</p> <pre><code>public class AAStatic { static String s = "a"; { System.out.println("hi"); m1(); } public static void main(String[] args) { m1(); System.out.println(s); } static{ m1(); } static void m1(){ s+="b"; } } </code></pre>
<java>
2016-08-25 13:30:23
LQ_CLOSE
39,147,242
I need to redirect a page when time become 00.00
<p>I need to wish a birthday to my friend and so I plan to tell my friend to open a webpage @ 11.55 and when time becomes 12.00 I need to automatically redirect my friend's page to my greeting page and help me to do the task </p>
<javascript><php><html><redirect>
2016-08-25 13:53:56
LQ_CLOSE
39,148,080
Null Data from onResponse() of volley in Fragment' onCreateView()
<p>I am trying to get some country data from a URL using volley. In <strong>onResponse()</strong> data is successfully added to <em>countryList</em> and <em>countryList.size()</em> shows it has 5 countries. But in <strong>onCreateView()</strong>, when I try to use <em>countryList</em>, it is null and throws <strong>NullPointerException</strong> because of <em>countryList.size()</em> as <em>countryList</em> has null value. Thanks in advance, here's the code:</p> <pre><code>public class MyAddress extends Fragment { ArrayList&lt;Countries&gt; countryList; @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.shipping_address, container, false); RequestCountries(); Toast.makeText(getContext(), countryList.size(), Toast.LENGTH_SHORT).show(); //Some code to use countryList return rootView; } private void RequestCountries() { final String urlLink = ConstantValues.BASE_URL + "getCountries"; StringRequest countryRequest = new StringRequest ( Request.Method.GET, urlLink, new Response.Listener&lt;String&gt;() { @Override public void onResponse(String response) { JSONObject jsonResponse = new JSONObject(response); JSONArray countries = jsonResponse.getJSONArray("countries"); for (int i=0; i&lt; countries.length(); i++) { JSONObject countryInfo = countries.getJSONObject(i); String country_id = countryInfo.getString("country_id"); String country_name = countryInfo.getString("country_name"); Countries country = new Countries(); country.setCountry_id(country_id); country.setCountry_name(country_name); countryList.add(country); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { error.printStackTrace(); Toast.makeText(getContext(), error.toString(), Toast.LENGTH_SHORT).show(); } } ); RequestQueue requestQueue = Volley.newRequestQueue(getContext()); requestQueue.add(countryRequest); } } </code></pre>
<java><android><android-studio><android-fragments><android-volley>
2016-08-25 14:31:09
LQ_CLOSE
39,149,437
Sum especific property of same item in list of lists using java 8 streams
Given a List of lists and using java 8 Streams API, I need to sum all quantities of each same item in different lists grouped by your id. For the example, I have the following code: public class Streams { static class PurchaseItemCancellation { private Integer id; private BigDecimal quantity; // constructor // getters and setters } static class PurchaseCancellation { private Integer id; private List<PurchaseItemCancellation> purchaseItemsCancellations; // constructor // getters and setters } public static void main (String ... args) { PurchaseItemCancellation item1 = new PurchaseItemCancellation(1, new BigDecimal("10.00")); PurchaseItemCancellation item2 = new PurchaseItemCancellation(2, new BigDecimal("20.00")); PurchaseItemCancellation item3 = new PurchaseItemCancellation(3, new BigDecimal("30.00")); PurchaseItemCancellation item4 = new PurchaseItemCancellation(4, new BigDecimal("40.00")); PurchaseCancellation purchaseCancellation1 = new PurchaseCancellation(1, Arrays.asList(item1, item2)); PurchaseCancellation purchaseCancellation2 = new PurchaseCancellation(2, Arrays.asList(item3, item4)); PurchaseCancellation purchaseCancellation3 = new PurchaseCancellation(3, Arrays.asList(item4, item1)); List<PurchaseCancellation> cancellations = Arrays.asList(purchaseCancellation1, purchaseCancellation2, purchaseCancellation3); final Comparator<PurchaseItemCancellation> byID = (p1, p2) -> Integer.compare(p1.getId(), p2.getId()); // List<PurchaseItemCancellation> itemsCancellations = cancellations.stream() .... } } The `List<PurchaseCancellation> cancellations` has lists of cancellations on which each cancellation has a list of `PurchaseItemCancellation`; So I want to sum all quantities of same item for each list of `PurchaseItemCancellation` contained on each cancellation. The result must be a `List<PurchaseItemCancellation>`: item1: id: 1, quantity: 20.00 item2: id: 2, quantity: 20.00 item3: id: 3, quantity: 30.00 item4: id: 4, quantity: 80.00 A executable code could be found in: [http://www.tutorialspoint.com/compile_java8_online.php?PID=0Bw_CjBb95KQMREE4TEJxa080NFE][1] **P.S.: This site has two annoying bugs.** **First bug:** When you click the link is opened a file "HelloWorld.java". Close this file and open the correct file :"Streams.java" on the left sidebar. The execute button is on the top of editor. **Second bug:** if the file is modified you must generate a new sharing link by clicking in "Share code" button on the top of editor. Sorry about this site. I don't know a better online java 8 code editor. Any help will be apreciated. [1]: http://www.tutorialspoint.com/compile_java8_online.php?PID=0Bw_CjBb95KQMREE4TEJxa080NFE
<java><java-8><java-stream>
2016-08-25 15:38:51
LQ_EDIT
39,149,625
create one list from to two colums
in need Help with oracle SQL. i have a table with from to F B B R R D E X X Q and i need the list F B R D E X Q so my problem is the jump from R-->D to E-->X has anybody an idea ?
<sql><oracle><union>
2016-08-25 15:48:16
LQ_EDIT
39,149,675
Complex Syntax Error php html
<p>I have a problem with syntax error. trying to upload image from directory into my list in html but it keeps saying things like:</p> <p><strong>Parse error: syntax error, unexpected '"', expecting ',' or ';' in D:\xampp\htdocs\Waldi\index.php on line 243</strong></p> <pre><code>&lt;?php $dir="img/"; if($opendir=opendir($dir)){ while(($file=readdir($opendir))!==FALSE){ if($file!="." &amp;&amp; $file!="..") echo '&lt;li class="col-lg-4 col-md-4 col-sm-3 col-xs-4 col-xxs-12"&gt; &lt;img class="img-responsive" src='"$dir/$file"'&gt; &lt;/li&gt;'; } } ?&gt; </code></pre>
<php>
2016-08-25 15:50:31
LQ_CLOSE
39,150,548
Visual Basic build error
I get 2 errors at line 70 and line 74 of making a keygenerator for XP Repair Pro6 when i finisherd every thing and built it it shows me these two errors 1. TextBox2.Text = Generate(Strings.LCase(TextBox1.Text), Strings.LCase(MD5("xprp6-K0Wc0kf3Wcm5g-FEe43f"))) 'MD5' is a type and cannot be used as an expression. 2. Public Shared Function MD5(ByVal InputStr As String) As String Statement is not valid in a namespace. Please help, thanks
<vb.net>
2016-08-25 16:36:58
LQ_EDIT
39,151,093
app doesn't save date to calender swift
I am trying to specific date to calendar but doesn't wok this is my code I am trying to specific date to calendar but doesn't wok this is my code @IBAction func addToCalenderButton(sender: AnyObject) { let eventStore = EKEventStore() self.event?.Start let dateString = "Thu, 24 Oct 2015 07:45" let dateFormatter = NSDateFormatter() dateFormatter.dateFormat = "EEE, dd MMM yyy hh:mm" let date:NSDate = dateFormatter.dateFromString(dateString)! dateFormatter.dateFormat = "EEE, dd MMM yyy hh:mm" if (EKEventStore.authorizationStatusForEntityType(.Event) != EKAuthorizationStatus.Authorized) { eventStore.requestAccessToEntityType(.Event, completion: { granted, error in self.createEvent(eventStore, title: (self.event?.title)!, startDate: date) }) } else { createEvent(eventStore, title: (self.event?.title)!, startDate: date) } } func createEvent(eventStore: EKEventStore, title: String, startDate: NSDate) { let event = EKEvent(eventStore: eventStore) event.title = title event.startDate = startDate event.calendar = eventStore.defaultCalendarForNewEvents do { try eventStore.saveEvent(event, span: .ThisEvent) savedEventId = event.eventIdentifier Constant.displayAlert(self, title: "", Message: "The event has been added") } catch { print("Bad things happened") } }
<ios><swift><nsdate><nscalendar><ekeventstore>
2016-08-25 17:10:55
LQ_EDIT
39,151,385
FORTRAN ERROR 6837
Hello I am trying to write a FORTRAN subroutine for ABAQUS that would modify the seepage coefficient and thus the flow depending on whether there is contact on the surface. In order to do so I need 2 subroutines URDFIL to retrieve the node data and FLOW to modify the seepage coefficient. However, when I compile my subroutine I get the following errors: flow_us.for(81): error #6837: The leftmost part-ref in a data-ref can not be a function reference. [K_ELE_DETAILS] IF(K_ELE_DETAILS(E_INDX)%IS_CONT(N_INDX).EQ.0)THEN ----------^ flow_us.for(81): error #6158: The structure-name is invalid or is missing. [K_ELE_DETAILS] IF(K_ELE_DETAILS(E_INDX)%IS_CONT(N_INDX).EQ.0)THEN Obviously it is repeated for the 3 lines (if's) that contain such structure (81,8, and 89). Please find the code below and hopefully someone will be able to help `**************************************************************************************** ***SUBROUTINE FOR ADAPTIVE FLUID FLOW **************************************************************************************** **************************************************************************************** ** ** ** *USER SUBROUTINE SUBROUTINE URDFIL(LSTOP,LOVRWRT, KSTEP, KINC, DTIME, TIME) INCLUDE 'ABA_PARAM.INC' C DIMENSION ARRAY(513),JRRAY(NPRECD,513),TIME(2) EQUIVALENCE (ARRAY(1),JRRAY(1,1)) C DECLARATIONS TYPE ELE_DATA SEQUENCE DOUBLE PRECISION :: NODE_COORD(9) DOUBLE PRECISION :: OPP_NODE_COORD(9) DOUBLE PRECISION :: IPT_COORD(9) DOUBLE PRECISION :: POR(3) DOUBLE PRECISION :: OPP_POR(3) INTEGER :: ELE_NUM INTEGER :: OPP_ELE_NUM INTEGER :: NODE_NUM(3) INTEGER :: OPP_NODE_NUM(3) INTEGER :: IPT_NUM(3) INTEGER :: OPP_IS_CONT(3) END TYPE ELE_DATA TYPE(ELE_DATA)::K_ELE_DETAILS(500) COMMON K_ELE_DETAILS PARAMETER (THRESHOLD_CSTRESS=1.0E-6) ******************************************************* INTEGER :: NO_OF_NODES INTEGER :: NO_OF_ELEMENTS INTEGER :: NO_OF_DIM COMMON NO_OF_DIM, NO_OF_NODES, NO_OF_ELEMENTS ******************************************************** C INITIALIZE LSTOP=0 LOVRWRT=1 LOP=0 NO_OF_NODES=10000 NO_OF_ELEMENTS=10000 NO_OF_DIM=2 DO K1=1,999999 CALL DBFILE(0, ARRAY,JRCD) IF (JCRD.NE.0) GO TO 110 KEY=JRRAY(1,2) ******************************************************* C THE KEYS USED IN THE FOLLOWING LINES REFER C TO INFORMATION ON THE SURFACE, NODES, CONTACT ETC IF (KEY.EQ.1501) THEN ELSE IF (KEY.EQ.1502)THEN ELSE IF(KEY.EQ.1911) THEN ELSE IF(KEY.EQ.108.AND.SURFACE_N_SET.EQ.'N_TOP') THEN ELSE IF(KEY.EQ.107.AND.SURFACE_N_SET.EQ.'N_TOP') THEN ELSE IF(KEY.EQ.1503)THEN ELSE IF(KEY.EQ.1504.AND.K_NODE_SET.EQ.'N_TOP')THEN ELSE IF(KEY.EQ.1511.AND.K_NODE_SET.EQ.'N_TOP')THEN C IS THE NODE IN CONTACT? 120 CONTINUE END IF END DO 110 CONTINUE RETURN END ********************************************************** ********************************************************** *USER SUBROUTINE SUBROUTINE FLOW(H, SINK, KSTEP, KINC, TIME, NOEL, NPT, COORDS, 1 JLTYP,SNAME) INCLUDE 'ABA_PARAM.INC' C DIMENSION TIME(2), COORDS(3) CHARACTER*80 SNAME MIN_DIST=10E-20 DO K25=1,NO_OF_ELEMENTS DO K26=1,NO_OF_NODES C FINDS THE CLOSEST NODE TO THE INTEGRATION POINT NPT END DO END DO C NOT IN CONTACT IF(K_ELE_DETAILS(E_INDX)%IS_CONT(N_INDX).EQ.0)THEN IF(K_ELE_DETAILS(E_INDX)%POR(N_INDX).GE.0) THEN SINK=0 H=0.001 ELSE SINK=0 H=1 END IF ELSE IF(K_ELE_DETAILS(E_INDX)%IS_CONT(N_INDX).EQ.1)THEN C IF THERE IS CONTACT SINK=0 H=0 END IF RETURN END `
<fortran><subroutine><flow><abaqus>
2016-08-25 17:29:27
LQ_EDIT
39,152,162
Identify alternating Uppercase and lower case characters in python
<p>I am having data as follows,</p> <pre><code>data['word'] 1 Word1 2 WoRdqwertf point 3 lengthy word 4 AbCdEasc 5 Not to be filtered 6 GiBeRrIsH 7 zSxDcFvGnnn </code></pre> <p>I want to find out alternating capital and small letters in the string and remove those rows containing words like these. For ex., if we see here, <code>WoRdqwertf , AbCdEasc, GiBeRrIsH,zSxDcFvGnnn</code> has alternating characters and I need these to be removed.</p> <p>The point here is, the first row which contains <code>Word1</code> shouldn't be removed because it has only one caps followed by one small. I want to remove the rows only when it has a caps, small, caps arrangement or small, caps, small arrangement. My output here should be,</p> <pre><code>data['word'] 1 Word1 3 lengthy word 5 Not to be filtered </code></pre> <p>Can any body help me or give some idea how to approach this problem?</p>
<python><regex><string><python-2.7><python-3.x>
2016-08-25 18:14:18
LQ_CLOSE
39,152,858
Exporting a Powershell Script to CSV
I found a PowerShell script that looks to be just what I need, but I am having trouble pipeing it to a CSV. I think it may be the Foreach portion that is giving the trouble, was wondering if anyone can pinpoint the cause. $Groups = Get-ADGroup -Properties * -Filter * -SearchBase "OU=Groups,DC=corp,DC=ourcompany,DC=Com" Foreach($G In $Groups) { Write-Host $G.Name Write-Host "-------------" $G.Members } (Credit to Ryan Ries for posting in the first place) Thanks!
<csv><powershell><foreach>
2016-08-25 18:58:28
LQ_EDIT
39,153,149
require_once inside of a function
<p>for self exercise and training I am building my own CMS from the ground up. Part of this exercise is to enable custom html, css templates</p> <p>Security wise, is it better if I open the PHP template file with require_once inside of a function to protect outside variables like the Database Handler and such?</p> <p>Or should I make this entirely diffrent than this?</p>
<php><security>
2016-08-25 19:17:44
LQ_CLOSE
39,153,276
How to use a class created by the entity framework
<p>I have a project coming up so I decided to look at the entity framework. If I don't have to create a data manager I think this would be the way to go, if it works. I see lots of things about it but none of them are clear.</p> <p>It created this class</p> <pre><code>namespace EFTest { using System; using System.Collections.Generic; public partial class SalesRepresentative { public int ID { get; set; } public string Name { get; set; } public string Email { get; set; } public string CellPhone { get; set; } } } </code></pre> <p>How do I use it? Looking for examples I see things like this:</p> <pre><code>using (var ctx = new Context()) { Employee emp = new Employee() { name = "Prashant" }; ctx.Employees.Add(emp); ctx.SaveChanges(); } </code></pre> <p>I have a file called Model.Comntext with no context class in it. I tried changing it to dBContext but that doesn't work either.</p> <p>I also found this:</p> <pre><code>CustomersComponent custc = new CustomersComponent(); Customers cust = custc.getCustomer(Id); txtName.Text = cust.Name; ddlCategories.SelectedValue = cust.Category.Id.ToString(); </code></pre> <p>Well that has a Customer and a CustomerComponent. I have no such Component classes. I've spent half a day looking into this and am starting to wonder if the Entity Framework is a cousin of Microsoft Bob. Unless someone can tell me what I'm missing I will have to write my own data manager.</p>
<c#><.net><vb.net><entity-framework>
2016-08-25 19:25:36
LQ_CLOSE
39,153,292
How to specify ranges to java.util.Random?
<p>I don't know why Java's designers didn't design java.util.Random objects to return random numbers like this: </p> <p><code>rand.nextInt(minValue, maxValue);</code></p> <p>I don't understand how to pass min and max values to this function. I've seen this recommended:</p> <p><code>random.nextInt(max + 1 - (min)) + min</code></p> <p>but what does that mean? Does that mean: </p> <p><code>random.nextInt(FULL_RANGE + 1) + START_OF_RANGE</code></p> <p>For example, if I wanted to generate values between -1 and 1, inclusive, is this how I do it:</p> <p><code>int oneOfThreeChoices = rand.nextInt(1 + 1 + 1) - 1;</code></p>
<java><android><random>
2016-08-25 19:26:53
LQ_CLOSE
39,153,840
How to get the returned rows after executing a PHP/MYSQL prepared statement?
<p>I know the output of an execute statement is a bool. But then how do you get the result of a SELECT statement like below?</p> <pre><code>&lt;?php /* Execute a prepared statement by passing an array of insert values */ $calories = 150; $colour = 'red'; $sth = $dbh-&gt;prepare('SELECT name, colour, calories FROM fruit WHERE calories &lt; :calories AND colour = :colour'); $sth-&gt;execute(array(':calories' =&gt; $calories, ':colour' =&gt; $colour)); ?&gt; </code></pre> <p>$sth will be either TRUE or FALSE. What I'm interested in is the return rows containing the name, colour and etc.</p> <p>Thanks!</p>
<php><mysql>
2016-08-25 20:02:58
LQ_CLOSE
39,154,943
Tests for Java Map and ConcurrentMap contract
<p>I'm working on a custom implementation of Map and ConcurrentMap (with additional features). Are there existing unit tests for the Map and ConcurrentMap contract from the JDK or some libraries that we can borrow?</p>
<java><dictionary>
2016-08-25 21:24:36
LQ_CLOSE
39,155,650
No repeat randomizing in objective C (Xcode)
i am lost. So i need any help. I wrote this code for a simple game. It is randomizing a number and then do something with SWITCH. It is simple but i want to have a task only once in one round. In my case round is 3 task. After a round is done, i want to reset my variables and start a new round again. So it is random, but task wonn't happen twice in one round. I wrote this code but it didn't work. If i click on button which will start rand(), it will do 1st task, then i click again, it will do 2nd task, but when i click 3rd times nothing is happening. 3rd task works for 4th click. Thank's for any help and sorry for my english :) int text; int x=3; //this is number of tasks in one round, so in switch i have 3 tasks int z=9999; int x0=1; //this mean's that task 0 can happen only once in one round int x1=1; int x2=1; -(void)reset{ // this is rof checking if x is <1, then it will reset all variables (start a new round) if (x<1) { x=3; x0=1; x1=1; x2=1; } } -(void)randomize{ text = rand() % 3; //this wil get me a random number for switch while(text==z) //this is because i don't want to have same number consecutively {text = rand() % 3;} } - (IBAction)random:(id)sender { [self randomize]; switch (text) { case 0: if (x0!=0){ //something will happen z=0; x0--; x--; [self reset]; break; } else { [self randomize]; } case 1: if (x1!=0) { //something will happen z=1; x1--; x--; [self reset]; break; } else { [self randomize]; break; } case 2: if (x2!=0) { //something will happen z=2; x2--; x--; [self reset]; } else { [self randomize]; } } }
<objective-c><random>
2016-08-25 22:22:44
LQ_EDIT
39,156,456
import URL from row in csv for beautifulsoup
<p>I am looking to import the URL from rows in file.csv so beautiful soup can parse the XML, but I have no idea how to make the following occur. </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>url = row in 'file.csv' soup = BeautifulSoup(urllib2.urlopen('url').read() letters = soup.select('h1') print letters</code></pre> </div> </div> </p>
<python><beautifulsoup><screen-scraping>
2016-08-25 23:58:04
LQ_CLOSE
39,156,765
I have an error with Symfony
I have a similar configuration with other project, and It run good. But, this project get problem: Fatal error: Uncaught UnexpectedValueException: The stream or file "/home/docker/test-project/var/logs/prod.log" could not be opened: failed to open stream: Permission denied in /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107 Stack trace: #0 /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array) #1 /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php(122): Monolog\Handler\AbstractProcessingHandler->handle(Array) #2 /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Logger.php(336): Monolog\Handler\FingersCrossedHandler->handle(Array) #3 /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Logger.php(643): Monolog\Logger->addRecord(500, 'Uncaught PHP Ex...', Array) #4 /home/docker/test-project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php(89): Monolog\Logger->critical('Uncaught PHP Ex. in /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107 I tried: http://symfony.com/doc/current/setup/file_permissions.html and I don't get a good result
<nginx><docker><symfony>
2016-08-26 00:42:30
LQ_EDIT
39,156,941
AVS Adult Video Script Site - error when adding swf game file
I have an adult tube site setup using AVS. I tried to add a game (swf file), but after uploading is complete, it shows an error "Please selected a game file!" even though I have selected one. Any idea what might be happening here? THanks!
<php><flash>
2016-08-26 01:07:30
LQ_EDIT
39,157,025
Confusion about sanity testing of software
<p>I have read several posts regarding smoke and sanity testing. All are almost confusing. Neither explaining them clearly,just repeating the matter except some two or three posts and based on that two or three posts i concluded that following is the formal process:</p> <p>Smoke testing(generalized health checkup)---then--> Sanity Testing(checking <strong>some main</strong> functionalities to <strong>somewhat</strong> more deeper level)(Specialized health checkup)----------------then--------> Functional testing(full functionality checking at deeper levels)</p> <p>Am i right in above concept?</p> <p>I have confusion regarding when sanity is performed. Smoke is performed when build comes very first time. But when sanity is performed? Is sanity is performed <strong>only after</strong> every smoke OR it is performed <strong>every time build undergoes some change</strong>(i.e. even when smoke is not performed because smoke is performed only first time build comes) OR in both cases?</p>
<testing><qa><manual-testing><smoke-testing><sanity-check>
2016-08-26 01:21:00
LQ_CLOSE
39,157,207
mysql fetch row and undefined variable error
I keep getting the following errors. The $query produces a 1300 result list. When I echo $query I get the mysql statement. [25-Aug-2016 21:38:32 America/New_York] PHP Warning: mysql_fetch_row() expects parameter 1 to be resource, null given in song.php on line 285 [25-Aug-2016 21:38:32 America/New_York] PHP Notice: Undefined variable: song_hash in song.php on line 292 $query = "select " . $query_data . " from " . $query_tables . " where " . $query_where; //echo $query; $result = mysql_query($query,$database); while($row = mysql_fetch_row($result)){ $key = $row[0]; $song_hash[$key] = ($song_hash[$key] + 1); } $largest = max($song_hash);
<php><mysql>
2016-08-26 01:48:22
LQ_EDIT
39,158,314
I got a error in visual studio
Description The specified task executable "csc.exe" could not be run. Could not load file or assembly 'Microsoft.CodeAnalysis.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
<visual-studio-2015><msbuild>
2016-08-26 04:29:28
LQ_EDIT
39,158,473
VB.Net Textbox to DateTimePicker
<p>DateTimePicker1 = dateofbirth.Text</p> <p>it says The Value of type 'String' cannot be converted to 'System.Windows.Forms.DateTimePicker'.</p> <p>please help me how to convert the date from textbox to datetimepicker the format of date is yyyy/MM/dd. thank you in advance.</p>
<vb.net>
2016-08-26 04:51:11
LQ_CLOSE
39,158,579
Menu in android studio
I am new in android ,[![enter image description here][1]][1] [1]: http://i.stack.imgur.com/6r917.jpg I want to show this type of menu, when i clicked any item of menu, description of that item is shown in right panel. This menu always available on scree. Which type of widget i have to use for this. Thanks in advance
<android><master-detail>
2016-08-26 05:02:08
LQ_EDIT
39,159,059
donot know how to implement snmp in python
I am now currently working with snmp. The package I used is pysnmp...but I do not know how to implement snmp in python. The problem is, given an ip address it should give the details of that device using snmp.culd anyone suggest me how to do it?
<python><ip><snmp><pysnmp>
2016-08-26 05:44:47
LQ_EDIT
39,159,684
Msg 208, Level 16, State 1, Line 1 Invalid object name 't'
SELECT t.ACCOUNTDATE ,t.PropertyName ,isnull(t.FOODREVENUE_TODAY,0) AS FOODREVENUE_TODAY_CY,isnull(y.FOODREVENUE_TODAY,0) AS FOODREVENUE_TODAY_PY ,isnull(t.FOODREVENUE_MTOD,0) AS FOODREVENUE_MTOD_CY,isnull(y.FOODREVENUE_MTOD,0) AS FOODREVENUE_MTOD_PY ,isnull(t.FOODREVENUE_YTOD,0) AS FOODREVENUE_YTOD_CY,isnull(y.FOODREVENUE_YTOD,0) AS FOODREVENUE_YTOD_PY ,isnull(t.LIQUORREVENUE_TODAY,0) AS LIQUORREVENUE_TODAY_CY,isnull(y.LIQUORREVENUE_TODAY,0) AS LIQUORREVENUE_TODAY_PY ,isnull(t.LIQUORREVENUE_MTOD,0) AS LIQUORREVENUE_MTOD_CY,isnull(y.LIQUORREVENUE_MTOD,0) AS LIQUORREVENUE_MTOD_PY ,isnull(t.LIQUORREVENUE_YTOD,0) AS LIQUORREVENUE_YTOD_CY,isnull(y.LIQUORREVENUE_YTOD,0) AS LIQUORREVENUE_YTOD_PY ,isnull(t.SOFTDRINKSREVENUE_TODAY,0) AS SOFTDRINKSREVENUE_TODAY_CY,isnull(y.SOFTDRINKSREVENUE_TODAY,0) AS SOFTDRINKSREVENUE_TODAY_PY ,isnull(t.SOFTDRINKSREVENUE_MTOD,0) AS SOFTDRINKSREVENUE_MTOD_CY,isnull(y.SOFTDRINKSREVENUE_MTOD,0) AS SOFTDRINKSREVENUE_MTOD_PY ,isnull(t.SOFTDRINKSREVENUE_YTOD,0) AS SOFTDRINKSREVENUE_YTOD_CY,isnull(y.SOFTDRINKSREVENUE_YTOD,0) AS SOFTDRINKSREVENUE_YTOD_PY ,isnull(t.TOBACCOREVENUE_TODAY,0) AS TOBACCOREVENUE_TODAY_CY,isnull(y.TOBACCOREVENUE_TODAY,0) AS TOBACCOREVENUE_TODAY_PY ,isnull(t.TOBACCOREVENUE_MTOD,0) AS TOBACCOREVENUE_MTOD_CY,isnull(y.TOBACCOREVENUE_MTOD,0) AS TOBACCOREVENUE_MTOD_PY ,isnull(t.TOBACCOREVENUE_YTOD,0) AS TOBACCOREVENUE_YTOD_CY,isnull(y.TOBACCOREVENUE_YTOD,0) AS TOBACCOREVENUE_YTOD_PY ,isnull(t.OTHERREVENUE_TODAY,0) AS OTHERREVENUE_TODAY_CY,isnull(y.OTHERREVENUE_TODAY,0) AS OTHERREVENUE_TODAY_PY ,isnull(t.OtherRevenue_MTOD,0) AS OTHERREVENUE_MTOD_CY,isnull(y.OtherRevenue_MTOD,0) AS OTHERREVENUE_MTOD_PY ,isnull(t.OTHERREVENUE_YTOD,0) AS OTHERREVENUE_YTOD_CY,isnull(y.OTHERREVENUE_YTOD,0) AS OTHERREVENUE_YTOD_PY ,isnull(t.FOODCOVERS_TODAY,0) AS FOODCOVERS_TODAY_CY,isnull(y.FOODCOVERS_TODAY,0) AS FOODCOVERS_TODAY_PY ,isnull(t.FOODCOVERS_MTOD,0) AS FOODCOVERS_MTOD_CY,isnull(y.FOODCOVERS_MTOD,0) AS FOODCOVERS_MTOD_PY ,isnull(t.FOODCOVERS_YTOD,0) AS FOODCOVERS_YTOD_CY,isnull(y.FOODCOVERS_YTOD,0) AS FOODCOVERS_YTOD_PY ,isnull(t.LIQUORCOVERS_TODAY,0) AS LIQUORCOVERS_TODAY_CY,isnull(y.LIQUORCOVERS_TODAY,0) AS LIQUORCOVERS_TODAY_PY ,isnull(t.LIQUORCOVERS_MTOD,0) AS LIQUORCOVERS_MTOD_CY,isnull(y.LIQUORCOVERS_MTOD,0) AS LIQUORCOVERS_MTOD_PY ,isnull(t.LIQUORCOVERS_YTOD,0) AS LIQUORCOVERS_YTOD_CY,isnull(y.LIQUORCOVERS_YTOD,0) AS LIQUORCOVERS_YTOD_PY ,isnull(t.OTHERCOVERS_TODAY,0) AS OTHERCOVERS_TODAY_CY,isnull(y.OTHERCOVERS_TODAY,0) AS OTHERCOVERS_TODAY_PY ,isnull(t.OTHERCOVERS_MTOD,0) AS OTHERCOVERS_MTOD_CY,isnull(y.OTHERCOVERS_MTOD,0) AS OTHERCOVERS_MTOD_PY ,isnull(t.OTHERCOVERS_YTOD,0) AS OTHERCOVERS_YTOD_CY,isnull(y.OTHERCOVERS_YTOD,0) AS OTHERCOVERS_YTOD_PY ,isnull(t.TOBACCOCOVERS_TODAY,0) AS TOBACCOCOVERS_TODAY_CY,isnull(y.TOBACCOCOVERS_TODAY,0) AS TOBACCOCOVERS_TODAY_PY ,isnull(t.TOBACCOCOVERS_MTOD,0) AS TOBACCOCOVERS_MTOD_CY,isnull(y.TOBACCOCOVERS_MTOD,0) AS TOBACCOCOVERS_MTOD_PY ,isnull(t.TOBACCOCOVERS_YTOD,0) AS TOBACCOCOVERS_YTOD_CY,isnull(y.TOBACCOCOVERS_YTOD,0) AS TOBACCOCOVERS_YTOD_PY FROM (select B.FullDate AS ACCOUNTDATE ,C.PropertyName ,(A.FOODREVENUE) AS FOODREVENUE_TODAY,(D.FOODREVENUE_MTOD) AS FOODREVENUE_MTOD,(D.FOODREVENUE_YTOD) AS FOODREVENUE_YTOD ,(A.LIQUORREVENUE) AS LIQUORREVENUE_TODAY,(D.LIQUORREVENUE_MTOD) AS LIQUORREVENUE_MTOD,(D.LIQUORREVENUE_YTOD) AS LIQUORREVENUE_YTOD ,(A.SOFTDRINKSREVENUE) AS SOFTDRINKSREVENUE_TODAY,(D.SOFTDRINKSREVENUE_MTOD) AS SOFTDRINKSREVENUE_MTOD,(D.SOFTDRINKSREVENUE_YTOD) AS SOFTDRINKSREVENUE_YTOD ,(A.TOBACCOREVENUE) AS TOBACCOREVENUE_TODAY,(D.TOBACCOREVENUE_MTOD) AS TOBACCOREVENUE_MTOD,(D.TOBACCOREVENUE_YTOD) AS TOBACCOREVENUE_YTOD ,(A.OtherRevenue) AS OTHERREVENUE_TODAY,(D.OtherRevenue_MTOD) AS OTHERREVENUE_MTOD,(D.OTHERREVENUE_YTOD) AS OTHERREVENUE_YTOD ,(A.FOODCOVERS) AS FOODCOVERS_TODAY,(D.FOODCOVERS_MTOD) AS FOODCOVERS_MTOD,(D.FOODCOVERS_YTOD) AS FOODCOVERS_YTOD ,(A.LIQUORCOVERS) AS LIQUORCOVERS_TODAY,(D.LIQUORCOVERS_MTOD) AS LIQUORCOVERS_MTOD,(D.LIQUORCOVERS_YTOD) AS LIQUORCOVERS_YTOD ,(A.OTHERCOVERS) AS OTHERCOVERS_TODAY,(D.OTHERCOVERS_MTOD) AS OTHERCOVERS_MTOD,(D.OTHERCOVERS_YTOD) AS OTHERCOVERS_YTOD ,(A.TOBACCOCOVERS) AS TOBACCOCOVERS_TODAY,(D.TOBACCOCOVERS_MTOD) AS TOBACCOCOVERS_MTOD,(D.TOBACCOCOVERS_YTOD) AS TOBACCOCOVERS_YTOD FROM Fact_MisCovers A INNER JOIN DimDate B ON A.Datekey=B.DateKey INNER JOIN Dim_MisCovers C ON A.Fact_MisCovers_id=C.Dim_MisCovers_id INNER JOIN Fact_MisCovers D ON a.Fact_MisCovers_id=d.Fact_MisCovers_id) as t LEFT JOIN t as y ON DATEADD(YEAR,-1,t.ACCOUNTDATE) = y.ACCOUNTDATE order by t.ACCOUNTDATE
<sql><sql-server><tsql>
2016-08-26 06:30:29
LQ_EDIT
39,159,832
What is the cardinality ratio between class and interface?
<p>What is the cardinality ratio between class and interface?</p> <p>1.Many to one 2.one to many 3.one to one 4.many to many</p>
<java><oop><sap><abap>
2016-08-26 06:40:04
LQ_CLOSE
39,160,483
Setting differnet onclick listener to each button in recyclerview
hi im making a cheats app which have cheat codes for a game (gtav) how can i set a differen onclicklistener to each button in reyclerview for example i have a button in recycleview called copytoclip board and i want each button in the recycler view to copy a different text how can i do that? **recycler_view_list** <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:focusable="true" android:paddingLeft="16dp" android:paddingRight="16dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:clickable="true" android:background="?android:attr/selectableItemBackground" android:orientation="vertical"> <TextView android:id="@+id/title" android:textSize="16dp" android:textStyle="bold" android:layout_alignParentTop="true" android:layout_width="match_parent" android:layout_height="wrap_content" /> <TextView android:id="@+id/cheat" android:layout_below="@id/title" android:layout_width="match_parent" android:layout_height="wrap_content" /> <TextView android:id="@+id/description" android:layout_below="@+id/cheat" android:layout_gravity="bottom" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Copy" android:id="@+id/cpytocp" android:layout_gravity="top|right" /> </LinearLayout> **list** public class Cheats { private String title, cheat, description; public Cheats(){ } public Cheats( String title, String cheat, String description){ this.title = title; this.cheat = cheat; this.description = description; } public String getTitle(){ return title; } public void setTitle(String name){ this.title = name; } public String getCheat(){ return cheat; } public void setCheat(String cheat){ this.cheat = cheat; } public String getDescription(){ return description; } public void setDescription(String description) { this.description = description; } } **adapter** `public class CheatsAdapter extends` `RecyclerView.Adapter`<CheatsAdapter.MyViewHolder> `{` private List<Cheats> cheatList; public class MyViewHolder extends RecyclerView.ViewHolder{ public TextView title, cheat, description; public MyViewHolder(View view){ super(view); title = (TextView)view.findViewById(R.id.title); cheat = (TextView) view.findViewById(R.id.cheat); description = (TextView) view.findViewById(R.id.description); } } public CheatsAdapter(List<Cheats> cheatList){ this.cheatList = cheatList; } @Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType){ View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.cheat_list, parent, false); return new MyViewHolder(itemView); } @Override public void onBindViewHolder(MyViewHolder holder, int position) { Cheats cheats = cheatList.get(position); holder.title.setText(cheats.getTitle()); holder.cheat.setText(cheats.getCheat()); holder.description.setText(cheats.getDescription()); } @Override public int getItemCount(){ return cheatList.size(); } }
<java><android><android-recyclerview><onclicklistener><copy-paste>
2016-08-26 07:16:20
LQ_EDIT
39,160,562
Unable to download language data of tesseract
<p>The site <a href="http://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.eng.tar.gz" rel="nofollow">http://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.eng.tar.gz</a> is not working and is not downloading the data. Is there any site where I can download the same data in the app. The error is "Cant download language data.Please enable network access and restart the app". My manifest file has permission for internet</p>
<android><tesseract>
2016-08-26 07:20:53
LQ_CLOSE
39,160,939
Want to save values in map between braces (xyz,12) or (pqrw, ab) using regex in java
**I am able to read the content from file** (abcd, 01) (xyz,AB) (pqrst, 1E) **And i want save this content as a map as** Map mp=new HashMap<String, String>(); map.put("abcd","01"); map.put("xyz","AB"); map.put("pqrst","1E"); **Help me to get the content as Map using regex in java**
<java><regex><collections><hashmap>
2016-08-26 07:41:03
LQ_EDIT
39,161,525
How to make a custom Django api
<p>I made a simple Django website which supports user authentication(login/Logoff) and Registration I want to make a custom API which does this using REST how would i do this </p>
<python><django><rest><serialization>
2016-08-26 08:15:32
LQ_CLOSE
39,162,411
What is the way to setup Database configuration inside java bean class in spring?
<p>I want to setup my DB related configuration inside java configuration bean class. Can someone help me with simple sample of code with related annotations.</p>
<java><spring><javabeans>
2016-08-26 09:02:01
LQ_CLOSE
39,163,581
In MatLab how can i read multiple .m files from 5 different folders which are store in my main folder
I am bit new in MAT LAB and i need some help. I have **one folder containing 5 different folders** ( *each has 10 .m files*) and i want to **load or read all files in Mat-Lab**. Can you give me some hint or some helpful info how can i do that ? each **.m file contains 30000*6 matrix** and i also **need to store one column vector from each files** and save it **in one separate matrix**. i need this matrix for PCA. Any help will be appreciated.
<matlab><matrix><vector><data-analysis>
2016-08-26 09:59:18
LQ_EDIT
39,166,241
What does "|| [];" mean?
<p>What does <code>|| []</code> mean in the code below? Why might this be needed? </p> <pre><code>getPair: function() { return this.props.pair || []; }, </code></pre>
<javascript>
2016-08-26 12:21:47
LQ_CLOSE
39,166,993
Is there a floating point error in this monstrosity?
I was given the following snippet of code yesterday with the question "Why does this give 773.06..?" <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> var _ = 10, __ = 21, ___ = 38; var _______ = { _: { "yo":_/___*_+___ }}; var ___________ = [[[{"heh":{"hehe":[[[[12,71,82,91]]]][0][0][0][1]}}]]]; var ____________ = ___________[0][0][0].heh.hehe*_+__+_______._.yo/_+___; console.log(____________); <!-- end snippet --> I can't remember the expected answer, but it was at least 800. A colleague looked at it briefly and said it was due to floating-point imprecision but I think that it *should* return 773.06.. What is the correct answer?
<javascript><arithmetic-expressions><deobfuscation>
2016-08-26 13:02:19
LQ_EDIT
39,167,115
how to split words in astring in c?
I need to build a program that recives up to 30 chars from the user, and then to play with it. For example, i need to reverses the sentence and then print it, or to rotate it. I have been trying to copy the words of the sentence one by one to a matrix of [30][31], but it does not working... any ideas? and i can not use pointers... thanks for the help :) #include <stdio.h> #include <string.h> void main(){ int i=0,j=0,wrongData=0,charCounter=0,word=0,letter=0; char st[100],arr[100]={0},mat[30][31]={0}; printf("Please, enter your sentence >"); gets(st); while(i<strlen(st)){ if('A'<=st[i] && st[i]<='Z'){ charCounter++; arr[j] = st[i]; i++; j++; } else if(st[i]==' '){ arr[j] = ' '; i++; j++; while(st[i] == ' '){ i++; } } else if(st[i]=='\0'){ arr[j] = '\0'; break; } else { puts("ERROR: Incorrect data, try again."); wrongData=1; break; } if(wrongData==0){ if(charCounter>30){ puts("ERROR: Incorrect data, try again."); } } } puts(st); puts(arr); if(arr[j]==' '){ word++; } while(arr[j]!=' ' && letter<32){ strcpy(mat[word],arr); } if(arr[j]=='\0'){ mat[word][letter]=arr[j]; } puts(mat[word]); }
<c>
2016-08-26 13:09:02
LQ_EDIT
39,168,389
How to return response after async call is finished?
<p>I have some express.js app and I have a "Pay" button in my UI.</p> <p>When I click on it, I want the server to call the checkout API of Stripe and then return a response only when I get the response from the API call (card can be expired, for example).</p> <p>I know it's a bad practice, but how can my response wait till the async call finishes?</p> <p>And what's the right way to do such call in express.js?</p>
<javascript><ajax><node.js><express>
2016-08-26 14:14:16
LQ_CLOSE
39,169,764
i hadtake input as list of string but i am not able to process list 'd' to obtain required output
input from the keyboard (standard input) containing the results of several tennis matches. Each match's score is recorded on a separate line with the following format: Winner:Loser:Set-1-score,...,Set-k-score, where 2 <= k <= 5 For example, an input line of the form Williams:Muguruza:3-6,6-3,6-3 The input is terminated by a blank line. Python program that reads information about all the matches and compile the following statistics for each player: 1. Number of best-of-5 set matches won 2. Number of best-of-3 set matches won 3. Number of sets won 4. Number of games won 5. Number of sets lost 6. Number of games lost print out to the screen (standard output) a summary in decreasing order of ranking, where the ranking is according to the criteria 1-6 in that order (compare item 1, if equal compare item 2, if equal compare item 3 etc, noting that for items 5 and 6 the comparison is reversed). For instance, given the following data Djokovic:Murray:2-6,6-7,7-6,6-3,6-1 Murray:Djokovic:6-3,4-6,6-4,6-3 Djokovic:Murray:6-0,7-6,6-7,6-3 Murray:Djokovic:6-4,6-4 Djokovic:Murray:2-6,6-2,6-0 Murray:Djokovic:6-3,4-6,6-3,6-4 Djokovic:Murray:7-6,4-6,7-6,2-6,6-2 Murray:Djokovic:7-5,7-5 Williams:Muguruza:3-6,6-3,6-3 your program should print out the following Djokovic 3 1 13 142 16 143 Murray 2 2 16 143 13 142 Williams 0 1 2 15 1 12 Muguruza 0 0 1 12 2 15 **I have written code to take input as list of string** d=["","","","","","","","","",""] i=0 while(True): s=input() d[i]=s i=i+1 if s=="": break **but i am not able to process list 'd' to obtain required output**
<python><python-2.7><python-3.x>
2016-08-26 15:27:53
LQ_EDIT
39,170,612
Getting the number of lines in a text file in R
<p>I have text file I am reading into R. eack line of text is the full name of a NCDF4 file. i would like to get a count of the number of files recorded in the test file. Surley there is a little bit of code to do that simpley</p>
<r>
2016-08-26 16:15:27
LQ_CLOSE
39,171,402
Randonly Named DLL use in legitimate programming
<p>So, this is a very general sort of question. How often does one see a totally random name for a DLL in legitimate (as in, not malware) programming? Is it common practice to generate DLLs on-the-fly through CSC.exe during program installation, for example? Or should this be viewed as a good indicator of malicious activity or intent? Thanks for any insight this awesome community provides! </p>
<c#><dll>
2016-08-26 17:06:11
LQ_CLOSE
39,171,403
Cell Complete Problems
There is a colony of 8 cells arranged in a straight line where each day every cell competes with its adjacent cells(neighbour). Each day, for each cell, if its neighbours are both active or both inactive, the cell becomes inactive the next day,. otherwise itbecomes active the next day. Assumptions: The two cells on the ends have single adjacent cell, so the other adjacent cell can be assumsed to be always inactive. Even after updating the cell state. consider its pervious state for updating the state of other cells. Update the cell informationof allcells simultaneously. Write a fuction cellCompete which takes takes one 8 element array of integers cells representing the current state of 8 cells and one integer days representing te number of days to simulate. An integer value of 1 represents an active cell and value of 0 represents an inactive cell. program: int* cellCompete(int* cells,int days) { //write your code here } //function signature ends Test Case 1: INPUT: [1,0,0,0,0,1,0,0],1 EXPECTED RETURN VALUE: [0,1,0,0,1,0,1,0] Test Case 2: INPUT: [1,1,1,0,1,1,1,1,],2 EXPECTED RETURN VALUE: [0,0,0,0,0,1,1,0] This is the problem statement given above for the problem . The code which I have written for this problem is given below .But the output is coming same as the input please help . #include<iostream> using namespace std; // signature function to solve the problem int *cells(int *cells,int days) { int previous=0; for(int i=0;i<days;i++) { if(i==0) { if(cells[i+1]==0) { previous=cells[i]; cells[i]=0; } else { cells[i]=0; } if(i==days-1) { if(cells[days-2]==0) { previous=cells[days-1]; cells[days-1]=0; } else { cells[days-1]=1; } } if(previous==cells[i+1]) { previous=cells[i]; cells[i]=0; } else { previous=cells[i]; cells[i]=1; } } } return cells; } int main() { int array[]={1,0,0,0,0,1,0,0}; int *result=cells(array,8); for(int i=0;i<8;i++) cout<<result[i]; } I am not able to get the error and I think my logic is wrong Please help .Can we apply dynamic programming here If we can then how ? Please help me out
<arrays><data-structures>
2016-08-26 17:06:14
LQ_EDIT
39,171,459
"Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on."
<p>I'm trying to log some messages to a <code>RichTextBox</code> control. It logs the first 2 or 3, then throws the following error:</p> <blockquote> <p>"Cross-thread operation not valid: Control 'txtLog' accessed from a thread other than the thread it was created on."</p> </blockquote> <p>This is a very simple app that just does a single <a href="/questions/tagged/pubnub" class="post-tag" title="show questions tagged &#39;pubnub&#39;" rel="tag">pubnub</a> subscription. There was no attempt at threading. </p> <p>Per another question I found on SO, I'm using a stringbuilder:</p> <pre><code> public StringBuilder logtext = new StringBuilder(); </code></pre> <p>Then I wanted to simplify things so I could just call <code>log("this is a log message")</code>:</p> <pre><code> public void log(string txt) { logtext.Append(Environment.NewLine + txt); txtLog.Text = logtext.ToString(); } </code></pre> <p>Like I said, it logs a few strings fine but then it tries to log the following:</p> <blockquote> <p>"ConnectStatus: [1,\"Connected\",\"presence\"]"</p> </blockquote> <p>that's when it throws the error. Here is the code which is returning that value:</p> <pre><code>pubnub.Subscribe&lt;string&gt;( chnl, DisplayReturnMessage, DisplayConnectStatusMessage, DisplayErrorMessage ); public void DisplayReturnMessage(string result) { log(TimeStamp() + " Result: " + result); } </code></pre> <p>And here is a ss of the debugger if it helps:</p> <p><a href="https://i.stack.imgur.com/sKzLh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sKzLh.png" alt="enter image description here"></a></p> <p>Please ignore the fact that <code>TimeStamp()</code> literally returns "H:mm:ss.ffff" right now :)</p> <p>I was able to manually <code>log("ConnectStatus: [1,\"Connected\",\"presence\"]")</code> and it worked, so I don't think it's a string issue. The threading thing is really throwing me off.</p>
<c#>
2016-08-26 17:10:02
LQ_CLOSE
39,171,861
How to get Android phone display prnt screen?
How to get Android OS Phone display screenshot every one minute and send with email?Thanks in advance. Android
<android><screenshot>
2016-08-26 17:36:12
LQ_EDIT
39,172,131
What happens when the Kubernetes master fails?
<p>I've been trying to figure out what happens when the Kubernetes master fails in a cluster that only has one master. Do web requests still get routed to pods if this happens, or does the entire system just shut down?</p> <p>According to the OpenShift 3 documentation, which is built on top of Kubernetes, (<a href="https://docs.openshift.com/enterprise/3.2/architecture/infrastructure_components/kubernetes_infrastructure.html" rel="noreferrer">https://docs.openshift.com/enterprise/3.2/architecture/infrastructure_components/kubernetes_infrastructure.html</a>), if a master fails, nodes continue to function properly, but the system looses its ability to manage pods. Is this the same for vanilla Kubernetes?</p>
<kubernetes><openshift-origin>
2016-08-26 17:55:28
HQ
39,172,189
What is the difference between using a class and not using a class in Python
<p>So I'm working on a personal Python project as of right now and I would research a certain question I had. However, lots of the code samples looked like this:</p> <pre><code>x = 0 class foo(object): def bar(self): global x x += 1 self.y = x if __name__ == '__main__': newClass = foo() newClass.bar() print(newClass.y) </code></pre> <p>Just a loose example. Is there any advantage of doing that over this:</p> <pre><code>x = 0 y = 0 def bar(): global x global y x += 1 y = x bar() print(y) </code></pre> <p>Is the class quicker and more efficient or is it just a matter of personal preference? I tend to use the one shown above, without the class, but should I use the class instead?</p>
<python>
2016-08-26 17:59:57
LQ_CLOSE
39,172,207
Custom Cell Reorder Behavior in CollectionView
<p>I am able to reorder my collectionView like so:</p> <p><a href="https://i.stack.imgur.com/BbqAL.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/BbqAL.gif" alt="enter image description here"></a></p> <p>However, instead of all cells shifting horizontally, I would just like to swap with the following behavior (i.e. with less shuffling of cells):</p> <p><a href="https://i.stack.imgur.com/HLhAO.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/HLhAO.gif" alt="enter image description here"></a></p> <p>I have been playing with the following delegate method:</p> <pre><code>func collectionView(_ collectionView: UICollectionView, targetIndexPathForMoveFromItemAt originalIndexPath: IndexPath, toProposedIndexPath proposedIndexPath: IndexPath) -&gt; IndexPath </code></pre> <p>however, I am unsure how I can achieve custom reordering behavior. </p>
<ios><swift><uicollectionview>
2016-08-26 18:01:05
HQ
39,172,412
SQL vs Cassandra Data type mappings
<p>I am mapping some data types from SQL server to cassandra, such as int to bigint, real to float, varchar to text. Where can I get the mappings from SQL server to cassandra?</p>
<sql-server><cassandra>
2016-08-26 18:15:08
LQ_CLOSE
39,172,652
Using docker-compose to set containers timezones
<p>I have a docker-compose file running a few Dockerfiles to create my containers. I don't want to edit my Dockerfiles to set timezones because they could change at any time by members of my team and I have a docker-compose.override.yml file to make local environment changes. However, one of my containers (a Selenium based one) seems to not pull host time zone and that causes problems for me. Based on that I want to enforce timezones on all my containers. In my Dockerfiles right now I do</p> <pre><code>ENV TZ=America/Denver RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &amp;&amp; echo $TZ &gt; /etc/timezone </code></pre> <p>And everything works fine. How do I replicate the same command in docker-compose syntax?</p>
<docker><containers><docker-compose><dockerfile><devops>
2016-08-26 18:28:13
HQ
39,173,396
What is the PowerShell "Search" verb for?
<p>The MSDN page "<a href="https://msdn.microsoft.com/en-us/library/ms714428(v=vs.85).aspx">Approved Verbs for Windows PowerShell Commands</a>" says:</p> <blockquote> <p>The <strong>Find</strong> verb is used to look for an object. The <strong>Search</strong> verb is used to create a reference to a resource in a container.</p> </blockquote> <p>What does "create a reference to a resource in a container" mean? Does it mean defining a new name for an existing resource? Does it mean taking some information about a resource and converting that information into a reference? Or does it mean something else?</p> <p>What's an example of how the "Search" verb is intended to be used? And what does this action have to do with searching?</p>
<powershell>
2016-08-26 19:22:31
HQ
39,173,650
How to control other view in different activity?
I have created the customAdapter of listview . when I click the button in the listview ,I want to control the Textview outside the listview from different layout. Notice ! There are not in the same java code. here is i want to do: viewHolder.plus.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { TextView tx=(TextView) txt.findViewById(R.id.moneytext); //find the textview outside listview (now In the same java code and xml) totalmoney= (Integer.parseInt(tx.getText().toString()))+(Integer.parseInt(price[position])); //get the textview integer and add to my present number tx.setText(""+totalmoney); //post on the textview } });
<android><listview><listview-adapter>
2016-08-26 19:40:58
LQ_EDIT
39,173,714
R markdown: can I insert a pdf to the r markdown file as an image?
<p>I am trying to insert a pdf image into an r markdown file. I know it is possible to insert jpg or png images. I was just wondering if it is also possible to insert a pdf image. Thanks very much! </p>
<r>
2016-08-26 19:46:27
HQ
39,173,992
Drop all data in a pandas dataframe
<p>I would like to drop all data in a pandas dataframe, but am getting <code>TypeError: drop() takes at least 2 arguments (3 given)</code>. I essentially want a blank dataframe with just my columns headers.</p> <pre><code>import pandas as pd web_stats = {'Day': [1, 2, 3, 4, 2, 6], 'Visitors': [43, 43, 34, 23, 43, 23], 'Bounce_Rate': [3, 2, 4, 3, 5, 5]} df = pd.DataFrame(web_stats) df.drop(axis=0, inplace=True) print df </code></pre>
<python><python-2.7><pandas>
2016-08-26 20:09:10
HQ