Daily Archives

Articles indexed Saturday December 8 2012

Page 2/13 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Why the different coarse threaded screws?

    - by Luke
    I'm seeing more and more of these screws (pictured below), which are almost triangular. I find I can only put them into Power Supplies and PCI(e) cards in cases, but they will break/strip away if I put them into a hard drive or a standoff for a motherboard Notice the triangular shape on it? On the Root Access chat, I started asking, but no concrete answer yet. I don't assume it's a production flaw, as I've seen hundreds and replaced them with the "proper" round screws. It is coarse-threaded, not fine-threaded (i.e. for a DVD drive or floppy drive). What are they for, and why do we need them instead of the regular round ones?

    Read the article

  • GoogleTest C++ Framework Incompatible With XCode 4.5.2 and OSX 10.8.2

    - by eb80
    I am trying to follow the instructions mentioned here for setting up Google's C++ framework in XCode Version 4.5.2 (4G2008a). First, I got "The run destination My Mac 64-bit is not valid for Running the scheme 'gtest-framework'". The answers here Xcode 4 - The selected run destination is not valid for this action are not working for me. I was able to change the build SDK following the instructions here Unable to build using Xcode 4 - The selected run destination is not valid for this action, except this resulted in many build failures such as "Unsupported compiler '4.0' selected for architecture 'x86_64'" and "Unsupported compiler '4.0' selected for architecture 'i386'" I've changed nothing out of the box, so this is very frustrating that I cannot seem to get this to build. Details of Machine: 64bit Mac OSX 10.8.2 Build 12C3006 Details of XCode: Version 4.5.2 (4G2008a)

    Read the article

  • Map keys in Vim

    - by efficiencyIsBliss
    I want to map e to mean end of line. I tried the following mapping in my vimrc: map $ e $ is the default end of line command. However, this doesn't work. I'm wondering what the problem is. Also, I want to map Alt+right/left arrow to navigate words. So, for example, Alt+right arrow would take me to end of word. This command is currently mapped to e. Any tips on how I would go about doing this? Thanks!

    Read the article

  • Squid on an Azure VM

    - by LantisGaius
    I can't get it to work. Here's exactly what I did: Create a new Azure VM, Windows Server 2012. RDP to the new VM Download & Extract Squid for Windows (2.7.STABLE8) Rename the conf files (squid, mime & cachemgr) Add the following lines on the end of squid.conf auth_param basic program c:/squid/libexec/ncsa_auth.exe c:/squid/etc/passwd.txt auth_param basic children 5 auth_param basic realm Welcome to http://abcde.fg Squid Proxy! auth_param basic credentialsttl 12 hours auth_param basic casesensitive off acl ncsa_users proxy_auth REQUIRED http_access allow ncsa_users Use http://www.htaccesstools.com/htpasswd-generator-windows/ to create passwd.txt Test passwd.txt via c:/squid/libexec/ncsa_auth.exe c:/squid/etc/passwd.txt (success) squid -z squid -i net start squid (No errors so far). go to https://manage.windowsazure.com, Virtual Machines - myVM - Endpoints Add Endpoint: Name: Squid Protocol: TCP Public Port: 80 Private Port: 3128 That's it. Unfortunately, it doesn't work. I think I screwed something up at the endpoint? I'm not sure.. help? EDIT: I'm testing it via Firefox - Options - Advanced - Network, and the exact error is "The Proxy Server is refusing connections." I'm using my DNS as the Proxy server "abcdef.cloudapp.net" and port 80 (since that's my public endpoint).

    Read the article

  • Is it possible to add an existing Azure VM to an Azure Virtual Network?

    - by Dan Harris
    Didn't think this was directly related to programming, so thought Superuser would be better than Stack Overflow.... Is it possible to add an existing Azure VM to an Azure Virtual Network if you didn't add it to the virtual network at the time of creation? I can't see an option to change which Virtual Network the VM is connected to. Do you just have to do it at the time you create the VM, and if you don't do it then you will need to re-create the VM and delete the existing one? Example of the scenario: No VM's or Virtual Networks exist I create a VM (VM1), there is no virtual network so it isn't added to one Later I create a Virtual Network in Azure (Network1) It is possible to create another VM (VM2) and connect it to the Virtual Network (Network1), but can I connect VM1 to Network1 or must I delete VM1 and re-create it to get it connected to Network1?

    Read the article

  • Sometimes, Synaptics Touchpad Tends Cursor to Top-Right Corner

    - by John Chadwick
    This has been a reoccurring issue for me, pretty much since I've owned this laptop (an ASUS G60JX.) Sometimes, the cursor will stop working properly and instead tend toward the top right of the screen. Basically, sometime into my usage (maybe after a couple hours) the touchpad will inevitably begin to malfunction, where it has confusing patterns of pushing the mouse cursor toward the top right of the screen. In addition, certain features (like momentum) seem to quit working entirely. It makes using the cursor extremely difficult. I've been having this issue across very many drivers. Pretty much as soon as multitouch came into the mix, although I don't believe multitouch has anything to do with it. It appears that, in the state of malfunction, it doesn't matter how you touch the touchpad, but where you touch it. Certain regions do not seem to trigger the cursor to move to the top right corner. In fact, no specific region seems to, but some areas do so more often than others. The issue can be resolved temporarily by putting the computer into sleep mode and awakening it. I have found no way to recreate this success without sleeping the computer or rebooting. Disabling and re-enabling the touchpad device does not do anything to resolve the problem. This issue does not affect my WACOM tablet nor any USB mice, and can be resolved (not to my satisfactory) by uninstalling the touchpad drivers. I'm looking for a solution, or at least a workaround that doesn't require sleep mode.

    Read the article

  • How to record my voice on a Mac Mini with headphones?

    - by user718408
    I'm try to record my voice via the headphone on a Mac Mini, but it's not working. I saw on Apple's site that the Mac Mini can record voice, but it doesn't seem to be working for me. Here is a hardware overview: Model Name: Mac Mini Model Identifier: Macmini3,1 Processor Name: Intel Core 2 Duo Processor Speed: 2.26 GHz Number Of Processors: 1 Total Number Of Cores: 2 L2 Cache: 3 MB Memory: 4 GB Audio: Make: Intel High Definition Audio Audio ID: 65 Headphone connection: Combination Output Line Input connection: Combination Input Speaker connection: Internal S/PDIF Optical Digital Audio Output connection: Combination Output S/PDIF Optical Digital Audio Input connection: Combination Input Any ideas how I can successfully get recording working?

    Read the article

  • SQL SERVER – Weekly Series – Memory Lane – #006

    - by pinaldave
    Here is the list of selected articles of SQLAuthority.com across all these years. Instead of just listing all the articles I have selected a few of my most favorite articles and have listed them here with additional notes below it. Let me know which one of the following is your favorite article from memory lane. 2006 This was my very first year of blogging so I was every day learning something new. As I have said many times, that blogging was never an intention. I had really not understood what exactly I am working on or beginning when I was beginning blogging in 2006. I had never knew that my life was going to change forever, once I started blogging. When I look back all of this year, I am happy that we are here together. 2007 IT Outsourcing to India – Top 10 Reasons Companies Outsource Outsourcing is about trust, collaboration and success. Helping other countries in need has been always the course of mankind, outsourcing is nothing different then that. With information technology and process improvements increasing the complexity, costs and skills required to accomplish routine tasks as well as challenging complex tasks, companies are outsourcing such tasks to providers who have the expertise to perform them at lower costs , with greater value and quality outcome. UDF – Remove Duplicate Chars From String This was a very interesting function I wrote in my early career. I am still using this function when I have to remove duplicate chars from strings. I have yet to come across a scenario where it does not work so I keep on using it till today. Please leave a comment if there is any better solution to this problem. FIX : Error : 3702 Cannot drop database because it is currently in use This is a very generic error when DROP Database is command is executed and the database is not dropped. The common mistake user is kept the connection open with this database and trying to drop the database. The database cannot be dropped if there is any other connection open along with it. It is always a good idea to take database in single user mode before dropping it. Here is the quick tutorial regarding how to bring the database in single user mode: Using T-SQL | Using SSMS. 2008 Install SQL Server 2008 – How to Upgrade to SQL Server 2008 – Installation Tutorial This was indeed one of the most popular articles in SQL Server 2008. Lots of people wanted to learn how to install SQL SErver 2008 but they were facing various issues while installation. I build this tutorial which becomes reference points for many. Default Collation of SQL Server 2008 What is the collation of SQL Server 2008 default installations? I often see this question confusing many experienced developers as well. Well the answer is in following image. Ahmedabad SQL Server User Group Meeting – November 2008 User group meetings are fun, now a days I am going to User Group meetings every week but there was a case when I have been just a beginner on this subject. The bug of the community was caught on me years ago when I started to present in Ahmedabad and Gandhinagar SQ LServer User Groups. 2009 Validate an XML document in TSQL using XSD My friend Jacob Sebastian wrote an excellent article on the subject XML and XSD. Because of the ‘eXtensible’ nature of XML (eXtensible Markup Language), often there is a requirement to restrict and validate the content of an XML document to a pre-defined structure and values. XSD (XML Schema Definition Language) is the W3C recommended language for describing and validating XML documents. SQL Server implements XSD as XML Schema Collections. Star Join Query Optimization At present, when queries are sent to very large databases, millions of rows are returned. Also the users have to go through extended query response times when joining multiple tables are involved with such queries. ‘Star Join Query Optimization’ is a new feature of SQL Server 2008 Enterprise Edition. This mechanism uses bitmap filtering for improving the performance of some types of queries by the effective retrieval of rows from fact tables. 2010 These puzzles are very interesting and intriguing – there was lots of interest on this subject. If you have free time this weekend. You may want to try them out. SQL SERVER – Challenge – Puzzle – Usage of FAST Hint (Solution)  SQL SERVER – Puzzle – Challenge – Error While Converting Money to Decimal (Solution)  SQL SERVER – Challenge – Puzzle – Why does RIGHT JOIN Exists (Open)  Additionally, I had great fun presenting SQL Server Performance Tuning seminar at fantastic locations in Hyderabad. Installing AdventeWorks Database This has been the most popular request I have received on my blog. Here is the quick video about how one can install AdventureWorks. 2011 Effect of SET NOCOUNT on @@ROWCOUNT There was an interesting incident once while I was presenting a session. I wrote a code and suddenly 10 hands went up in the air.  This was a bit surprise to me as I do not know why they all got alerted. I assumed that there should be something wrong with either project, screen or my display. However the real reason was very interesting – I suggest you read the complete blog post to understand this interesting scenario. Error: Deleting Offline Database and Creating the Same Name This is very interesting because once a user deletes the offline database the MDF and LDF file still exists and if the user attempts to create a new database with the same name it will give error. I found this very interesting and the blog explains the concept very quickly. Have you ever faced a similar situation? Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: Memory Lane, PostADay, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • OpenJDK ? Nashorn ?????????

    - by Homma
    ???? Nashorn ? OpenJDK ??????????????????Nashorn ? OpenJDK ????????????????????????????????????????????????????????????????????????????????? ????? ??? jlaskey ??? Nashorn Blog ????????????? https://blogs.oracle.com/nashorn/entry/the_vote_is_in ???????? ?? ?????????????????????????????? Jim Laskey ???????????? Nashorn ??????????? [1] ? ????????? ??: 20 ??: 0 ??: 0 ??????????????????????????????? ????????????????????????????????? -John Coomes [1] http://mail.openjdk.java.net/pipermail/announce/2012-November/000139.html

    Read the article

  • They Got What They Came For

    - by Oracle OpenWorld Blog Team
    At this week's Oracle OpenWorld Latin America, over 11,000 attendees got what they came for. Interesting and absorbing keynotes. Educational technical sessions. Innovative demos and exhibits. Inspiring hands-on labs. And many, many opportunities to network with and build their community of peers. If you weren't able to attend the conference, or if you did attend but want to review some of the sessions or share them with colleagues, session PDFs will be posted soon, so be sure to check back. 

    Read the article

  • Square game map rendered as sphere with OpenGL

    - by Roflha
    Okay so I have been trying to find a good way to do this for a while now and so far I have nothing. For a hobby project of mine I have created a finite voxel world (similar to minecraft), but as I said, mine is finite. When you reach the edge of it, you are sent to the other side. That is all working fine along with rendering the far side of the map, but I want to be able to render this grid as a sphere. Looking down from above, the world is a square. I basically want to be able to represent a portion of that square as a sphere, as if you were looking at a planet. Right now I am experimenting with taking a circular section of the map, and rendering that, but it look to flat (no curvature around the edges). My question then, is what would be the best way to add some curvature to the edges of a 2d circle to make it look like a hemisphere. However, I am not overly attached to this implementation so if somebody has some other idea for representing the square as a planet, I am all ears.

    Read the article

  • SFX Played Once per Collision or Hit

    - by David Dimalanta
    I have a question about using Box2D (engine for LibGDX used to make realistic physics). I observed on the code that I've made for the physics here below: @Override public boolean touchUp(int screenX, int screenY, int pointer, int button) { // TODO Touch Up Event if(is_Next_Fruit_Touched) { BodyEditorLoader Fruit_Loader = new BodyEditorLoader(Gdx.files.internal("Shape_Physics/Fruity Physics.json")); Fruit_BD.type = BodyType.DynamicBody; Fruit_BD.position.set(x, y); FixtureDef Fruit_FD = new FixtureDef(); // --> Allows you to make the object's physics. Fruit_FD.density = 1.0f; Fruit_FD.friction = 0.7f; Fruit_FD.restitution = 0.2f; MassData mass = new MassData(); mass.mass = 5f; Fruit_Body[n] = world.createBody(Fruit_BD); Fruit_Body[n].setActive(true); // --> Let your dragon fall. Fruit_Body[n].setMassData(mass); Fruit_Body[n].setGravityScale(1.0f); System.out.println("Eggs... " + n); Fruit_Loader.attachFixture(Fruit_Body[n], Body, Fruit_FD, Fruit_IMG.getWidth()); Fruit_Origin = Fruit_Loader.getOrigin(Body, Fruit_IMG.getWidth()).cpy(); is_Next_Fruit_Touched = false; up = y; Gdx.app.log("Initial Y-coordinate", "Y at " + up); //Once it's touched, the next fruit will set to drag. if(n < 50) { n++; }else{ System.exit(0); } } return true; } Now, I'm thinking which part o line should I implement for the sound effects. My objectives to make SFX played once for every collision (Or should I say "SFX played once per collision"?) on the following: SFX played once if they hit on the objects of its kind. (e.g. apple vs. apple) SFX played once on a different sound when it hit on the ground. (e.g. apple land on the mud) Take note that I'm using Box2D for the Java programming version thanks to LibGDX via Box2D engine and I edited the physics body using Physics Body Editor before I implement it to code. I tried to check every available methods for body, fixture definition, or body definition to code for the SFX when hit but it seems only for the gravity and weight. Is there possibly available on the document for SFX played when collision happens if possible?

    Read the article

  • How to shade a texture two different colors?

    - by Venesectrix
    To give an example of what I'm asking about, I'll use Saints Row 3 since I've been playing that lately. In that game you can customize your looks and your car's appearance a lot. Your coat can have a primary color and a trim color. Your car can have a primary color and a stripe color, etc. Is there just a single coat texture that is being shaded two different colors somehow or are they overlaying a transparent second texture for the trim/stripes that gets shaded differently? If it's just one texture I'd like to know how it's done. If it's two different textures it seems like it's a waste of space. The second texture would be the same size as the first one but mostly transparent if you just wanted to lay it on top of the first one. Or are they just carefully positioning a second, smaller texture so that it aligns properly with the first one?

    Read the article

  • Designing for visually impaired gamers

    - by Aku
    Globally the number of people of all ages visually impaired is estimated to be 285 million, of whom 39 million are blind. — World Health Organisation, 2010. (That's 4.2% and 0.6% of the world population.) Most videogames put a strong emphasis on visuals in their content delivery. Visually impaired gamers are largely left out. How do I design a game to be accessible to visually impaired gamers?

    Read the article

  • What's the best way to move cars along roads

    - by David Thielen
    I am implementing car movement game (sort-of like Locomotion). So 60 times a second I have to advance the movement of each car. The problem is I have to look ahead to see if there is a slower car, stop sign, or red light ahead. And then slow down appropiately. I also want to have the cars take time to go from stopped to full speed and again to slow down. I'm not implementing full-blown physics, but just a tick by tick speed up/slow down as that provides most of the realism to match what people expect to see. The best I've come up with is to walk out the full distance the car would travel of it was slowing to a stop and see if anywhere along that path it needed to slow down or stop. And then move it forward appropiately. I am moving the cars 60 times a second so I need this to be fast. And walking out that whole path each tick strikes me as processor intensive. What's the best way to do this?

    Read the article

  • Not getting the right expected output for my Mysql Query?

    - by user1878107
    i've 4 tables as shown below doctors id name ------------ 1 Mathew 2 Praveen 3 Rosie 4 Arjun 5 Denis doctors_appointments id doctors_id patient_name contact date status -------------------------------------------------------------------------------------- 1 5 Nidhin 9876543210 2012-12-10 15:39:41 Registered 2 5 Sunny 9876543210 2012-12-18 15:39:48 Registered 3 5 Mani 9876543210 2012-12-12 15:39:57 Registered 4 2 John 9876543210 2012-12-24 15:40:09 Registered 5 4 Raj 9876543210 2012-12-05 15:41:57 Registered 6 3 Samuel 9876543210 2012-12-14 15:41:33 Registered 7 2 Louis 9876543210 2012-12-24 15:40:23 Registered 8 1 Federick 9876543210 2012-12-28 15:41:05 Registered 9 2 Sam 9876543210 2012-12-12 15:40:38 Registered 10 4 Sita 9876543210 2012-12-12 15:41:00 Registered doctors_dutyplan id doctor_id weeks time no_of_patients ------------------------------------------------------------------ 1 1 3,6,7 9:00am-1:00pm 10 2 2 3,4,5 1:00pm-4:00pm 7 3 3 3,6,7 10:00am-2:00pm 10 4 4 3,4,5,6 8:30am-12:30pm 12 5 5 3,4,5,6,7 9:00am-4:00pm 30 emp_leave id empid leavedate -------------------------------- 1 2 2012-12-05 14:42:36 2 2 2012-12-03 14:42:59 3 3 2012-12-03 14:43:06 4 3 2012-12-06 14:43:14 5 5 2012-12-04 14:43:24 My task is to find all the days in a month in which the doctor is available excluding the leave dates. My query what is wrote is given below: SELECT DATE_ADD( '2012-12-01', INTERVAL ROW DAY ) AS Date, ROW +1 AS DayOfMonth FROM ( SELECT @row := @row +1 AS ROW FROM ( SELECT 0 UNION ALL SELECT 1 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 )t1, ( SELECT 0 UNION ALL SELECT 1 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 )t2, ( SELECT @row := -1 )t3 LIMIT 31 )b WHERE DATE_ADD( '2012-12-01', INTERVAL ROW DAY ) BETWEEN '2012-12-01' AND '2012-12-31' AND DAYOFWEEK( DATE_ADD( '2012-12-01', INTERVAL ROW DAY ) ) =2 AND DATE_ADD( '2012-12-01', INTERVAL ROW DAY ) NOT IN ( SELECT DATE_FORMAT( l.leavedate, '%Y-%m-%d' ) AS date FROM doctors_dutyplan d LEFT JOIN emp_leave AS l ON d.doctor_id = l.empid WHERE doctor_id =2 ) This works fine for all doctors who took any leave in a particular day in a month (here in the example it is Decemeber 2012). and the result is shown below: Date DayOfMonth ----------------------- 2012-12-10 10 2012-12-17 17 2012-12-24 24 2012-12-31 31 But on the other hand for the doctors who did'nt took any leave , for that my query is showing empty table, example for the doctor Mathew whose id is 1, my query returns an empty result can anyone please tell a solution for this problem. Thanks in advance.

    Read the article

  • How would I combine these two codes, PHP and HTML?

    - by user1887109
    This is what I have currently: <html> <body oncontextmenu="return false;" bgcolor="5385ab"> <p align=center><a href="test.php"><img src="image.png"/></a></p> </body> </html> I need the <body> part and to combine this PHP geo-redirect code with "test.php" also including the "image.png" Here is the PHP code: <?php require_once("geoip.inc"); $gi = geoip_open("/var/lib/GeoIP/GeoIP.dat",GEOIP_STANDARD); $country_code = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']); geoip_close($gi); if($country_code == 'FR') { header('Location: http://www.test.php'); } else { header('Location: http://www.yahoo.com/'); } ?> I'm not familiar with PHP so I have no idea how to even go about testing these two together. Hope you can help! Thank you.

    Read the article

  • JAVA BubbleSort Output Plotting

    - by John Smith
    I'm not sure how to plot the output I get with my run time results for BubbleSort. Here's the thing: I've written a working BubbleSort algorithm that does exactly as it should. But I wish to plot the output, to show the following: Best Case, Worst Case, Average Case ... How would I go about plotting it on a graph? Here is the code: public class BubbleSort { static double bestTime = 10000000, worstTime = 0; public static void main(String[] args) { int BubArray[] = new int[]{13981, 6793, 2662, 10986, 733, ... #1000 integers}; System.out.println("Unsorted List Before Bubble Sort"); for(int a = 0; a < BubArray.length; a++){ System.out.print(BubArray[a] + " "); } System.out.println("\n Bubble Sort Execution ..."); for(int i=0; i<10000;i++) { bubbleSortTimeTaken(BubArray, i); } int itrs = bubbleSort(BubArray); System.out.println(""); System.out.println("Array After Bubble Sort"); System.out.println("Moves Taken for Sort : " + itrs + " Moves."); System.out.println("BestTime: " + bestTime + " WorstTime: " + worstTime); System.out.print("Sorted Array: \n"); for(int a = 0; a < BubArray.length; a++){ System.out.print(BubArray[a] + " "); } } private static int bubbleSort(int[] BubArray) { int z = BubArray.length; int temp = 0; int itrs = 0; for(int a = 0; a < z; a++){ for(int x=1; x < (z-a); x++){ if(BubArray[x-1] > BubArray[x]){ temp = BubArray[x-1]; BubArray[x-1] = BubArray[x]; BubArray[x] = temp; } itrs++; } } return itrs; } public static void bubbleSortTimeTaken(int[] BubArray, int n) { long startTime = System.nanoTime(); bubbleSort(BubArray); double timeTaken = (System.nanoTime() - startTime)/1000000d; if (timeTaken > 0) { worstTime = timeTaken; } else if (timeTaken < bestTime) { bestTime = timeTaken; } System.out.println(n + "," + timeTaken); } } The output are as the following ( execution number, time (nano/10^6): Unsorted List Before Bubble Sort 13981 6793 2662 .... #1000 integers Bubble Sort Execution ... 0, 18.319891 1, 4.728978 2, 3.670697 3, 3.648922 4, 4.161576 5, 3.824369 .... 9995, 4.331423 9996, 3.692473 9997, 3.709893 9998, 6.16055 9999, 4.32209 Array After Bubble Sort Moves Taken for Sort : 541320 Moves. BestTime: 1.0E7 WorstTime: 4.32209 Sorted Array: 10 11 17 24 57 60 83 128 141 145 ... #1000 integers I am looking for graphs to represent Average, Best and Worst case based on the output but my current graphs don't look correct. Any help would be appreciated, thanks.

    Read the article

  • C program - Seg fault, cause of

    - by resonant_fractal
    Running this gives me a seg fault (gcc filename.c -lm), when i enter 6 (int) as a value. Please help me get my head around this. The intended functionality has not yet been implemented, but I need to know why I'm headed into seg faults already. Thanks! #include<stdio.h> #include<math.h> int main (void) { int l = 5; int n, i, tmp, index; char * s[] = {"Sheldon", "Leonard", "Penny", "Raj", "Howard"}; scanf("%d", &n); //Solve Sigma(Ai*2^(i-1)) = (n - k)/l if (n/l <= 1) printf("%s\n", s[n-1]); else { tmp = n; for (i = 1;;) { tmp = tmp - (l * pow(2,i-1)); if (tmp <= 5) { // printf("Breaking\n"); break; } ++i; } printf("Last index = %d\n", i); // ***NOTE*** //Value lies in next array, therefore ++i; index = tmp + pow(2, n-1); printf("%d\n", index); } return 0; }

    Read the article

  • objective C underscore property vs self

    - by user1216838
    I'm was playing around with the standard sample split view that gets created when you select a split view application in Xcode, and after adding a few fields i needed to add a few fields to display them in the detail view. and something interesting happend in the original sample, the master view sets a "detailItem" property in the detail view and the detail view displays it. - (void)setDetailItem:(id) newDetailItem { if (_detailItem != newDetailItem) { _detailItem = newDetailItem; // Update the view. [self configureView]; } i understand what that does and all, so while i was playing around with it. i thought it would be the same if instead of _detailItem i used self.detailItem, since it's a property of the class. however, when i used self.detailItem != newDetailItem i actually got stuck in a loop where this method is constantly called and i cant do anything else in the simulator. my question is, whats the actual difference between the underscore variables(ivar?) and the properties? i read some posts here it seems to be just some objective C convention, but it actually made some difference.

    Read the article

  • Using pointers to adjust global objects in objective-c

    - by Rob
    Ok, so I am working with two sets of data that are extremely similar, and at the same time, these data sets are both global NSMutableArrays within the object. data_set_one = [[NSMutableArray alloc] init]; data_set_two = [[NSMutableArray alloc] init]; Two new NSMutableArrays are loaded, which need to be added to the old, existing data. These Arrays are also global. xml_dataset_one = [[NSMutableArray alloc] init]; xml_dataset_two = [[NSMutableArray alloc] init]; To reduce code duplication (and because these data sets are so similar) I wrote a void method within the class to handle the data combination process for both Arrays: -(void)constructData:(NSMutableArray *)data fromDownloadArray:(NSMutableArray *)down withMatchSelector:(NSString *)sel_str Now, I have a decent understanding of object oriented programming, so I was thinking that if I were to invoke the method with the global Arrays in the data like so... [self constructData:data_set_one fromDownloadArray:xml_dataset_one withMatchSelector:@"id"]; Then the global NSMutableArrays (data_set_one) would reflect the changes that happen to "array" within the method. Sadly, this is not the case, data_set_one doesn't reflect the changes (ex: new objects within the Array) outside of the method. Here is a code snippet of the problem // data_set_one is empty // xml_dataset_one has a few objects [constructData:(NSMutableArray *)data_set_one fromDownloadArray:(NSMutableArray *)xml_dataset_one withMatchSelector:(NSString *)@"id"]; // data_set_one should now be xml_dataset_one, but when echoed to screen, it appears to remain empty And here is the gist of the code for the method, any help is appreciated. -(void)constructData:(NSMutableArray *)data fromDownloadArray:(NSMutableArray *)down withMatchSelector:(NSString *)sel_str { if ([data count] == 0) { data = down; // set data equal to downloaded data } else if ([down count] == 0) { // download yields no results, do nothing } else { // combine the two arrays here } } This project is not ARC enabled. Thanks for the help guys! Rob

    Read the article

  • Haskell search an element on a List

    - by user1887556
    I want a function that changes (1 to 0) on a list, when number of 1's isn't even. I have done these functions: 1) Sees if the lines in a list are even or not: parityLine :: [[Int]] -> [Bool] parityLine [] =[] parityLine (x:xs) |sum(x) `mod` 2 == 0 = True:(parityLine(xs)) |otherwise = False:(parityLine(xs)) 2) Sum the corresponding elements on a list of lists: sumPositions :: [[Int]] -> [Int] sumPositions [] = [] sumPositions (x:xs) = foldl (zipWith (+)) (repeat 0) (x:xs) 3) Sees if the columns in a list are even or not: parityColumn :: [Int] -> [Bool] parityColumn [] = [] parityColumn (x:xs) |head(x:xs) `mod` 2 == 0 = True:parityColumn(xs) |otherwise = False:parityColumn(xs) 4) Does the operation or with two boolean lists: bol :: [Bool] -> [Bool] -> [[Bool]] bol [] _ = [] bol (x:xs) (y:ys)= (map (||x) (y:ys)):(bol xs (y:ys)) 5) Correct List: correct :: [[Int]] -> [[Bool]] correct [] = [] correct (x:xs)=(bol(parityLine (x:xs))(parityColumn(sumPositions(x:xs)))) So what I want is to alter the function correct to [[Int]]-[[Int]] that does this: My Int list(x:xs) With my correct function applied [[0,0,1,1], [[True,True,False,True], [1,0,1,1], [True,True,True,True], [0,1,0,1], [True,True,True,True] [1,1,1,1]] [True,True,True,True]] Now I can see that in the first line third column, False, so I have to correct that number 1 to have a number of 1's even. Result I want that function correct does: [[0,0,0,1], [1,0,1,1], [0,1,0,1], [1,1,1,1]] Thanks.

    Read the article

  • Making only the outer vector in vector<vector<int>> fixed

    - by Dennis Ritchie
    I want to create a vector<vector<int>> where the outer vector is fixed (always containing the same vectors), but the inner vectors can be changed. For example: int n = 2; //decided at runtime assert(n>0); vector<vector<int>> outer(n); //outer vector contains n empty vectors outer.push_back(vector<int>()); //modifying outer vector - this should be error auto outer_it = outer.begin(); (*outer_it).push_back(3); //modifying inner vector. should work (which it does). I tried doing simply const vector<vector<int>>, but that makes even the inner vectors const. Is my only option to create my own custom FixedVectors class, or are there better ways out there to do this?

    Read the article

  • Scala: recursive search avoiding cycles

    - by user1826663
    How can I write a recursive search that I avoid cycles. My class is this: class Component(var name: String, var number: Int, var subComponent: Set[Component]) Now I need a way to check whether a component is contained within its subcomponent or between subcomponent of its subcomponent and so on.Avoiding possible cycles caused by other Component. My method of recursive search must have the following signature, where subC is the Set [component] of comp. def content (comp: Component, subC: Set[Component]) : Boolean = { } Thanks for the help.

    Read the article

  • show the list of usernames inside a div

    - by Mr_Green
    I am new to jQuery. In my project, I created one Class User in which the code is as shown below: static ConcurrentDictionary<string, User> _users = new ConcurrentDictionary<string, User>(); // // some function to add values to _users list // public List<User> GetConnectedUsers() { return _users.Values.ToList(); } I want to show this list of values in div #showUsernames. How to do this by using jQuery? I tried the below which is not showing anything /*display your contacts*/ $('#showUsernames').append(function(){ chat.server.getConnectedUsers(); }); where chat.server(signalr) calls the server-side code(Chat class).. I think the solution has nothing to do with signalr. If the above description is not enough then you can go through my code here

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >