Generic htaccess redirect www to non-www

Generic htaccess redirect www to non-www

I would like to redirect www.example.com to example.com. The following htaccess code makes this happen:RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]But, is there a way to do this in a gen

What is the best way to implement “remember me” for a website? [closed]

What is the best way to implement “remember me” for a website? [closed]

I want my website to have a checkbox that users can click so that they will not have to log in each time they visit my website. I know I will need to store a cookie on their computer to implement this, but what should be contained in that c

Segmentation fault on large array sizes

Segmentation fault on large array sizes

The following code gives me a segmentation fault when run on a 2Gb machine, but works on a 4GB machine.int main(){ int c[1000000]; cout << "done\n"; return 0;}The size of the array is just 4Mb. Is there a limit on the size of an array

Immutability of Strings in Java

Immutability of Strings in Java

Consider the following example.String str = new String();str = "Hello";System.out.println(str); //Prints Hellostr = "Help!";System.out.println(str); //Prints Help!Now, in Java, String objects are immutable. Then how come the object str c

What is the “-->” operator in C++?

What is the “-->” operator in C++?

After reading Hidden Features and Dark Corners of C++/STL on comp.lang.c++.moderated, I was completely surprised that the following snippet compiled and worked in both Visual Studio 2008 and G++ 4.4.Here's the code:#include int mai

How can I obfuscate (protect) JavaScript? [closed]

How can I obfuscate (protect) JavaScript? [closed]

I want to make a JavaScript application that's not open source, and thus I wish to learn how to can obfuscate my JS code? Is this possible? 1:Obfuscation:Try YUI Compressor. It's a very popular tool, built, enhanced and maintained by th

What are the rules about using an underscore in a C++ identifier?

What are the rules about using an underscore in a C++ identifier?

It's common in C++ to name member variables with some kind of prefix to denote the fact that they're member variables, rather than local variables or parameters. If you've come from an MFC background, you'll probably use m_foo. I've also se

What are app domains used for?

What are app domains used for?

I understand roughly what an AppDomain is, however I don't fully understand the uses for an AppDomain.I'm involved in a large server based C# / C++ application and I'm wondering how using AppDomains could improve stability / security / per

CoreData: “Dangling reference to an invalid object.” error

CoreData: “Dangling reference to an invalid object.” error

I'm working on a Cocoa-Touch app, it uses CoreData and has some NSPersistentObject subclasses generated by the XCode model editor.I've noticed that recently, when saving the context I get an error which has as user info the following part:(

Spaces cause split in path with PowerShell

Spaces cause split in path with PowerShell

I'm having an issue with powershell when invoking an exe at a path containing spaces.PS C:\Windows Services> invoke-expression "C:\Windows Services\MyService.exe"The term 'C:\Windows' is not recognized as the name of a cmdlet, function, scr

Escape pound or number sign in Github issue tracker

Escape pound or number sign in Github issue tracker

If I type #1 when creating an Issue in Github, it will reference to Issue ID 1. Is there a way to avoid this by escaping the # sign? I just need it to be regular text. 1:TL;DR—my personal favouriteseither type#1or#1or#1In the lat

How to set icc color profile in Java and change colorspace

How to set icc color profile in Java and change colorspace

First, I would like to say I'm not an image processing specialist.I would like to convert image colorspace from one to another, and change icc color profile at the same time. I managed to do it using JMagick (the ImageMagick Java port), but

MVC “create view” when there is one to many relationship in model

MVC “create view” when there is one to many relationship in model

My model is simple, one client can have many phone numbers :I have represented this in Entity FrameworkGenerated client class is as below.public partial class Client{ public Client() { this.PhoneNumbers = new HashSet(); }

how to mix two audio channels?

how to mix two audio channels?

I have two mono audio channels (pcm format) of audio call, incoming and outgoing. how to mix them? how to position them in space? (e.g. incoming channel sounds slightly on the left and outgoing on the right) 1:Mixing is just a weighted a

Why do these Heredoc and Nowdoc cause errors?

Why do these Heredoc and Nowdoc cause errors?

I've already found some solutions, but can't know what happened...Example 1:Example 2:Output 1,2:PHP Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or heredoc end (T_END_HEREDOC) or ${ (T_DOLLAR_OPEN_CUR

I am trying to send text- messages on WhatsApp with javascript?

I am trying to send text- messages on WhatsApp with javascript?

I am trying to send text messages on whatsapp web version on chrome.(www.web.whatsapp.com)This is the code:document.getElementsByClassName("input")[1].innerHTML="This message was written via JS script! ";var input = document.getElementsByCl

How to set layout on 7\" two different tablet?

How to set layout on 7\" two different tablet?

I have two 7 inch tablet one tablet (800*480) and second tablet (1024*600). I have facing problem following :-1. Both can run on layout-mdpi and layout-large so how can i make different folder for run my app both resolution.Application run

Android app resets on orientation change, best way to handle?

Android app resets on orientation change, best way to handle?

So I am making a basic chess app to play around with some various elements of android programming and so far I am learning a lot, but this time I am lost.When the orientation of the emulator changes the activity gets reset. Based on my rese

mysql: efficient way for postfix-search (like '%text' aka. prefix wildcard)?

mysql: efficient way for postfix-search (like '%text' aka. prefix wildcard)?

Is there any build-in functionality in MySQL to do the above without scanning the entire table?Only solution I found is to store a mirrored version of the column I want to compare and do a like 'txet%'.I also don't see a way of getting arou

Can you give an example of stack overflow in C++?

Can you give an example of stack overflow in C++?

Can you give an example of stack overflow in C++? Other than the recursive case:void foo() { foo(); } 1:The typical case that does not involve infinite recursion is declaring an automatic variable on the stack that is too large. For exam

In Ruby, how to output json from hash and give it line breaks and tabs

In Ruby, how to output json from hash and give it line breaks and tabs

I'm trying to format {"key" => "value"} to turn it into :{ "key" : "value"}for writing into a json file.right now im doing :hash = {"key" => "value"}puts hash.to_json.gsub('{', '{\n\t')to start. and this outputs {\n\t"key":"valu

Apache: how can I access my webpage from a computer outside my network?

Apache: how can I access my webpage from a computer outside my network?

I want to access my webpage from a computer outside the network. Our network has IPs like 192.168.0.1-192.168.0.255. The network is connected to Internet through a local gateway 192.168.0.1 and gets to DNS server 193.xxx.xxx.xxx.Let's say m

Run custom shell script '[cp] embed pods frameworks' no such file or directory

Run custom shell script '[cp] embed pods frameworks' no such file or directory

Just finished resolving my errors after converting to Swift 3 only to get this error when trying to compile. I have attached a screenshot for clarity, it does not look like the system is looking for a .app file or .sh file. Really don't kno

Displaying Only the first x words of a string in rails

Displaying Only the first x words of a string in rails

I can display a message like this, but in some situations I would like to display only the first 5 words of the string and then show an ellipsis (...) 1:In rails 4.2 you can use truncate_words.'Once upon a time in a world far far away'.t

How to delete leading empty space in a SQL Database Table using MS SQL Server Managment Studio

How to delete leading empty space in a SQL Database Table using MS SQL Server Managment Studio

I imported an Excel sheet with countries into a database table.Unfortunately all rows have some leading empty space.So, how can I delete these empty spaces? 1:This will remove leading and trailing spacesUpdate tablename set fieldName = l