Daily Archives

Articles indexed Wednesday May 5 2010

Page 29/119 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >

  • Length of text that can just fit into one screen without scrolling

    - by KailZhang
    I find some iphone book apps have such feature: One screen one page of text without scrolling. The text can just fit into the whole screen with linebreaks and indentations. I'm curious of how to implement this. How could I decide the length of text that just fit into the screen. And also, given the whole text, I can calculate out the number of pages. If this is not possible to be done on iPhone(runtime?), then is it possible to process the text before storing it in app? I mean I calculate how many pages I need(how to split the raw text), probably how many lines per page.

    Read the article

  • Font for mac osx that is as readable and compact as the default xterm (X11) font.

    - by dreeves
    The font used in xterms is extremely compact yet readable. What font is that? The closest I've found that I can use in other other applications is DejaVu Sans Mono or Bitstream Vera Sans Mono. Those are as compact as xterms vertically but take up more space horizontally. I'd really like to switch from xterms to Terminal.app and this is the one thing holding me back. (I also think that font would be much better for emacs, xcode, or whatever editor.) ADDED: In Terminal.app you can adjust the character and line spacing for any font. Is this possible in other applications? I'm open to any other font that is as compact and readable as the xterm font. Dina looks really nice but it doesn't seem to work for Mac.

    Read the article

  • Django urls on json request

    - by Hulk
    When making a django request through json as, var info=id + "##" +name+"##" $.post("/supervise/activity/" + info ,[] , function Handler(data,arr) { } In urls.py (r'^activity/(?P<info>\d+)/$, 'activity'), In views, def activity(request,info): print info The request does not go through.info is a string.How can this be resolved Thanks..

    Read the article

  • semicolon in C++?

    - by SysAdmin
    Here is the question Is "missing semicolon" error really required? why not treat it as a warning? Why I am asking this stupid question? When I compile this code int f = 1 int h=2; the compiler intelligently tells me that where I am missing it. but to me its like - "If you know it, just treat it as if its there and go ahead. (Later I can fix the warning) int sdf = 1,df=2; sdf=1 df =2 even for this code it behaves the same. i.e even if multiple statements (without ;) are in the same line, the compiler knows. So, why not just remove this requirement? why not behave like python,vb etc

    Read the article

  • command design pattern usage

    - by sagie
    Hi. I've read 3 descriptions of the command design pattern: wikipedia, dofactory and source making. In all of them, the UML shows a relation between the client to the receiver & the concrete command, but no relation to the invoker. But in all 3 examples the client is the one that initiates the invoker and call its Execute method. I think that should be a relation to the invoker as well. Am I missing somthing in here? Maybe even a basic UML knowladge?

    Read the article

  • Creating tabs for calling activities

    - by Rahul Varma
    Hi , I have some activities in my project like, Alerts,HomePage , Calculator etc. What i want to accomplish is to create tabs for all these activities and insert images for these. When we touch the tab the corresponding activity must load. I have done it using the menu options. But i must accomplish this using tabs. The tabs must also be at the bottom of the page... Something like this... Can anyone guide through the process...??? Should i create another class Tabs.java and tabs.xml or should i write tab host for each activity...??? I have tried to find it in google and also in stackoverflowbut in vague. Plz give a solution...

    Read the article

  • nginx_http_push_module and databases

    - by rui7905
    i am a newbie of nginx , and i am using nginx as a comet server by nginx_http_push_module i have two question: 1,how can i save the messages which recieved by nginx_http_push_module into databases ? 2,how can i get listeners list of a channel ? thanks~

    Read the article

  • Code Contracts: Hiding ContractException

    - by DigiMortal
    It’s time to move on and improve my randomizer I wrote for an example of static checking of code contracts. In this posting I will modify contracts and give some explanations about pre-conditions and post-conditions. Also I will show you how to avoid ContractExceptions and how to replace them with your own exceptions. As a first thing let’s take a look at my randomizer. public class Randomizer {     public static int GetRandomFromRange(int min, int max)     {         var rnd = new Random();         return rnd.Next(min, max);     }       public static int GetRandomFromRangeContracted(int min, int max)     {         Contract.Requires(min < max, "Min must be less than max");           var rnd = new Random();         return rnd.Next(min, max);     } } We have some problems here. We need contract for method output and we also need some better exception handling mechanism. As ContractException as type is hidden from us we have to switch from ContractException to some other Exception type that we can catch. Adding post-condition Pre-conditions are contracts for method’s input interface. Read it as follows: pre-conditions make sure that all conditions for method’s successful run are met. Post-conditions are contracts for output interface of method. So, post-conditions are for output arguments and return value. My code misses the post-condition that checks return value. Return value in this case must be greater or equal to minimum value and less or equal to maximum value. To make sure that method can run only the correct value I added call to Contract.Ensures() method. public static int GetRandomFromRangeContracted(int min, int max) {     Contract.Requires(min < max, "Min must be less than max");       Contract.Ensures(         Contract.Result<int>() >= min &&         Contract.Result<int>() <= max,         "Return value is out of range"     );       var rnd = new Random();     return rnd.Next(min, max); } I think that the line I added does not need any further comments. Avoiding ContractException for input interface ContractException lives in hidden namespace and we cannot see it at design time. But it is common exception type for all contract exceptions that we do not switch over to some other type. The case of Contract.Requires() method is simple: we can tell it what kind of exception we need if something goes wrong with contract it ensures. public static int GetRandomFromRangeContracted(int min, int max) {     Contract.Requires<ArgumentOutOfRangeException>(         min < max,         "Min must be less than max"     );       Contract.Ensures(         Contract.Result<int>() >= min &&         Contract.Result<int>() <= max,         "Return value is out of range"     );       var rnd = new Random();     return rnd.Next(min, max); } Now, if we violate the input interface contract giving min value that is not less than max value we get ArgumentOutOfRangeException. Avoiding ContractException for output interface Output interface is more complex to control. We cannot give exception type there and hope that this type of exception will be thrown if something goes wrong. Instead we have to use delegate that gathers information about problem and throws the exception we expect to be thrown. From documentation you can find the following example about the delegate I mentioned. Contract.ContractFailed += (sender, e) => {     e.SetHandled();     e.SetUnwind(); // cause code to abort after event     Assert.Fail(e.FailureKind.ToString() + ":" + e.DebugMessage); }; We can use this delegate to throw the Exception. Let’s move the code to separate method too. Here is our method that uses now ContractException hiding. public static int GetRandomFromRangeContracted(int min, int max) {     Contract.Requires(min < max, "Min must be less than max");       Contract.Ensures(         Contract.Result<int>() >= min &&         Contract.Result<int>() <= max,         "Return value is out of range"     );     Contract.ContractFailed += Contract_ContractFailed;       var rnd = new Random();     return rnd.Next(min, max)+1000; } And here is the delegate that creates exception. public static void Contract_ContractFailed(object sender,     ContractFailedEventArgs e) {     e.SetHandled();     e.SetUnwind();       throw new Exception(e.FailureKind.ToString() + ":" + e.Message); } Basically we can do in this delegate whatever we like to do with output interface errors. We can even introduce our own contract exception type. As you can see later then ContractFailed event is very useful at unit testing.

    Read the article

  • mysqld causes high CPU load

    - by Radu
    My mysqld goes to use 99.9% of CPU for variable time (between 2 - 20 minutes), and then goes back to normal 0.1% - 5%. Checked processlist: all is normal, 1 to 20 inserts or updates that last 2 to 5 sec, and about 20 process that are in Sleep Mode (maybe because the scripts don't close the mysql connection, but are they are closed in about 5 - 10 secs, I didn't make the scripts :P but the server was running fine the last 2 years, since is was made): | 15375 | root | localhost | stoc | Query | 0 | NULL | show processlist | | 79480 | pppoe | localhost | pppoe | Sleep | 4 | NULL | NULL | | 79481 | pppoe | localhost | pppoe | Sleep | 4 | NULL | NULL | | 79482 | pppoe | localhost | pppoe | Sleep | 4 | NULL | NULL | | 79483 | pppoe | localhost | pppoe | Query | 0 | init | UPDATE acc SET InputOctets="0", OutputOctets="0", InputPackets="unknown", OutputPackets="User | | 79484 | pppoe | localhost | pppoe | Sleep | 5 | NULL | NULL | | 79485 | pppoe | localhost | pppoe | Sleep | 5 | NULL | NULL | | 79486 | pppoe | localhost | pppoe | Sleep | 5 | NULL | NULL Checked raid, seemns OK: [root@db2]# cat /proc/mdstat Personalities : [raid5] [raid4] [raid1] md0 : active raid1 sdd1[3] sdc1[2] sdb1[0] sda1[1] 136448 blocks [4/4] [UUUU] md1 : active raid5 sdd2[3] sdc2[2] sdb2[0] sda2[1] 12023808 blocks level 5, 256k chunk, algorithm 2 [4/4] [UUUU] md3 : active raid5 sda4[1] sdd4[3] sdc4[2] sdb4[0] 203647488 blocks level 5, 256k chunk, algorithm 2 [4/4] [UUUU] md2 : active raid5 sda3[1] sdd3[3] sdc3[2] sdb3[0] 24024576 blocks level 5, 256k chunk, algorithm 2 [4/4] [UUUU] unused devices: <none> [root@db2]# top sees my mysqld cpu load, but nothing else seems to be wrong: [root@db2]# top top - 17:56:05 up 7 days, 3:55, 3 users, load average: 32.93, 24.72, 22.70 Tasks: 75 total, 4 running, 71 sleeping, 0 stopped, 0 zombie Cpu(s): 63.4% us, 36.6% sy, 0.0% ni, 0.0% id, 0.0% wa, 0.0% hi, 0.0% si, 0.0% st Mem: 1988824k total, 1304776k used, 684048k free, 99588k buffers Swap: 12023800k total, 0k used, 12023800k free, 951028k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 5754 mysql 19 0 236m 57m 5108 R 99.9 2.9 21:58.76 mysqld 1 root 16 0 7216 700 580 S 0.0 0.0 0:00.39 init 2 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0 Repaired all mysql databases, reindexed raid ... I'm running out of ideeas ... Anyone has an ideea what can go wrong with this server ? Thank you

    Read the article

  • How to set PATH to another variable value with spaces in Windows batch file

    - by Evgeny
    I've got a Windows batch script issue that I'm bashing my head against (no pun intended). The problematic script looks like this: if defined _OLD_VIRTUAL_PATH ( set PATH=%_OLD_VIRTUAL_PATH% ) When I run it and _OLD_VIRTUAL_PATH is set I get: \Microsoft was unexpected at this time. _OLD_VIRTUAL_PATH is a variable that was originally set from PATH and it contains spaces - I'm pretty sure that's the problem. But what's the solution? It runs successfully if I enclose it in quotes, but I don't think the entire value of the PATH variable is supposed to be in quotes.

    Read the article

  • How to add values in multidimensional array?

    - by vaiji
    I have a array like the bellow. Array ( [1] => Array ( [TotalPosts] => 46 [AgentSchemeNumber] => 11 [AgentName] => Vaiji ) [2] => Array ( [TotalPosts] => 3 [AgentSchemeNumber] => 22 [AgentName] => Vaiji ) [3] => Array ( [TotalPosts] => 0 [AgentSchemeNumber] => 33 [AgentName] => Vicky ) [4] => Array ( [TotalPosts] => 0 [AgentSchemeNumber] => 44 [AgentName] => Raja ) [5] => Array ( [TotalPosts] => 18 [AgentSchemeNumber] => 55 [AgentName] => Rama ) [6] => Array ( [TotalPosts] => 13 [AgentSchemeNumber] => 66 [AgentName] => Udaya ) ) Here AgentName vaiji contain 2 records. I want a output like Array ( [1] => Array ( [TotalPosts] => 49 [AgentSchemeNumber] => 11 or 22 (any number) [AgentName] => Vaiji ) [2] => Array ( [TotalPosts] => 0 [AgentSchemeNumber] => 33 [AgentName] => Vicky ) [3] => Array ( [TotalPosts] => 0 [AgentSchemeNumber] => 44 [AgentName] => Raja ) [4] => Array ( [TotalPosts] => 18 [AgentSchemeNumber] => 55 [AgentName] => Rama ) [5] => Array ( [TotalPosts] => 13 [AgentSchemeNumber] => 66 [AgentName] => Udaya ) ) Please help me how to do it?

    Read the article

  • Testing bash scripts

    - by nimcap
    We have a system that has some bash scripts running besides Java code. Since we are trying to "Test Everything That Could Possibly Break" and those bash scripts may break, we want to test them. The problem is it is hard to test the scripts. Is there a way or a best practice to test bash scripts? Or should we quit using bash scripts and look for alternative solutions that are testable?

    Read the article

  • How do I use LDAP proxy user authentication from .net?

    - by DN
    I have a .net web application that uses simple bind to query the LDAP. The application uses integrated windows authentication. Do you have any recommendations on which option to use to authenticate against the LDAP: 1. simple LDAP bind using the logged in user's credentials 2. simple LDAP bind using a service account created for the application's use 3. LDAP proxy user authentication - I dont have enough info about this, so i'd be grateful if someone could explain it's benefit, recommended use and sample .net code to do the query.

    Read the article

  • Choosing a Job based on languages?

    - by Alan
    How often is language the deciding factor for selecting a job? Many of us here are well versed in many languages, C++, Java, C#, and likely have many other languages under our belt for the right occassion (really any occasion is the right occasion for Python, AMIRITE?), so this isn't so much a question of choosing a job that is a good fit based on your skill set. Rather, if you are skilled with most languages, do you pick your favorite, or do you follow the money (given the tight economy). I'm considering coming out of retirement, and have started to look around and what's available. Over the years, I've moved towards C# and Python; many jobs in the area are looking for .NET developers, but there are plenty of them that do not. I cut my teef on C++, consider myself adept at the language, and know my way around a Java. But I find myself really digging what they're doing to C#, and I have always loved python. So when I see an interesting job req that is looking for C++ developers; it gives me 2nd thoughts. Not because I can't cut it, but because I don't know if I want to go back to C++. Even if the work will be interesting, how important is the language to you?

    Read the article

  • What are possible causes of IDirect3DVertexBuffer9::Lock failing?

    - by Suma
    In error reports from some I have quite often seen following behaviour: IDirect3DVertexBuffer9::Lock fails, returned error code is D3DERR_NOTAVAILABLE. Once this happens, quite frequently (but not always) it is followed by CreateTexture or CreateVertexBuffer failing with error D3DERR_OUTOFVIDEOMEMORY. What are possible reasons for vertex buffer lock failure? Could virtual memory address space exhausted, or what?

    Read the article

  • pointer being freed was not allocated

    - by kudorgyozo
    Hello i have the following error: malloc: * error for object 0x2087000: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debug I have no idea what object that is. I don't know how to find it. Can anybody explain to me how (and where) to use malloc_history. I have set a breakpoint in malloc_error_break but i couldn't find out what object is at that address. I receive this after removing an object from an nsmutablearray and popping a view controller manually. If I comment out the line [reviewUpload.images removeObject: self.reviewUploadImg] it doesn't give me the error but of course it's not useful for me like that. - (void) removeImage { debugLog(@"reviewUploadImg %@", self.reviewUploadImg); debugLog(@"reviewUpload %@", self.reviewUpload); debugLog(@"reviewUploadImg thumb %@", self.reviewUploadImg.thumb); [reviewUpload.images removeObject: self.reviewUploadImg]; [self.navigationController popViewControllerAnimated:TRUE]; }

    Read the article

  • Resharper vs. Coderush - 2010 remake

    - by Boydski
    Refer to this post for discussions on previous versions. Asking the question again since Visual Studio 2010 has been officially released. Does anyone have any visibility this early on as to which is better? What about any other products that may be out there? This one will probably be on my dime, so I'd like the wisdom of those with experience before pulling the trigger on a decision.

    Read the article

  • BizTalk Server Threading in Receive Pipelines

    - by ToxicAvenger
    I am building custom pipeline components for receive pipelines in BizTalk Server (2006 and 2009). I am building the components in a streaming fashion. My question: for any single inbound message, if I have a disassembling component, when I create n messages from a single inbound message, will the message agent always use a single thread when reading the (body) streams and persisting the messages to the message box? I would think so, but confirmation would be helpful. Say if I create five messages in the disassembler, will any of these messages be persisted sequentially from the same thread? Or could these messages be processed in parallel?

    Read the article

  • How to return a whole column with Selenium?

    - by Kymair Wu
    I know that Selenium has a built-in method getTable("tableName.row.column") can return a cell conveniently. However how can I return a whole column? I've tried getText() directly, however only the first cell was returned, getText("//tbody[@id='recordsTable']/tr[contains(@class, 'someclass')]") But getXpathCount() with the same Xpath expression showed there're multiple elements matched. getXpathCount("//tbody[@id='recordsTable']/tr[contains(@class, 'someclass')]") // result is 15 Please kindly help, many thanks!

    Read the article

  • dabbledb + iPhone

    - by user193545
    I have been using DabbbleDB online database for storing/retrieving values for one of my iPhone applications. I am using their JSON response for retrieving the records. The problem that I am facing is that if there are a large number of records in the database, it takes a long time to get the response from the server and then to parse the JSON response. Instead I would like to to get a set of records at a time and run a loop to fetch all the records in background. I do not know whether we can query for a set of records at a time from online databases like DabbleDB. Anybody having an idea, please help.

    Read the article

  • second time auto login to twitter using oauth php

    - by JAMES
    Any can tell me how to second time auto connect with twitter from my site. I did... the following CODE if(empty($outh_key_db)){ $token=$_SESSION['oauth_token'] ; $outh_secr_db=$_SESSION['oauth_token_secret']; $con = mysql_connect("localhost","rathin","xxxxxxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("my_twtbook", $con); mysql_query("UPDATE register SET outh_key = '".$token."', outh_secr='".$outh_secr_db."' WHERE userid='".$loguser_email."'"); mysql_close($con); This code save the outh_token and outh_tk_secret to my DB. But on second time log in to my site I passed the 'outh_token and outh_tk_secret' in session with username. The oauth not authenticate that.... Kindly suggest me.... to make aouth connect to twitter using oauth...if user once(1st time made the) connect twitter

    Read the article

  • Listening socket

    - by hoodoos
    I got a strange problem, I never actually expirienced this before, here is the code of the server (client is firefox in this case), the way I create it: _Socket = new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp ); _Socket.Bind( new IPEndPoint( Settings.IP, Settings.Port ) ); _Socket.Listen( 1000 ); _Socket.Blocking = false; the way i accept connection: while( _IsWorking ) { if( listener.Socket.Poll( -1, SelectMode.SelectRead ) ) { Socket clientSocket = listener.Socket.Accept(); clientSocket.Blocking = false; clientSocket.SetSocketOption( SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true ); } } So I'm expecting it hang on listener.Socket.Poll till new connection comes, but after first one comes it hangs on poll forever. I tried to poll it constantly with smaller delay, let's say 10 microseconds, then it never goes in SelectMode.SelectRead. I guess it maybe somehow related on client's socket reuse? Maybe I don't shutdown client socket propertly and client(firefox) decides to use an old socket? I disconnect client socket this way: Context.Socket.Shutdown( SocketShutdown.Both ); // context is just a wrapper around socket Context.Socket.Close(); What may cause that problem?

    Read the article

  • HttpRuntime.Cache scavenging default behavior?

    - by Rire1979
    When adding items using the default insert method Insert(key, value) and as such using the default behavior of HttpRuntime.Cache, when does the scavenging take place? The limit on the application pool that hosts my application is 0 (unlimited)... but I see no way to find out how big the cache can get before scavenging occurs? The problem is I am caching a potentially very large amount of data but I have limited memory on the server and I want to avoid recycling of the app pool. I am asking in the context of IIS6 and IIS7. Thank you.

    Read the article

< Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >