Daily Archives

Articles indexed Tuesday September 25 2012

Page 12/18 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Shared to Dedicated or Amazon CloudFront to improve performances and keep secured?

    - by user978548
    I have a Wordpress which currently takes about 1.8s to 2.5s for the home page to completely load in my country. The page weight is about 700Ko (static content included). In order to increase performances, I'm considering two solutions: Switching to a dedicated host. Using amazon s3 cloudfront to serve static contents. My current shared hosting have servers in a neighboring country but not exactly in mine, and both amazon and the dedicated hosting have some, so that's already an advantage. So considering all that, I still have three questions remaining: Currently having a low traffic (100 unique visitors/days, but growing) will it make a huge difference between my shared hosting and a dedicated server ? Knowing that I already use a cookie-less domain to deliver static contents (but using a redirection to the same server), would using amazon s3 make a real difference ? Talking about the cons of dedicated vs amazon s3, if I choose for the dedicated server something like Ubuntu server and do daily package updates and have only port 80 open, would it be sufficient in terms of security (in comparison with my current shared hosting which manage everything for me) ?

    Read the article

  • Sharing banner on 3rd party websites, concerned about limited resources

    - by Omne
    I've made a banner for my website and I'm planning to ask my followers to share it on their website to help improve my rank. my website is hosted on GAE, the banners are less than 5kb/each and I must say that I don't want to pay for extra bandwidth I've read the Google App Engine Quotas but honestly I don't understand anything of it. Would you please tell me which table/data in this page should be of my concern? Also, do you think it's wise to host such banners, that are going to end up on 3rd party websites, on the GAE? or am I more secure if I use free online services like Google Picasa?

    Read the article

  • Bootstrap responsive CSS [migrated]

    - by savolai
    I have a four column design and I am using Bootstrap. The design renders fine in a single column in mobile devices, but in "(min-width: 768px) and (max-width: 979px)", I get four columns though there is room for only two. So clearly, the rows/spans setup would need to be rethought for those sizes. The only way I can imagine of doing this is to have semantic CSS classes used in the HTML and only including grid classes in the CSS using LESS, and then depending on screen size, including different grid classes to achieve four or two column layout. Not sure if this would work either though. Is this the way to go with, or am I thinking this too complicatedly? Thanks! Also at: https://groups.google.com/forum/#!topic/twitter-bootstrap/R5jEp0oQ_-E

    Read the article

  • Z-index preventing on hover attribute on another element [migrated]

    - by user18294
    I have two different elements (div class="") within a larger container. Let's call them div class="overlay_container" and div class="title." The div class="overlay_container" has a subclass, .image, which creates an overlay over the entire larger container on hover. The div class="title" has a z-index of 10,000 and lies over .image and therefore over the overlay. Unfortunately, when you hover over "title," the subclass overlay image underneath disappears. I know the problem is obviously that the "title" div is right over the other divs and therefore the on hover will disappear due to the z-index. But how do I fix this? How do I make it so that when you hover over the "title," the .image overlay still appears? If your answer involves jQuery, could you please tell me where to put the script (before the /head tag)? Thanks!

    Read the article

  • .htaccess and browser caching

    - by Tim
    I ran across these suggested htaccess edits. Is this a good practice? Is this something I should implement on my wordpress site?: <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType text/css "access plus 1 month" ExpiresByType application/pdf "access plus 1 month" ExpiresByType text/x-javascript "access plus 1 month" ExpiresByType application/x-shockwave-flash "access plus 1 month" ExpiresByType image/x-icon "access plus 1 year" ExpiresDefault "access plus 2 days" </IfModule>

    Read the article

  • WPF or WinForms for Game Development and learning resources?

    - by Stephen Lee Parker
    I'm looking to create a game framework for my own personal use... I want to use WPF, but I'm unsure if that is a wise choice... The games I will be writing should not require high performance graphics, so I am hoping to build on native classes... I do not want to rely on external DLL's unless I generate them myself. The games will be for young children, say 4 to 8. Most will be learning puzzles or simple shooters. The most advanced will be a platform game (non-scrolling screen like the old Atari Miner 2049er game). I think I know how to write something like the old Atari Chopper Command (partially written and my 4 year old loves it, but I used WinForms and GDI), Pac-Man, Tetris, Astroids, Space Invaders, Slider Puzzle, but I do not really know how to write the platform game... In my mind, I'm getting caught in collision detection and how to make a character jump and how to make a character walk up a slope or steps... Can anyone point me to information on developing a platform game in C#? Would you suggest WinForms or WPF for game development? I'm not looking for great graphics and speed, just entertaining game play...

    Read the article

  • Draw depth works on WP7 emulator but not device

    - by Luke
    I am making a game on a WP7 device using C# and XNA. I have a system where I always want the object the user is touching to be brought to the top, so every time it is touched I add float.Epsilon to its draw depth (I have it set so that 0 is the back and 1 is the front). On the Emulator that all works fine, but when I run it on my device the draw depths seem to be completely random. I am hoping that anybody knows a way to fix this. I have tried doing a Clean & Rebuild and uninstalling from the device but that is no luck. My call to spritebatch.Begin is: spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend); and to draw I use spriteBatch.Draw(Texture, new Rectangle((int)X, (int)Y, (int)Width, (int)Height), null, Color.White, 0, Vector2.Zero, SpriteEffects.None, mDrawDepth); Where mDrawDepth is a float value of the draw depth (likely to be a very small number; a small multiple of float.Epsilon. Any help much appreciated, thanks!

    Read the article

  • Exporting .FBX model into XNA - unorthogonal bones

    - by Sweta Dwivedi
    I create a butterfly model in 3ds max with some basic animation, however trying to export it to .FBX format I get the following exception.. any idea how i can transform the wings to be orthogonal.. One or more objects in the scene has local axes that are not perpendicular to each other (non-orthogonal). The FBX plug-in only supports orthogonal (or perpendicular) axes and will not correctly import or export any transformations that involve non-perpendicular local axes. This can create an inaccurate appearance with the affected objects: -Right.Wing I have attached a picture for reference . . .

    Read the article

  • Compressing 2D level data

    - by Lucius
    So, I'm developing a 2D, tile based game and a map maker thingy - all in Java. The problem is that recently I've been having some memory issues when about 4 maps are loaded. Each one of these maps are composed of 128x128 tiles and have 4 layers (for details and stuff). I already spent a good amount of time searching for solutions and the best thing I found was run-length enconding (RLE). It seems easy enough to use with static data, but is there a way to use it with data that is constantly changing, without a big drop in performance? In my maps, supposing I'm compressing the columns, I would have 128 rows, each with some amount of data (hopefully less than it would be without RLE). Whenever I change a tile, that whole row would have to be checked and I'm affraid that would slow down too much the production (and I'm in a somewhat tight schedule). Well, worst case scenario I work on each map individually, and save them using RLE, but it would be really nice if I could avoind that. EDIT: What I'm currently using to store the data for the tiles is a 2D array of HashMaps that use the layer as key and store the id of the tile in that position - like this: private HashMap< Integer, Integer [][]

    Read the article

  • Android accessibility focus - clicking a view changes focus to previous view

    - by benkdev
    I'm using android TalkBack to test my application for accessibility use. When I swipe to select a view and double tap, the focus returns the the view above it. Usually when swiping to a view and double clicking it, onClick is called. What am I doing wrong? <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/all_white" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/header" android:scaleType="center" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/green_bar" android:scaleType="center" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/blue_bar" android:scaleType="center" /> <EditText android:id="@+id/username" android:layout_width="325dp" android:layout_height="wrap_content" android:hint="@string/username" android:focusable="true" android:nextFocusDown="@id/password" /> <EditText android:id="@+id/password" android:inputType="textPassword" android:layout_width="325dp" android:layout_height="wrap_content" android:hint="@string/password" android:focusable="true" android:nextFocusUp="@id/username" android:nextFocusDown="@id/login" /> <Button android:id="@+id/login" android:onClick="doLogin" android:focusable="true" android:layout_width="325dp" android:layout_height="wrap_content" android:text="@string/login" android:nextFocusUp="@id/password" android:nextFocusDown="@id/create_trial_account" /> <Button android:id="@+id/create_trial_account" android:layout_width="100dip" android:layout_height="wrap_content" android:text="@string/new_user" android:onClick="createAccount" android:focusable="true" android:nextFocusUp="@id/login" /> <TextView android:id="@+id/copyright" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/copyright" /> <TextView android:id="@+id/buildNumber" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout>

    Read the article

  • "for" loop from program 7.6 from Kochan's "Programming in Objective-C"

    - by Mr_Vlasov
    "The sigma notation is shorthand for a summation. Its use here means to add the values of 1/2^i, where i varies from 1 to n. That is, add 1/2 + 1/4 + 1/8 .... If you make the value of n large enough, the sum of this series should approach 1. Let’s experiment with different values for n to see how close we get." #import "Fraction.h" int main (int argc, char *argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; Fraction *aFraction = [[Fraction alloc] init]; Fraction *sum = [[Fraction alloc] init], *sum2; int i, n, pow2; [sum setTo: 0 over: 1]; // set 1st fraction to 0 NSLog (@"Enter your value for n:"); scanf ("%i", &n); pow2 = 2; for (i = 1; i <= n; ++i) { [aFraction setTo: 1 over: pow2]; sum2 = [sum add: aFraction]; [sum release]; // release previous sum sum = sum2; pow2 *= 2; } NSLog (@"After %i iterations, the sum is %g", n, [sum convertToNum]); [aFraction release]; [sum release]; [pool drain]; return 0; } Question: Why do we have to create additional variable sum2 that we are using in the "for" loop? Why do we need "release previous sum" here and then again give it a value that we just released? : sum2 = [sum add: aFraction]; [sum release]; // release previous sum sum = sum2; Is it just for the sake of avoiding memory leakage? (method "add" initializes a variable that is stored in sum2)

    Read the article

  • What is XcvPort (used in OpenPrinter function)

    - by RiskX
    I'm usin the OpenPrinter function and the first parameter the function gets called "pPrinterName" and that's it's MSDN description: [in] Pointer to a null-terminated string that specifies the name of the printer or print server, the printer object, the XcvMonitor, or the XcvPort. For a printer object use: PrinterName,Job xxxx. For an XcvMonitor, use: ServerName,XcvMonitor MonitorName. For an XcvPort, use: ServerName,XcvPort PortName. Obviously I'm interested in the bold part. What exactly is XcvPort? I know it seems like a question of lazy person but I really couldn't find info abou this concept. If I would like to open a printer on port ABC I should write: "\\MySrever,XcvPort ABC"? Thank you for your answers!

    Read the article

  • CUDA Kernel Not Updating Global Variable

    - by Taher Khokhawala
    I am facing the following problem in a CUDA kernel. There is an array "cu_fx" in global memory. Each thread has a unique identifier jj and a local loop variable ii and a local float variable temp. Following code is not working. It is not at all changing cu_fx[jj]. At the end of loop cu_fx[jj] remains 0. ii = 0; cu_fx[jj] = 0; while(ii < l) { if(cu_y[ii] > 0) cu_fx[jj] += (cu_mu[ii]*cu_Kernel[(jj-start_row)*Kernel_w + ii]); else cu_fx[jj] -= (cu_mu[ii]*cu_Kernel[(jj-start_row)*Kernel_w + ii]); ii++; } But when I rewrite it using a temporary variable temp, it works fine. ii = 0; temp = 0; while(ii < l) { if(cu_y[ii] > 0) temp += (cu_mu[ii]*cu_Kernel[(jj-start_row)*Kernel_w + ii]); else temp -= (cu_mu[ii]*cu_Kernel[(jj-start_row)*Kernel_w + ii]); ii++; } cu_fx[jj] = temp; Can somebody please help with this problem. Thanking in advance.

    Read the article

  • JQueryMobile 1.1.1 List items not anchoring to the left

    - by user1664935
    I'm trying to create a simple thumbnail list, the code is pretty much copied off jqm docs pages. However, when I use the code below the button element of the list isn't anchored to the left of the list item and instead appears centered...Can anyone help me? It's driving me crazy! I haven't got any styles in other than what is in the jquerymobile default page template <div id="listDiv" class="ui-content" data-role="main"> <div id="listInformation" data-role="content-primary"> <ul id="swipeMeChildrenList" data-role="listview" class="ui-listview"> <li data-corners="false" data-shadow="false" data-iconshadow="true" data-wrapperels="div" data-icon="arrow-r" data-iconpos="right" data-theme="c" class="ui-btn ui-btn-icon-right ui-li-has-arrow ui-li ui-btn-up-c"> <div class="ui-btn-inner ui-li"> <div class="ui-btn-text"> <a href="index.html" class="ui-link-inherit"> <img src="images/album-p.jpg" class="ui-li-thumb"> <p>Ha</p> </a> </div> <span class="ui-icon ui-icon-arrow-r ui-icon-shadow">&nbsp;</span> </div> </li> </ul> </div> </div>

    Read the article

  • Can't get recursive function to work in Java

    - by Ahmed Salah
    I read docs about java recorsion and I thought I have understood it, but when I try to use it in the following example, it does not work as expected. I a class account, which has amount and can have forther subAccount. I would have implemented one method getSum, which has to return the summ of the amount of the account and amount of all of its subaccount. In the following code, the call of the method getSumm() should return 550, but it behaves strange. can somebody help please? public class Balance{ ArrayList<Balance> subAccounts = new ArrayList<Balance>(); String accountID = null; Double amount = null; double result=0; public double getSum(ArrayList<Balance> subAccounts){ if(subAccounts !=null && subAccounts.size()>0){ for (int i = 0; i < subAccounts.size(); i++) { result = result + getSum(subAccounts.get(i).subAccounts); } } else { return amount; } return result; } public static void main(String[] args) { Balance bs1 = new Balance(); Balance bs2 = new Balance(); Balance bs3 = new Balance(); bs1.amount=100.0; bs2.amount=150.0; bs3.amount=300.0; ArrayList<Balance> subAccounts1 = new ArrayList<Balance>(); bs2.subAccounts=null; bs3.subAccounts=null; subAccounts1.add(bs2); subAccounts1.add(bs3); bs1.subAccounts=subAccounts1; double sum= bs1.getSum(subAccounts1); System.out.println(sum); } }

    Read the article

  • Fade out when user leaves page — jquery

    - by Tom Julian Hume
    I have some simple page transitions that fade in, once the user has landed. However, I'm also trying to make the same page fade out, when the user leaves. I have found a few solutions, but they appeared to use delay(). Are there any that don't? Thanks for any help, (I'm new to this, mind!) Tom :) I am currently using this code: $(document).ready( function(){ $( 'body' ).fadeIn(2000); $('#stop').click(function (e) { e.preventDefault(); }); $('#clients').click(function() { $("#projectinfo").slideUp('slow'); $("#us").fadeOut('slow'); $("ul").fadeToggle('slow'); }); $('#information').click(function() { $("#projectinfo").slideUp('slow'); $("ul").fadeOut('slow'); $("#us").fadeToggle('slow'); }); $('#question').click(function() { $("#projectinfo").slideToggle('slow'); }); $('#question').hover(function() { $("#projectinfo").slideToggle('slow'); }); $("a").click(function(event){ event.preventDefault(); linkLocation = this.href; $("body").fadeOut(1000, redirectPage); }); function redirectPage() { });

    Read the article

  • split all text inside dom element into <span>

    - by gruber
    I would like to split all elements inside html DOM node into spans with ids, for example: lets say I have element: <div> <h1>Header</h1> <h2>header2</h2> <p class="test">this is test p</p> </div> and the result should be: <div> <h1><span id="1">Header</span></h1> <h2><span id="2">header2</span></h2> <p class="test"><span id="3">this</span><span id="4">is</span><span id="5">test</span> <span id="6">p</span></p> </div> thanks for any help it shoul also work if there are nested images for example: <div> <h1>Header</h1> <h2>header2</h2> <p class="test"><img alt="test alt" />this is test p</p> </div> and the result: <div> <h1><span id="1">Header</span></h1> <h2><span id="2">header2</span></h2> <p class="test"><img alt="test alt" /><span id="3">this</span><span id="4">is</span><span id="5">test</span> <span id="6">p</span></p> </div>

    Read the article

  • Multithreaded linked list traversal

    - by Rob Bryce
    Given a (doubly) linked list of objects (C++), I have an operation that I would like multithread, to perform on each object. The cost of the operation is not uniform for each object. The linked list is the preferred storage for this set of objects for a variety of reasons. The 1st element in each object is the pointer to the next object; the 2nd element is the previous object in the list. I have solved the problem by building an array of nodes, and applying OpenMP. This gave decent performance. I then switched to my own threading routines (based off Windows primitives) and by using InterlockedIncrement() (acting on the index into the array), I can achieve higher overall CPU utilization and faster through-put. Essentially, the threads work by "leap-frog'ing" along the elements. My next approach to optimization is to try to eliminate creating/reusing the array of elements in my linked list. However, I'd like to continue with this "leap-frog" approach and somehow use some nonexistent routine that could be called "InterlockedCompareDereference" - to atomically compare against NULL (end of list) and conditionally dereference & store, returning the dereferenced value. I don't think InterlockedCompareExchangePointer() will work since I cannot atomically dereference the pointer and call this Interlocked() method. I've done some reading and others are suggesting critical sections or spin-locks. Critical sections seem heavy-weight here. I'm tempted to try spin-locks but I thought I'd first pose the question here and ask what other people are doing. I'm not convinced that the InterlockedCompareExchangePointer() method itself could be used like a spin-lock. Then one also has to consider acquire/release/fence semantics... Ideas? Thanks!

    Read the article

  • Is there any better way to capture the screen than PIL.ImageGrab.grab()?

    - by user1474837
    I am making a screen capture program with python. My current problem is PIL.ImageGrab.grab() gives me the same output as 2 seconds later. For instance, for I think I am not being clear, in the following program, almost all the images are the same, have the same Image.tostring() value, even though I was moving my screen during the time the PIL.ImageGrab.grab loop was executing. >>> from PIL.ImageGrab import grab >>> l = [] >>> import time >>> for a in l: l.append(grab()) time.sleep(0.01) >>> for a in range(0, 30): l.append(grab()) time.sleep(0.01) >>> b = [] >>> for a in l: b.append(a.tostring()) >>> len(b) 30 >>> del l >>> last = [] >>> a = 0 >>> a = -1 >>> last = "" >>> same = -1 >>> for pic in b: if b == last: same = same + 1 last = b >>> same 28 >>> This is a problem, as all the images are the same but 1. 1 out of 30 is different. That would make for a absolutly horrable quality video. Please, tell me if there is any better quality alternative to PIL.ImageGrab.grab(). I need to capture the whole screen. Thanks!

    Read the article

  • How to log messages to a log file in a specific path from a bash script

    - by Erik
    How do you log messages to a log file in a specific path from a bash script? A naive implementation would be commands like: echo My message >>/my/custom/path/to/my_script.log But this probably has many disadvantages (no log rotation for example). I could use the 'logger' command, but it does not support logs in custom paths as far as I know and is not easy to configure if you have lots of bash scripts that could use a custom log file. In a scripting language like Ruby all this is quite easy: https://github.com/rudionrails/yell/wiki/101-the-datefile-adapter I could also make my own logger command based on this ruby library and call it from my bash scripts, but I guess there is already a well known solution that provides similar behavior for shell scripts?

    Read the article

  • Printing an Image embedded into an asp.net page. C#

    - by user1683846
    I am looking to print using C#, micorsoft visual studio, asp.net. The goal:- I am trying to print all pages in a fax document. Format:- The fax document is received as a single .tiff file with multiple pages. What needs to be done:- I need to iterate each page in the .tiff image and print them all. // This function will iterate all pages, one at a time. // protected void PrintAll_Click(object sender, EventArgs e) { // counts number of pages in the fax document.// int number = _FaxPages.Count; // for loop to iterate through each page. // for (int i = 0; i < number; i++) { string _FaxId = Page.Request["FaxId"]; _PageIndex = i; imgFax.ImageUrl = "ShowFax.ashx?n=" + _FaxId + "&f=" + _PageIndex + "&mw=750"; PrintAll.Attributes.Add("onclick", "return printing()"); } } and In my Java script I have: function printing() { window.print(); } Now the issues are: <1 The function only prints one page (the very last page of the tiff file)....and it prints the entire window and not just the embedded .tiff image in the entire web browser window. Any Ideas of how to go about just printing the .tiff embedded image instead of the entire web browser window. <2 Although my for loop iterates through the pages. The print function is only called after the loop has iterated through all the pages and stopped on the final page (say page 6/6). And then it only prints that last page (along with the rest of the contents on the browser window). This is not what I want to happen... I dont want to print all the excess material on the browser window such as buttons, links etc... I just want the embedded .tiff image from the browser window.

    Read the article

  • Neural Network Basics

    - by Stat Onetwothree
    I'm a computer science student and for this years project, I need to create and apply a Genetic Algorithm to something. I think Neural Networks would be a good thing to apply it to, but I'm having trouble understanding them. I fully understand the concepts but none of the websites out there really explain the following which is blocking my understanding: How the decision is made for how many nodes there are. What the nodes actually represent and do. What part the weights and bias actually play in classification. Could someone please shed some light on this for me? Also, I'd really appreciate it if you have any similar ideas for what I could apply a GA to. Thanks very much! :)

    Read the article

  • MSBuild / PowerShell: Copy SQL Server 2012 database to SQL Azure via BACPAC (for Continuous Integration)

    - by giveme5minutes
    I'm creating a continuous integration MSBuild script which copies a database in on-premise SQL Server 2012 to SQL Azure. Easy right? Methods After a fair bit of research I've come across the following methods: Use PowerShell to access the DAC library directly, then use the MSBuild PowerShell extension to wrap the script. This would require installing PowerShell 3 and working out how to make the MSBuild PowerShell extension work with it, as apparently MS moved the DAC API to a different namespace in the latest version of the library. PowerShell would give direct access to the API, but may require quite a bit of boilerplate. Use the sample DAC Framework Client Side Tools, which requires compiling them myself, as the downloads available from Codeplex only include the Hosted version. It would also require fixing them to use DAC 3.0 classes as they appear to currently use an earlier version of DAC. I could then call these tools from an <Exec Command="" /> in the MSBuild script. Less boilerplate and if I hit any bumps in the road I can just make changes to the source. Processes Using whichever method, the process could be either: Export from on-premise SQL Server 2012 to local BACPAC Upload BACPAC to blog storage Import BACPAC to SQL Azure via Hosted DAC Or: Export from on-premise SQL Server 2012 to local BACPAC Import BACPAC to SQL Azure via Client DAC Question All of the above seems to be quite a lot of effort for something that seems to be a standard feature... so before I start reinventing the wheel and documenting the results for all to see, is there something really obvious that I've missed here? Is there pre-written script that MS has released that I have not yet uncovered? There's an command in the GUI of SQL Server Management Studio 2012 that does EXACTLY what I'm trying to do (right click on local database, click "Tasks", click "Deploy Database to SQL Azure"). Surely if it's a few clicks in the GUI it must be a single command on the command line somewhere??

    Read the article

  • MPMoviePlayerViewController crash on iOS 6.0

    - by user1471568
    I have a trouble in my app for the iOS6.0. It works perfectly fine on iOS 5.1.1 and under, but on the 6.0 shows exc_bad_access. please let me know why. -(void)endAniView{ if (moviePlayer!=nil) { [moviePlayer.moviePlayer stop]; [self removeFromSuperview]; } } this method called when user touches a button. and below are NEW ERROR MESSAGE and I've never seen before ios 6.0 2012-09-18 16:13:22.410 KiKiSong[992:907] [MPAVController] Autoplay: Disabling autoplay for pause 2012-09-18 16:13:22.411 KiKiSong[992:907] [MPAVController] Autoplay: Disabling autoplay 2012-09-18 16:13:22.450 KiKiSong[992:907] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0) please help me. Thanks

    Read the article

  • C: copying some structs causes strange behavior

    - by Jenny B
    I have an annoying bug in the line rq->tickets[rq->usedContracts] = toAdd; if i do: rq->tickets[0] = toAdd the program crashes if i do rq->tickets[1] = toAdd; it works valgrind says ==19501== Use of uninitialised value of size 8 and ==19501== Invalid write of size 8 for this very line. What is wrong? struct TS_element { int travels; int originalTravels; int cost; char** dates; int moneyLeft; } TicketSet; struct RQ_element { int usedContracts; struct TS_element* tickets; } RabQav; TicketSetStatus tsCreate(TicketSet* t, int n, int c) { if (n <= 0) return TS_ILLEGAL_PARAMETER; TicketSet* myTicketSet = (TicketSet*) malloc(sizeof(TicketSet)); if (myTicketSet == NULL) { return TS_CANNOT_CREATE; } myTicketSet->usedTravels = 0; myTicketSet->originalTravels = n; myTicketSet->cost = c; myTicketSet->moneyLeft = n * c; char** dates = malloc(sizeof(char**)* (n)); //todo maybe c99 allows dynamic arrays? for (int i = 0; i < n; i++) { dates[i] = malloc(sizeof(char)*GOOD_LENGTH+1); if (dates[i] == NULL) { free(dates); free(t); return TS_CANNOT_CREATE; } } myTicketSet->dates = dates; *t = *myTicketSet; return TS_SUCCESS; } static void copyTicketSets(TicketSet* dest, const TicketSet* source) { dest->usedTravels = source->usedTravels; dest->originalTravels = source->originalTravels; dest->cost = source->cost; dest->moneyLeft = source->moneyLeft; for (int i = 0; i < source->originalTravels; i++) { if (NULL != source->dates[i]) { free(dest->dates[i]); dest->dates[i] = malloc(sizeof(char) * GOOD_LENGTH + 1); if (dest->dates[i] == NULL) { free(dest->dates); //todo free dates 0...i-1 free(dest); return; } strcpy(dest->dates[i], source->dates[i]); } } } RabQavStatus rqLoadTS(RabQav* rq, TicketSet t, DateTime dt) { TicketSet toAdd; TicketSetStatus res = tsCreate(&toAdd, t.originalTravels, t.cost); if (res != TS_SUCCESS) { return RQ_FAIL; } copyTicketSets(&toAdd, &t); rq->tickets[rq->usedContracts] = toAdd; rq->usedContracts++; return RQ_SUCCESS; }

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18  | Next Page >