Daily Archives

Articles indexed Wednesday May 19 2010

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

  • Comparing a peer's IPv6 address with localhost

    - by indiv
    I have called getpeername on my connected socket and now have an IPv6 address of the connected peer. How do I tell whether my peer's IP address is localhost? (the host name "localhost" is not defined in the target system's hosts file, so I need to work with IP addresses only)

    Read the article

  • Javascript library: to obfuscate or not to obfuscate - that is the question

    - by morpheous
    I need to write a GUI related javascript library. It will give my website a bit of an edge (in terms of functionality I can offer) - up until my competitors play with it long enough to figure out how to write it by themselves. I can accept the fact that it will be emulated over time - thats par for the course (its part of business). However, what I cannot bear, is the idea of effectively, simply handing over all the hard work that would have gone into the library to my competitors, by using plain javascript that anyone can download and use. It is an established fact that no none in the industry I am "attacking" has this functionality, so the value of such a library is undeniable and is not up for discussion (i.e. thats not what I'm asking here). What I am seeking to find out are the pros and cons of obfuscating a javascript library, so that I can come to a final decision. Two of my biggest concerns are debugging, and subtle errors that may be introduced by the obfuscator. I would like to know: How can I manage those risks (being able to debug faulty code, ensuring/minimizing against obfuscation errors) Are there any good quality industry standard obfuscators you can recommend (preferably something you use yourself). What are your experiences of using obfuscated code in a production environment?

    Read the article

  • iPhone SDK Objective-C __DATE__ (compile date) can't be converted to an NSDate

    - by Janice
    //NSString *compileDate = [NSString stringWithFormat:@"%s", __DATE__]; NSString *compileDate = [NSString stringWithUTF8String:__DATE__]; NSDateFormatter *df = [[[NSDateFormatter alloc] init] autorelease]; [df setDateFormat:@"MMM d yyyy"]; //[df setDateFormat:@"MMM dd yyyy"]; NSDate *aDate = [df dateFromString:compileDate]; Ok, I give up. Why would aDate sometimes return as nil? Should it matter if I use the commented-out lines... or their matching replacement lines?

    Read the article

  • How could I cache images that I'm pulling from a magento database through ajax?

    - by wes
    Here's script being called through ajax: <?php require_once '../app/Mage.php'; umask(0); /* not Mage::run(); */ Mage::app('default'); $cat_id = ($_POST['cat_id']) ? $_POST['cat_id'] : NULL; try { $category = new Mage_Catalog_Model_Category(); $category->load($cat_id); $collection = $category->getProductCollection(); $output = '<ul>'; foreach ($collection as $product) { $cProduct = Mage::getModel('catalog/product'); $cProduct->load($product->getId()); $output .= '<li><img id="'.$product->getId().'" src="' . (string)Mage::helper('catalog/image')->init($cProduct, 'small_image')->resize(75) . '" class="thumb" /></li>'; } $output .= '</ul>'; echo $output; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } I'm just passing in the Category ID, which I've tacked onto the navigation links, then doing some work to eventually just pass back all product images in that category. I'm using this on a drag and drop build-a-bracelet type of application, and the amount of images returned is sometimes in the 500s. So it get's pretty held up during transmission, sometimes 10 seconds or so. I know I'd do good by caching them some way, just not sure how to go about it. Any help is much appreciated. Thanks. -Wes

    Read the article

  • Biggest command-line mistake?

    - by Peter Hilton
    What is the most damage (of whatever kind) that you have ever caused with a single mistaken/mistyped/misguided command line? I deleted a production system database by mistake a while back, for example, but I was lucky (i.e. backed-up) and there was no permanent data loss, lost money, property damage etc. Most importantly (for votes), what do you do to make sure it will not ever happen again?

    Read the article

  • Dealing With SEO Issues Concerning Expired Pages

    Expired pages are an issue with a number of websites. Dealing with them on usual basis so that no adverse effects are created on your SEO services should be known. Although, a lot many ways are available and have been found by SEO experts, their correct implementation at the same time is what matters the most

    Read the article

  • Best SEO

    In an effort to save on costs and to ensure that the process is done to their liking, a lot of company websites are engaging in doing their own search engine optimization (SEO) analysis as well as the search engine optimization themselves. There is a positive and negative side to this cost saving aspect.

    Read the article

  • Information About Mambo and Joomla

    JOOMLA and MAMBO was originally developed by a team called Mambo. In 2005, the main developers of Mambo left the team and build the JOOMLA system. Regardless of the history of these two systems, they have turn into a leading hosting system in the industry. These two CMS platform software is the most easiest to use and manage content management that is why it is the most preferred CMS software by most web developer.

    Read the article

  • OpenGL-ES Texture Mapping. Texture is reversed?

    - by Feet
    I am trying to get my head around Texture mapping, I thought I had it the other day after asking this. However, I am having some trouble with my texture coordinates being flipped from what I am expecting. I am loading my texture like so int[] textures = new int[1]; gl.glGenTextures(1, textures, 0); _textureID = textures[0]; gl.glBindTexture(GL10.GL_TEXTURE_2D, _textureID); Bitmap bmp = BitmapFactory.decodeResource( _context.getResources(), R.drawable.die_1); GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bmp, 0); gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR); gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR); bmp.recycle(); My cube is this float vertices[] = { // Front face -width, -height, depth, // 0 width, -height, depth, // 1 width, height, depth, // 2 -width, height, depth, // 3 // Back Face width, -height, -depth, // 4 -width, -height, -depth, // 5 -width, height, -depth, // 6 width, height, -depth, // 7 // Left face -width, -height, -depth, // 8 -width, -height, depth, // 9 -width, height, depth, // 10 -width, height, -depth, // 11 // Right face width, -height, depth, // 12 width, -height, -depth, // 13 width, height, -depth, // 14 width, height, depth, // 15 // Top face -width, height, depth, // 16 width, height, depth, // 17 width, height, -depth, // 18 -width, height, -depth, // 19 // Bottom face -width, -height, -depth, // 20 width, -height, -depth, // 21 width, -height, depth, // 22 -width, -height, depth, // 23 }; short indices[] = { // Front 0,1,2, 0,2,3, // Back 4,5,6, 4,6,7, // Left 8,9,10, 8,10,11, // Right 12,13,14, 12,14,15, // Top 16,17,18, 16,18,19, // Bottom 20,21,22, 20,22,23, }; float texCoords[] = { // Front face textured only, for simplicity 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f}; And it is drawn like so // Counter-clockwise winding. gl.glFrontFace(GL10.GL_CCW); // Enable face culling. gl.glEnable(GL10.GL_CULL_FACE); // What faces to remove with the face culling. gl.glCullFace(GL10.GL_BACK); // Enabled the vertices buffer for writing and to be used during // rendering. gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); // Specifies the location and data format of an array of vertex // coordinates to use when rendering. gl.glVertexPointer(3, GL10.GL_FLOAT, 0, verticesBuffer); if (normalsBuffer != null) { // Enabled the normal buffer for writing and to be used during rendering. gl.glEnableClientState(GL10.GL_NORMAL_ARRAY); // Specifies the location and data format of an array of normals to use when rendering. gl.glNormalPointer(GL10.GL_FLOAT, 0, normalsBuffer); } // Set flat color gl.glColor4f(rgba[0], rgba[1], rgba[2], rgba[3]); // Smooth color if ( colorBuffer != null ) { // Enable the color array buffer to be used during rendering. gl.glEnableClientState(GL10.GL_COLOR_ARRAY); // Point out the where the color buffer is. gl.glColorPointer(4, GL10.GL_FLOAT, 0, colorBuffer); } // Use textures? if ( textureBuffer != null) { gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glEnable(GL10.GL_TEXTURE_2D); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, textureBuffer); } // Translation and rotation before drawing gl.glTranslatef(x, y, z); gl.glRotatef(rx, 1, 0, 0); gl.glRotatef(ry, 0, 1, 0); gl.glRotatef(rz, 0, 0, 1); gl.glDrawElements(GL10.GL_TRIANGLES, numOfIndices, GL10.GL_UNSIGNED_SHORT, indicesBuffer); // Disable the vertices buffer. gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_COLOR_ARRAY); gl.glDisableClientState(GL10.GL_NORMAL_ARRAY); gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Disable face culling. gl.glDisable(GL10.GL_CULL_FACE); However my front face looks like this I also add, I haven't got any normals set, are textures affected by normals? float texCoords[] = { // Front 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f} It seems as if the texture is being flipped, so the coordinates don't match up properly?

    Read the article

  • how to format date when i load data from google-app-engine..

    - by zjm1126
    i use remote_api to load data from google-app-engine. appcfg.py download_data --config_file=helloworld/GreetingLoad.py --filename=a.csv --kind=Greeting helloworld the setting is: class AlbumExporter(bulkloader.Exporter): def __init__(self): bulkloader.Exporter.__init__(self, 'Greeting', [('author', str, None), ('content', str, None), ('date', str, None), ]) exporters = [AlbumExporter] and i download a.csv is : the date is not readable , and the date in appspot.com admin is : so how to get the full date ?? thanks i change this : class AlbumExporter(bulkloader.Exporter): def __init__(self): bulkloader.Exporter.__init__(self, 'Greeting', [('author', str, None), ('content', str, None), ('date', lambda x: datetime.datetime.strptime(x, '%m/%d/%Y').date(), None), ]) exporters = [AlbumExporter] but the error is :

    Read the article

  • I get 2014 Cannot execute queries while other unbuffered queries are active when doing exec with PDO

    - by Itay Moav
    I am doing a PDO::exec command on multiple updates: $MyPdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY,true); $MyPdo->exec("update t1 set f1=1;update t2 set f1=2"); I am doing it inside a transaction, and I keep getting: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. those are the only query/ies

    Read the article

  • Free object/widget in GTK?

    - by wag2639
    I've got a pack box in my GTK application and I'm replacing it every once in a while with a completely new entry (at least for now cause I'm in a hurry). Since I'm replacing it with a new instance, do I need to explicitly free from memory the old pack box contents or is there some garbage collection in GTK? If I do need to explicitly need to free the object, is there a command that will recursively go to all objects in that tree (like will it clear my button in a box container inside my main pack box)? I'm using C/GTK-2.0 (gcc v4.4.3 and GTK 2.20.0).

    Read the article

  • Passing an ActionScript JPG Byte Array to Javscript (and eventually to PHP)

    - by Gus
    Our web application has a feature which uses Flash (AS3) to take photos using the user's web cam, then passes the resulting byte array to PHP where it is reconstructed and saved on the server. However, we need to be able to take this web application offline, and we have chosen Gears to do so. The user takes the app offline, performs his tasks, then when he's reconnected to the server, we "sync" the data back with our central database. We don't have PHP to interact with Flash anymore, but we still need to allow users to take and save photos. We don't know how to save a JPG that Flash creates in a local database. Our hope was that we could save the byte array, a serialized string, or somehow actually persist the object itself, then pass it back to either PHP or Flash (and then PHP) to recreate the JPG. We have tried: - passing the byte array to Javascript instead of PHP, but javascript doesn't seem to be able to do anything with it (the object seems to be stripped of its methods) - stringifying the byte array in Flash, and then passing it to Javascript, but we always get the same string: ÿØÿà Now we are thinking of serializing the string in Flash, passing it to Javascript, then on the return route, passing that string back to Flash which will then pass it to PHP to be reconstructed as a JPG. (whew). Since no one on our team has extensive Flash background, we're a bit lost. Is serialization the way to go? Is there a more realistic way to do this? Does anyone have any experience with this sort of thing? Perhaps we can build a javascript class that is the same as the byte array class in AS?

    Read the article

  • Jquery: Filter dropdown list as you type

    - by rmbarnes
    I have used a prototype plugin which filters the contents of a dropdown as you type. So for example if you typed 'cat' into the text box, only items containing the substring 'cat' would be left as options in the drop down. Does anyone know of a jquery plugin which can do this?

    Read the article

  • How Can I Learn about Interfaces

    - by BDotA
    I am using C# and I know what are the interfaces and how syntatically use them,etc. but what I have not learned yet is that when I am tasked to write a project, create a component,... How should I learn better about interfaces so when I want to do something I be able to Think about using them in my design...or for example I want to learn about dependency injection or even using mocking objects for testing, these are all related to good understanding of interfaces and know when and how to use them ... Can you plase provide me some good advice, reading,... then can help me with that?

    Read the article

  • c++ warning: address of local variable

    - by chnet
    int * ref () { int tmp = 100; return &tmp; } int main () { int * a = ref(); cout << *a << endl; } I know the function ref () is allocated stack space. It will get destroyed as soon as the function exits. So the complier will give warning information. But my question is why the returning result is still correct.

    Read the article

  • Can i write to data output stream after reading response from data input stream?

    - by Sirius
    Hi, i want to do a client-server activity like this: 1. first the client sends/writes to output stream 2. the server responses with some data that will be read with input stream 3. after receiving the data, the client sends/writes to output stream again to respond that the data has been received now, do i have to close the output stream and re-open it again before doing step no.3 ? also if someone could provide me with a snippet, it would be really helpful. thanks

    Read the article

  • PostgreSQL - Why are some queries on large datasets so incredibly slow

    - by Brad Mathews
    Hello, I have two types of queries I run often on two large datasets. They run much slower than I would expect them to. The first type is a sequential scan updating all records: Update rcra_sites Set street = regexp_replace(street,'/','','i') rcra_sites has 700,000 records. It takes 22 minutes from pgAdmin! I wrote a vb.net function that loops through each record and sends an update query for each record (yes, 700,000 update queries!) and it runs in less than half the time. Hmmm.... The second type is a simple update with a relation and then a sequential scan: Update rcra_sites as sites Set violations='No' From narcra_monitoring as v Where sites.agencyid=v.agencyid and v.found_violation_flag='N' narcra_monitoring has 1,700,000 records. This takes 8 minutes. The query planner refuses to use my indexes. The query runs much faster if I start with a set enable_seqscan = false;. I would prefer if the query planner would do its job. I have appropriate indexes, I have vacuumed and analyzed. I optimized my shared_buffers and effective_cache_size best I know to use more memory since I have 4GB. My hardware is pretty darn good. I am running v8.4 on Windows 7. Is PostgreSQL just this slow? Or am I still missing something? Thanks! Brad

    Read the article

  • How do I get meaningful error messages in IIS7?

    - by Petras
    I have a classic ASP website that is crashing in IIS7. It is crashing because IIS doesn't allow file uploads greater than a certain size. I know this because files below about 200k work fine. I removed the Status Code 500 error in IIS but I still don't get a file name and the line where my code failed as I do when running locally. Instead I get: "The page cannot be displayed because an internal server error has occurred. If you are the system administrator please click here to find out more about this error." How do I get a file name and the line where my code failed? Here are my IIS settings:

    Read the article

  • apache web server configuration problem

    - by mohit
    i want to have apache server to serve only /var/www/ directory now it serves all my files on system from directory "/" i tried to edit httpd.conf placed in /etc/apache2 and placed the folllowing content in it(intially it was empty) <Directory /> Options None AllowOverride None </Directory> DocumentRoot "/var/www" <Directory "/var/www"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> then saved it,restarted apache server put the location /var/www in the web browser address bar,still it shows the higher level directories too then i edited the file Default,Default-ssl in the sites-available folder repeated the same process still apache serves all files on my system 2.when i try to use the following command gedit httpd.conf I get the error gedit:2696): EggSMClient-WARNING **: Failed to connect to the session manager: None of the authentication protocols specified are supported GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details - 1: Failed to get connection to session: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.)

    Read the article

  • WCF REST Question, Binding, Configuration

    - by Ethan McGee
    I am working on a WCF rest interface using json. I have wrapped the service in a windows service to host the service but I am now having trouble getting the service to be callable. I am not sure exactly what is wrong. The basic idea is that I want to host the service on a remote server so I want the service mapped to port localhost:7600 so that it can be invoked by posting data to [server_ip]:7600. The problem is most likely in the configuration file, since I am new to WCF and Rest I wasn't really sure what to type for the configuration so sorry if it's a total mess. I removed several chunks of code and comments to make it a little easier to read. These functions should have no bearing on the service since they call only C# functions. WCF Service Code using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel; using System.ServiceModel.Activation; using System.ServiceModel.Web; using System.Text; namespace PCMiler_Connect { public class ZIP_List_Container { public string[] ZIP_List { get; set; } public string Optimized { get; set; } public string Calc_Type { get; set; } public string Cross_International_Borders { get; set; } public string Use_Kilometers { get; set; } public string Hazard_Level { get; set; } public string OK_To_Change_Destination { get; set; } } [ServiceContract] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] public class PCMiler_Webservice { [WebInvoke(Method = "POST", UriTemplate = "", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json), OperationContract] public List<string> Calculate_Distance(ZIP_List_Container container) { return new List<string>(){ distance.ToString(), time.ToString() }; } } } XML Config File <?xml version="1.0" encoding="utf-8"?> <configuration> <system.serviceModel> <services> <service name="PCMiler_Connect.PCMiler_Webservice"> <endpoint address="" behaviorConfiguration="jsonBehavior" binding="webHttpBinding" bindingConfiguration="" contract="PCMiler_Connect.PCMiler_Webservice" /> <host> <baseAddresses> <add baseAddress="http://localhost:7600/" /> </baseAddresses> </host> </service> </services> <behaviors> <endpointBehaviors> <behavior name="jsonBehavior"> <enableWebScript/> </behavior> </endpointBehaviors> </behaviors> </system.serviceModel> </configuration> Service Wrapper using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.ServiceModel; using System.Text; using System.Threading; namespace PCMiler_WIN_Service { public partial class Service1 : ServiceBase { ServiceHost host; public Service1() { InitializeComponent(); } protected override void OnStart(string[] args) { host = new ServiceHost(typeof(PCMiler_Connect.PCMiler_Webservice)); Thread thread = new Thread(new ThreadStart(host.Open)); } protected override void OnStop() { if (host != null) { host.Close(); host = null; } } } }

    Read the article

  • Masters in Computer Engineering

    - by Eliot
    How difficult would completing a masters in computer engineering without having an undergraduate engineering degree. Top program vs. middle of road make a difference? Finance/Accounting undergrad 4 core computer science classes (OOP foundations)

    Read the article

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