Daily Archives

Articles indexed Monday April 19 2010

Page 14/113 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • adjacency list creation , out of Memory error

    - by p1
    Hello , I am trying to create an adjacency list to store a graph.The implementation works fine while storing 100,000 records. However,when I tried to store around 1million records I ran into OutofMemory Error : Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOfRange(Arrays.java:3209) at java.lang.String.(String.java:215) at java.io.BufferedReader.readLine(BufferedReader.java:331) at java.io.BufferedReader.readLine(BufferedReader.java:362) at liarliar.main(liarliar.java:39) Following is my implementation HashMap<String,ArrayList<String>> adj = new HashMap<String,ArrayList<String>>(num); while ((str = in.readLine()) != null) { StringTokenizer Tok = new StringTokenizer(str); name = (String) Tok.nextElement(); cnt = Integer.valueOf(Tok.nextToken()); ArrayList<String> templist = new ArrayList<String>(cnt); while(cnt>0) { templist.add(in.readLine()); cnt--; } adj.put(name,templist); } //done creating a adjacency list I am wondering, if there is any better way to implement the adjacency list. Also, I know number of nodes right in the begining and , in the future I flatten the list as I visit nodes. Any suggestions ? Thanks

    Read the article

  • using Awk inside Perl script

    - by papoyan
    My first question in stackoverflow! I'm having trouble using the following code inside my perl script, any advise is really appreciated, how to correct the syntax? # If I execute in bash, it's working just fine bash$ whois google.com | egrep "\w+([._-]\w)*@\w+([._-]\w)*\.\w{2,4}" |awk ' {for (i=1;i<=NF;i++) {if ( $i ~ /[[:alpha:]]@[[:alpha:]]/ ) { print $i}}}'|head -n1 [email protected] #----------------------------------- #but this doesn't work bash$ ./email.pl google.com awk: {for (i=1;i<=NF;i++) {if ( ~ /[[:alpha:]]@[[:alpha:]]/ ) { print }}} awk: ^ syntax error # Here is my script bash$ cat email.pl ####\#!/usr/bin/perl $input = lc shift @ARGV; $host = $input; my $email = `whois $host | egrep "\w+([._-]\w)*@\w+([._-]\w)*\.\w{2,4}" |awk ' {for (i=1;i<=NF;i++) {if ( $i ~ /[[:alpha:]]@[[:alpha:]]/ ) { print $i}}}'|head -1`; print my $email; bash$ Thank you in advance !

    Read the article

  • Make object available within php functions without passing them or making them global

    - by Matt
    Hey all, This requirement is just for simplicity for developers and beautiful code. I'm building a template system and I really would just like an object variable to simply be there in all functions. Here's some code: Librarian.php: $class = "slideshow"; $function = "basic"; $args = array(...); $librarian = $this; // I WOULD LIKE THIS TO BE PRESENT IN CALLED FUNCTION ... return call_user_func($class.'::'.$function, $args); ... Slideshow.php: public static function basic($args) { echo $librarian; // "Librarian Object" } Thanks! Matt Mueller

    Read the article

  • Is it possible to replace a div element with jquery and update the dom?

    - by Scarface
    Hey guys quick question, I want to update the contents of a div with two new divs to take the place of the previous ones. Each new div has a unique id to take the place of the old ones. I then want any further update to use the ids of the new divs as their values instead of the original. Is this possible in Jquery? Thanks in advance for any assistance. var display_total=$(".display_total").attr("id"); var display_of_total=$(".display_of_total").attr("id"); var new_display_of_total=parseInt(display_of_total)+1; var new_display_total=parseInt(display_total)+1; $('.totalmessages').html('<div class="display_of_total" id="'+new_display_of_total+'">Displaying '+new_display_of_total+' of </div><div class="display_total" id="'+new_display_total+'">'+new_display_total+' messages...</div>');

    Read the article

  • SQL Server Error 26 (Error Locating Server/Instance Specified) Only When Debugging

    - by Phsion
    I have a simple asp .net web project I'm working on, and while normally everything is going fine, if I try to debug the site, I get "SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified". I'm not sure if its a weird code issue or a weird SQL Server Issue, but here are the system specs anyway. My dev machine is Windows 7 32-bit, and a Windows Server 2008 VM (on the same Windows 7 Machine) runs both IIS and SQL Server 2008 Express. I haven't had any other problems with the connection string I'm using, and I'm using the simple SA account. Anyhow, thanks for the help.

    Read the article

  • How To Disable Individual Plug-ins in Google Chrome

    - by The Geek
    Have you ever wondered how to disable useless or insecure browser plug-ins in Google Chrome? Here’s the lowdown on how to get rid of Java, Acrobat, Silverlight, and the rest of the plugins you probably want to get rid of. Disabling Plugins in Google Chrome If you head to about:plugins in your address bar, you’ll probably see a list of plugins, but won’t be able to disable them yet. What you’ll need to do is switch over to the Dev channel of Chrome, which gives you access to all the latest features—though you might be warned that sometimes the dev channel might be less stable than the release or beta channels. Ready to proceed? Head to the Dev Channel page, and then click the link to run the installer. You’ll be prompted to restart Chrome when you’re done. Note that Mac and Windows users can both run an installer to switch. Linux users will have to install a package. Note: Once you’ve switched to the Dev channel, you can’t really switch to the stable channel. You’ll have to uninstall Chrome and then reinstall the regular version. Now that you’ve switched to the dev channel and restarted your browser, head to about:plugins in the address bar, and then just disable each plugin you really don’t need. Plugins you can generally live without?  Java, Acrobat, Microsoft Office, Windows Presentation Foundation, Silverlight. These will be on a case-by-case basis, of course, but the vast majority of large websites don’t require any of those. When it comes right down to it, the only plugin that most people require is Flash… and leave the “Default Plug-in” alone too. Special thanks to @jordanconway for pointing out the solution. Similar Articles Productive Geek Tips Disable YouTube Comments while using ChromeHow to Make Google Chrome Your Default BrowserSubscribe to RSS Feeds in Chrome with a Single ClickAdd Notes to Google Notebook from ChromeAccess Google Chrome’s Special Pages the Easy Way TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips DVDFab 6 Revo Uninstaller Pro Registry Mechanic 9 for Windows PC Tools Internet Security Suite 2010 Office 2010 Product Guides Google Maps Place marks – Pizza, Guns or Strip Clubs Monitor Applications With Kiwi LocPDF is a Visual PDF Search Tool Download Free iPad Wallpapers at iPad Decor Get Your Delicious Bookmarks In Firefox’s Awesome Bar

    Read the article

  • Spring MVC; avoiding file extension in url?

    - by Ezombort
    I just started with Spring Web MVC. I'm trying to avoid file extenstions in the url. How can i do this? (I'm using Spring 2.5.x) Bean: <bean name="/hello.htm" class="springapp.web.HelloController"/> I want it to be: <bean name="/hello" class="springapp.web.HelloController"/> I cannot get it to work. Any ideas? Edit: Url-mapping <servlet-mapping> <servlet-name>springapp</servlet-name> <url-pattern>*.htm</url-pattern> </servlet-mapping> I have tried changing the url-pattern with no luck (* and /*).

    Read the article

  • AssociatedControlId of inner namingcontainer

    - by Eric
    Hi, I have a custom control contains a label control. I want to set the AssociatedControlId of this label to be other control id on the page, but as soon as I implement the INamingContainer in my custom control, it will run into an error saying "Unable to find control with id 'abc' that is associated with the Label 'xyz'." This would be due to the fact that the label is in a nested naming container and it trys to find the control within the same container but couldn't (as the control is on the page, outside of it own naming container) Anyone know of a way to set this property? Thanks, Eric

    Read the article

  • Custom Error Handling

    - by Michael
    Using GoDaddy to host my site (I know that's my first problem)! :-) Trying to setup customer error messages for my site using IIS7. GoDaddy allows you to setup a 404 in their control panel, but I can't override this, or setup any additional error redirects, specifically a 500-server error. Here is my web.config file: <configuration> <system.webServer> <rewrite> <rules> <rule name="Redirect to WWW" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_HOST}" pattern="^mysite.com$" /> </conditions> <action type="Redirect" url="http://www.mysite.com/{R:0}" redirectType="Permanent" /> </rule> </rules> </rewrite> </system.webServer> <system.web> <customErrors mode="On" defaultRedirect="http://www.mysite.com/oops.php"> <error statusCode="404" redirect="http://www.mysite.com/oops.php?error=404" /> <error statusCode="500" redirect="http://www.mysite.com/oops.php?error=500" /> </customErrors> </system.web> </configuration>

    Read the article

  • Adding a self-signed certificate to iphone Simulator?

    - by jr
    I have a self-signed certificate at the endpoint of my API. I'm trying to test some things using the simulator but am getting "untrusted server certificate". I have tried to use safari on the simulator to download the .crt file, but that doesn't seem to work. Where does iPhone Simulator get its keychain from? How can I add a trusted certificate so my application will work? UPDATE I got it to work by creating a CA and then adding a CA certificate using the iPhone provisioning tool. Then I was able to have a certificate signed by that CA certificate on the API server and the NSConnection just worked. I was not able to get it to work using a self-signed certificate for some reason. I need to re-attempt this using the provisioning software. My real question is how do I get this to work on the simulator? I would think that the simulator uses the keychain of the actual computer.

    Read the article

  • XamlWriter fails to serialize objects in WinForms app

    - by Eddie
    Apparently XamlWriter doesn't works correctly in a WinForms application. XamlWriter uses MarkupWriter.GetMarkupObjectFor(object obj). I suppose that there's a problem to determine the full list of properties to serialize. var ar = new AssemblyReference(AppDomain.CurrentDomain.GetAssemblies().First()); var str = XamlWriter.Save(ar); Running an ASP.NET or WPF application I got this result: <AssemblyReference AssemblyName="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" HintPath="file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll" SpecificVersion="False" xmlns="clr-namespace:Ivolutia.TypeModel;assembly=ivoTypeModel" /> But running the same code in a WinForms application I got this: <AssemblyReference xmlns="clr-namespace:Ivolutia.TypeModel;assembly=ivoTypeModel" /> this is the class definition: public class AssemblyReference : DependencyObject { public string AssemblyName { get; set; } public string HintPath { get; set; } public bool SpecificVersion { get; set; } public AssemblyReference() { } public AssemblyReference(Assembly assembly) { AssemblyName = assembly.FullName; HintPath = assembly.CodeBase; } public override string ToString() { return AssemblyName; } }

    Read the article

  • control with ID 'GridView1' could not be found for the trigger in UpdatePanel 'UpdatePanel1'

    - by Kk
    I have two gridview in update panel and m adding entries from one gridview to another on selectedIndexChanged event what m trying to do is updating update panel on this event selectedindexchanged ...but my gridview is inside accordian control so it does not get initialized and hence i get this error ..... control with ID 'GridView1' could not be found for the trigger in UpdatePanel 'UpdatePanel1' Anybody knows solution?

    Read the article

  • drawImage in Java applet flickers in Safari

    - by lcvinny
    I'm having a flicker problem in a Java applet in Safari (Mac). However, it's not the usual double buffering problem. I have isolated it down to one single drawImage call (no redundant repaint, no clear is called), which gives a white flicker before painting the image but not on every repaint. In fact, I measured the duration of the drawImage call, which is normally about 1ms, but up to 30ms about every 5th time paint is called, which is when it flickers. Repaints are triggered when I drag a component or when the window is scrolled. Is this a bug in the java implementation on OSX, and is there a fix for it?

    Read the article

  • Why did Dylan loose to Objective-C

    - by Adam Gent
    I have played/worked with many different programming languages and Dylan is still one of my favorites. My question is why did Dylan fail when Objective-C, Ruby and even Scheme have had more success? Was Dylans performance that much worse than Objective-C that Apple went with it or was purely for social/political reasons. Hopefully someone from apple will see this question :) BTW if you have no idea what Dylan is please google Dylan Progrmaming Language.

    Read the article

  • Undefined symbols for C++0x lambdas?

    - by Austin Hyde
    I was just poking around into some new stuff in C++0x, when I hit a stumbling block: #include <list> #include <cstdio> using namespace std; template <typename T,typename F> void ForEach (list<T> l, F f) { for (typename list<T>::iterator it=l.begin();it!=l.end();++it) f(*it); } int main() { int arr[] = {1,2,3,4,5,6}; list<int> l (arr,arr+6); ForEach(l,[](int x){printf("%d\n",x);}); } does not compile. I get a load of undefined symbol errors. Here's make's output: i386-apple-darwin9-gcc-4.5.0 -std=c++0x -I/usr/local/include -o func main.cpp Undefined symbols: "___cxa_rethrow", referenced from: std::_List_node<int>* std::list<int, std::allocator<int> >::_M_create_node<int const&>(int const&&&) in ccPxxPwU.o "operator new(unsigned long)", referenced from: __gnu_cxx::new_allocator<std::_List_node<int> >::allocate(unsigned long, void const*) in ccPxxPwU.o "___gxx_personality_v0", referenced from: ___gxx_personality_v0$non_lazy_ptr in ccPxxPwU.o "___cxa_begin_catch", referenced from: std::_List_node<int>* std::list<int, std::allocator<int> >::_M_create_node<int const&>(int const&&&) in ccPxxPwU.o "operator delete(void*)", referenced from: __gnu_cxx::new_allocator<std::_List_node<int> >::deallocate(std::_List_node<int>*, unsigned long) in ccPxxPwU.o "___cxa_end_catch", referenced from: std::_List_node<int>* std::list<int, std::allocator<int> >::_M_create_node<int const&>(int const&&&) in ccPxxPwU.o "std::__throw_bad_alloc()", referenced from: __gnu_cxx::new_allocator<std::_List_node<int> >::allocate(unsigned long, void const*) in ccPxxPwU.o "std::_List_node_base::_M_hook(std::_List_node_base*)", referenced from: void std::list<int, std::allocator<int> >::_M_insert<int const&>(std::_List_iterator<int>, int const&&&) in ccPxxPwU.o ld: symbol(s) not found collect2: ld returned 1 exit status make: *** [func] Error 1 Why is this not working?

    Read the article

  • Proftpd: only allow one address

    - by tomkeim
    Hello, I am searching for it on Google, but i didn't find anything. Is there a way tho set up proftpd that it will only accept a connection on ftp.website.ext and not on website.ext or test.website.ext I am running proftpd on Debian 5 Tom

    Read the article

  • Understanding List formatting in MSWord

    - by John
    I've never understood how formatting works in MSWord for lists... it mostly just works but sometimes becomes incredibly stubborn about enforcing styles you don't want, especially when copy-pasting into a list and working with multiple, multi-layer lists. What are some good ways to understand how it works, so one can work with Word, instead of fighting against it? Here's an example... I want a list like: 1)first test CHECK: a)something b)another thing 2)another test CHECK: a)it works b)it doesn't crash I find Word really doesn't like this... I try creating one mini-list and copy pasting but typically the numbering on the sub-lists doesn't re-start automatically, etc. I'm using Word 2007 but I remember it being this way in earlier versions too.

    Read the article

  • Why did Dylan lose to Objective-C

    - by Adam Gent
    I have played/worked with many different programming languages and Dylan is still one of my favorites. My question is why did Dylan fail when Objective-C, Ruby and even Scheme have had more success? Was Dylans performance that much worse than Objective-C that Apple went with it or was purely for social/political reasons. Hopefully someone from apple will see this question :) BTW if you have no idea what Dylan is please google Dylan Progrmaming Language.

    Read the article

  • How to find the type of shopping cart used to implement in website

    - by harigm
    Is there way to identify which shopping cart open source technology has been used to implemente for any given website? For example: if you are looking at shopping.yahoo.com,shopping.rediff.com can we tell which Shopping cart tool they have used for Example : zen cart, os commerce , magento etc.... I am trying to idenify the website which has zen cart implementation or magento implementation?

    Read the article

  • Using same Debug settings for Start External Program across 32 bit and 64 bit debug environments

    - by Michael Prewecki
    We use a mixture of 32-bit and 64-bit development environments. Some of our class libraries are debugged using a 32-bit application so we have debug settings for "Start External Program" and "Working Directory". The problem is that the settings need to be different since the 32-bit application is installed to C:\Program Files\xxx (on the 32-bit dev enviroment) or C:\Program Files (x86)\xxx (on the 64-bit dev environment) Is there a way to use some sort of tag like %PROGRAMFILES% or $(ProgramFiles) so that Visual Studio 2008 will know where to look for the external program? This wouldn't be a major issue except the solution file (where the debug information is saved) is checked into source control...so getting the latest version of the solution from our source repository keeps yoyo'ing the debug settings between the two program files locations.

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >