instruction
stringlengths
71
71.9k
I have a PDO class below: class DB { private $dbh; private $stmt; static $db_type; static $connections; public function __construct($db, $id="") { switch($db) { case "db1": try{ $this->dbh = new PDO...
I use a worker thread for some data processing in my MFC project. In the thread-controlling function, it needs to use some parameters (declared as member variables) to the data-processing. I use a sub-dialog (which is triggered by a menu item and contains a few edit controls) to change the values of the parameters, tha...
I am trying to display the leave history of a particular employee. But, when I choose a particular month (for example, I choose to display January instead of displaying the history of January), it displays all the history from this year. Is there anything wrong with my code? <?php echo 'View the application history b...
Recently, I've noticed that my code looks so ugly because there were a bunch of functions and global variables. So, I started reading a little bit about design patterns. Now I come with something that's working for me, but I am not sure if it's good practice. Anyway, I would like you to take a look at the code and tel...
I'm fairly new at JavaScript, and I'm finding that JS is a language with what seems like an unusually high number of gotchas for the inexperienced, so some criticisms of this code would be particularly appreciated. The function getProperties below is a relatively simple function that returns an array of the names (not ...
The following is a code to detect a loop in a linked list. This question is prepared strictly for interview purposes. This code has been modeled as per Linkedlist.java How should I decide if a function like hasLoop() should be included as an instance method or should be a static method similar to sort in Collections.j...
I posted this question over at Stackoverflow, which was off-topic. I was using ObservableCollection in a number of places in my WPF application for very large arrays. This caused a problem as ObservableCollection did not take an argument for capacity like List did. This was an important optimization for locking down m...
I have a rather clunky function that returns a number based on certain values: local = {'abs154': '4'} w12,sv2,sv4,sv6,sv8,sv10,sv12=75,95,110,104,101,110,116 supers = [["5", w12], ["6", w12], ["7", w12], ["8", w12], ["16", w12], ["17", w12], ["18", w12], ["9", sv2], ["11", sv2], ["12", sv2], ["13", sv2], ["14", sv2]...
I am using ExcelDataReader to import an Excel file to a dataset. Example Excel table: //ID Name Display Order Active //1 John 1 1 ID, DisplayOrder and Active columns are read as double, so I have to convert them to long, int and bool types respectively. I need to create a list of...
My code looks ugly. What can you recommend? I already know about Enum; maybe it's a good variant for this situation. Anything else? private void writerContent(Integer firstRow, List<Record> records){ int firstColumn=0; int lastColumn=7; XSSFSheet sheet = workBook.getSheetAt(0); for (...
I am developing a webapp using Spring MVC + Hibernate. I created a GenericDao class that implements basic data access methods, to be extended by all my concrete daos in the app. What I want advice or review about is the exception handling of the data access layer exceptions. Let me post a shortened version of my generi...
A few days ago, I posted my version of a wildcard search algorithm, which you can see here: Wildcard search in C Today I'm showing version 2. I didn't want to make it in the same post because the code is quite different. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #define MULTICHAR ...
I am using db_dataobject and have provided two examples of an insert and a select query below. Can you please help me rewrite them in a more secure way using PDO? Is there any other way to improve them? INSERT $user= new DataObjects_user; $user->username = mysql_real_escape_s...
Any suggestions how to make this code better? I'm novice in coding...)) In this code I'm want to show some hint depending of browser type on semi-transparent overlay. I'm detecting browser type (I'm need - Firefox, Chrome, IE 9 and higher), create all nessesary elements, append this elements to a document.body, and att...
Moved from Programmers.SE. I have written a new version of the PBKDF2 algorithm in Haskell. It passes all of the HMAC-SHA-1 test vectors listed in RFC 6070, but it is not very efficient. How can I improve the code? I plan to upload it to Github (and maybe Hackage) once it is improved. {-# LANGUAGE BangPatterns #-} {- C...
I have working code to show in index.php and content-gallery.php of WordPress with Bootstrap 3.0 Carousel. But, I know it's not clean code. Could anyone help me clean/improve it? This is the code we need to generate Bootstrap Carousel: <div id="carousel-example-generic" class="carousel slide"> <!-- Indicators --> ...
I wrote this program which takes all the bits in a number and shifts them to the left end (for example: 01010110 --> 11110000). It's and exercise from a book. It works, but it seems to be very wasteful to use integers (I only need 8 bits). Can you tell me if the code is proper or not? Is the algorithm good? #include <...
I have a defaultdict being written to file like this: writer = csv.writer(open(locationToSaveFile, 'wb+')) for k,v in dict.iteritems(): writer.writerow([k ,v]) I then have this horribly convoluted text to read it back in: myDict = defaultdict(list) with open(fileLocation, 'rb') as test: reader = csv.DictR...
Consider the query given below: SELECT * FROM ((SELECT c.cust_id , c.username , REPLACE(qs.seg_type_ref_key_02, 'N/A', 'Non Vip') casino_group, REPLACE(qs.seg_type_ref_key_03, 'N/A', 'Non Vip') bingo_group, REPLACE(qs.seg_type_ref_key_04, 'N/A', '...
Today I decided to get into F#. I watched this video and had a bit of fun doing some coding examples, I can see that it will be very useful for certain programs that I write. One thing that I was interested in are the explicit member constraints and how they might be used to help with the generic constructor limitatio...
To execute tasks sequentially with a timeout I use ExecutorService.submit() and Future.get(). As I don't want to block calling clients, I implement producer–consumer pattern with a queue into a Thread while(true) loop: import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import j...
I needed to perform network communications in my Linux C++ project. I thought that it was a good idea to operate on a higher level of abstraction than raw system calls. Also I love OO design. So I'm implementing an object-oriented high-level Unix network open-source library (There are issues with tab-size if you watch ...
The code below gets value from a column in an Excel sheet. The values I get are B1, B2, B3, B4...., B100, ...Bn. All I need to do is strip out the char 'B' and convert the numeric string to integer and count how many times a particular integer has repeated. The snippet below shows the string stripping the char 'B'. Ho...
My current task is to extend some JavaScript of a framework we are using. A pop-up should slide in, instead of just appear in the middle of the window. So I have overridden one of the framework's methods, and do at the end this: AdfDhtmlPage.prototype.showMessages = function (componentId) { // Some code here function...
I've been studying Reservoir sampling for a couple of days. What I've tried here is draw a uniformly random sample of size 3 from bigger data (the 26 characters of the English alphabet) via reservoir sampling. Below is what I've come up with. If anyone could review my code and offer some suggestions, that'd be great. ...
I have a bunch of IP addresses. I want one IP network that has them all. ipaddr.collapse_address_list already exists, but that gives you a list of all the IP networks that identify your IP addresses, no more, no less, whereas I only need one IP network. I tried at first using XOR, but that fails on some situations (say...
Below is how I'm solving the problem of converting between data and presentation types, I'd like to know if that's a good way to go about it, and if not, what would be a better way to go about it. I already had an IViewModel interface: /// <summary> /// An interface for a ViewModel. /// </summary> public interface IVie...
I am having an issue where I am doing a query and it is coming back with about 100 pages, I was hoping to have it come back with 1,2,3...30,31...99,100 instead of 1,2,3,4,5,6,7,8,etc. please see below for working code that returns back results as unwanted format, I am new here so if this question is written wrong pleas...
What's a concise way of returning true or false along with an error message? Here's a concrete example - I'm building a parser that takes in a file. ParseReplayData does some validation before proceeding with the actual parsing: public class Parser { private const string SUPPORTED_FILE_EXTENSION = "w3g"; privat...
This is my first C++ program with classes, and I don't want to develop bad skills. It's very simple and consists of 3 files. This is an exercise from a book, hence the name of the driver file. Please tell me whether it's proper or not! parity.cpp: #include <iostream> #include "parity.h" void Parity::put(int number) {...
I want to ensure that, as much as possible given my skill level, that I'm using relevant patterns correctly and following naming conventions. This is a controller for a poor-mans MUD client using Apache TelnetClient. The project is on GitHub. The startReadPrintThreads starts threads by instantiating workers, which in...
I choose to use a dictionary to store the variables for fast GET and SET commands. In my code, I have saved all of the open transactional blocks in memory. I can't see any way around this since it is always possible to have enough ROLLBACK commands to access all open blocks. One problem I do have is that numequalto...
The object is to be able to pass some dates (start date, holiday) and the number of days you want to skip. We only want to skip working days, not weekends and holidays. Just let me know what you'd do different than what I have. The code works, but I was told there are issues with it, but not told what issues they are....
I have created a linked list in C++, I suspect there is a good chance I have made some larger errors in this code as I am working with a few concepts new to me. Please be very hard on me as I want to eventually be good at this. #include <iostream> // basic linked list implimentation in C++ using templates template <...
I'm fairly new to MVC concepts and PHP input validation. I'm open to all input, but I'm largely wanting to know if the following: Follows the MVC pattern correctly - if not, how can I change it to better follow that? Has any huge apparent security flaws with the validation procedure - if so, what are they and do you ...
I am working on a project in which I will be having different Bundles. Let's take an example, Suppose I have 5 Bundles and each of those bundles will have a method name process. Below are the things, I am supposed to do- I need to call all those 5 Bundles process method in parallel using multithreaded code and then wr...
package utils; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import com.google.gson.Gson; public class JSONUtils { public static final Gson gson = new Gson(); public static String toJSON(Object o, String... fields) { HashMap<String, Obj...
I have spent about 2 weeks reading about hashing passwords and website security. As there seems to be many different ways to achieve this, I'm a bit confused as to whether my code is secure. Can anyone please have a look through and let me know what they think and what needs to be changed? I have not added any error tr...
Consider the following: If myString = "abc" Or myString = "def" [...] Or myString = "xyz" Then In C# when myString == "abc" the rest of the conditions aren't evaluated. But because of how VB works, the entire expression needs to be evaluated, even if a match is found with the first comparison. Even worse: If InStr(1, ...
A while ago I implemented .net's string.Format() method in VB6; it works amazingly well, but I'm sure there has to be a way to make it more efficient. I'll start by listing a simple class called EscapeSequence: Private Type tEscapeSequence EscapeString As String ReplacementString As String End Type Private thi...
I need to make sure the correct menu item is highlighted according to which URL is currently being viewed. Now the problem with our site is that each menu item can represent several pages. So the Client menu will show the client list - but should still be highlighted when you go to the edit client page. So I can't par...
I am trying to evaluate if someone has read and seen all the questions of a book. I am using PHP to average everything out after I get the data. I know MySQL can avg, but I can't seem to wrap my head around how I can average the box number of the questions (similar to spaced repetition learning) if they haven't seen ev...
Every coder knows that if you give six developers an assignment to write a bit of code that will perform some specific task, you will end up with at least six different ways of doing it. I recently realized/discovered a radical example of this. I wrote some code to calculate check digits for barcodes. I then found some...
I'm not a great JS coder so I need your expertises to look into my code (although nothing very special and it works fine) to see if it is good practise or not because I heard that dodgy JS coding might slow down the site especially when it comes to reading mouse or user events. function textbox_clear_default(form_fie...
I am trying to implement strings tokenizer in Excel via UDF using C# and Excel-Dna. Personally I found the mIRC's function $gettok pretty useful due to the lack of string functions in Excel. Examples getTok("Aquel que no espera vencer ya esta vencido", 1, 32) -> "Aquel" getTok("Aquel que no espera vencer ya esta venc...
The Problem As an ASP.NET MVC4 developper, I'm using Entity Framework a lot. Considering performance I often use lazy loading for my models. public class Result { public int Id { get; set; } public decimal Grade { get; set; } public virtual Skill Skill { get; set; } public int SkillId { get; set; } ...
We are starting a new web project using C# / MVC4 and Entity Framework 5 for data access. I've decided to go with an n-layered approach for the structure of the project and I would like some feedback on my design decisions. This is how the solution is structured: Project.Model (Class Library): Contains EF .edmx, entit...
I am very new to Scala. I have done an exercise using Scala to solve the maximum path problem. Basically, I have a triangle of integers, I want to find the path from the top to bottom which the numbers on the route produces the largest sum. For example: 5 12 3 2 4 9 1 9 12 7 Should r...
My goal was to get the following code to work: #include<iostream> #include<vector> #include<list> #include<algorithm> #include<array> #include"functional.hpp" int main( ) { std::vector<double> a{1.0, 2.0, 3.0, 4.0}; std::list<char> b; b.push_back('a'); b.push_back('b'); b.push_back('c'); b.push...
Can someone improve this for me? It seems ugly. The method should test whether an incoming number is a palindrome and return a Boolean result. private static bool IsPalindrome(int value) { var inverseValue = string.Concat(value.ToString().Reverse()); return inverseValue == value.ToString(); }
Background Python (version 2.7.2) Problem You want to specify an array in your code. You want to use the 'syntax sugar' available in Ruby and Perl. You are a fanatic about readable code but also saving keystrokes. Solution Python Triple-quoted string Python splitlines Python list comprehension Pitfalls The solut...
I recently had to write a function to return characters missing from an input string. Here is the snippet #include <bitset> #include <string> template<class Iterator> std::string getMissingLetters(Iterator begin, Iterator end) { std::bitset<26> letters; for (auto it = begin; it != end; ++it) { size_...
I have the following HTTP reply saved in a local file called source.txt: HTTP/1.1 301 Moved Connection: close Content-length: 111 Location: https://11.12.13.14:81/ Content-type: text/html; charset="utf-8" <html><head><META HTTP-EQUIV="refresh" CONTENT="0;URL=https://11.12.13.14:81/"></head><body></body></html> Sour...
I know that the DBContext represents a session (Unit-Of-Work and Repository) with the database, however I an unsure as to when I should have a different DBContext. Currently, I have a separate DBContext for each table with a single DBSet for each DBContext. Something like this (Blogs and Posts are in the same database)...
I have this piece of code: List<myItem> items = (from x in db.myItems join y in db.tblParents on x.item_parent equals y.id where !y.hidden orderby x.name select x).ToList(); And it is really slow. How can I optimize it? I n...
I'm developing and app that communicates via Bluetooth with another PCB. It consists of 3 seekbars that regulates the value of 3 parameters of the PCB. The structure is this: Send petition string for read the first value Receive the first value Send petition string for read the second value Receive the second value Se...
The program listens to the Altera FPGA DE2 board's keys that can start and stop and reset a counter: #include <stdio.h> #include "system.h" #include "altera_avalon_pio_regs.h" extern void puttime(int* timeloc); extern void puthex(int time); extern void tick(int* timeloc); extern void delay(int millisec); extern int hex...
I have a solution in which I instantiate a class with various types inside of it. I feel it is becoming to cumbersome to instantiate and then create variables for each of the types I want to access in the class (Option 2 in the code), so I've come up with a custom return type so I only have to return data once for us...
I need to inject same variables into settings.py for multiple django apps.hence i wrote a module which takes in output of local() and modifies. This works but is it the right way to do things? def enable_theme(theme_name, container): """ Enable the settings for a custom theme, whose files should be stored in ENV_ROOT/t...
I am using VBA to manipulate the global address book in Outlook. My method takes a contact and returns a complete list of everyone who reports through that person based on the Outlook org structure. Unfortunately it takes quite some time to run, even for a single manager. I'm not really sure what is the best way to i...
I need to optimize this code so it can execute faster, even if that means using more memory: for (int t = 0; t < Clientes[0].ChildNodes.Count; t++) { for (int i = 0; i < Clientes[0].ChildNodes.Item(t).ChildNodes.Count; i++) { if (Clientes[0].ChildNodes.Item(t).ChildNodes.Item(i).Name.Contains("Service")...
The array is dynamic, can be with 7 or more keys, except the first key never changes. Array ( [0] => Array ( [ProviderID] => 1010 [ProviderName] => HAMZEPOUR, SHOKOUFEH ) [1] => Array ...
I previously posted a Reservoir-Sampling program, which was basically a test version of this one. This is an assignment. In the code below, I use RunTimeException to control when scanner finishes reading data. Reasons for this being: I cannot use any other library than java.lang. I cannot use Scanner, either. We ha...
I'm trying to design a Shader class. For now, I'm just trying to get basic outline for handling uniforms. Some design goals I aimed for is to avoid passing a string to a function as this is error prone and has no type checking. There's really only one place this can go wrong: if you mistype the name of the uniform wh...
I wrote this class to make cookie management easier. I know it makes use of serialize(), but I have no intention of storing very much data in the cookie, and it seemed a cleaner solution than, say, the JSON functions (like, even if a class implements the JSONSerializable interface, it doesn't retain the class name by d...
Please review the following Clojure tokenizer. The goal is to study Clojure, so sometimes I re-implement functions (it will be nice to see standard functions for this). Beyond of this, code seems quite cumbersome. (defn space? [^Character c] (Character/isWhitespace c)) (defn digit? [^Character c] (= (Character/getT...
module A def methodInA # do stuff methodInB # do stuff end end module B def methodInB puts "this is a B method!" end end class C extend A extend B def initialize methodInA end end c = new C I'm not feeling good about this. Is this a good idea in general? Any pointers as to whe...
We have two log files in which one is generated from a process. We compare one file(golden file) to another file to check if file correct or not. It should have same value. We generally use diff utility to compare two files. I have got enhancement to add machine information into process generated File. So I want to com...
I have a class that stores the data related to all employees in a particular department. In this class, I am having a list of employees and other fields. Also, I am having a property which returns a bool, indicating whether an employee exists or not. I am a bit confused regarding the naming of this property. class Emp...
I am creating a small app working on file system. The user can choose a directory and than, application get one of the possible result (examples): return number of lines in all *.java files return number of lines in all *.java files without comments return number of all classes return number of ifs etc... Because I w...
I have this function which is associated with a timer that I'm creating in AngualarJS. Should I be concerned about the function being able to execute quickly enough for the timer to be accurate. $scope.start = function() { if($scope.counting === true) return false; $scope.counting = true; $scope.counter = $...
Very easy question for these who spend some time on analyzing code written by co-workers. When I write my code, I do my best to write it in a very, extremely readable way. But sometimes I have an impression, that I write it too easy... Simple example: When I see such a code: public Category getCategoryType(Component c...
For a simple project, I represent a two-dimensional grid as a one-dimensional array, with both row and column indices between 1 and gridHeight. When retrieving a cell from the grid, I first need to check if both row and column IDs are within allowed bounds. public void checkIfAllowed(int row_or_column) { if ((row_o...
This is a question about whether my coding style follows AngularJS best practices. One of the selling points to Angular is directives. Directives allow you to create custom DOM with elements or attributes you create. I've found myself creating lots of directives, thinking of each one as little controls to be placed on...
I've been learning Java for about 3 weeks now, and I was hoping someone could check over my code for me, and let me know how to improve. I am aware that the maths class could be removed (I could've typed answer = inputA * inputB etc. within the switch statement) but this is just because I wanted to practice using multi...
------edit--------- note: this is for a MUD client, so the commands are issued to the MUD game server -----end edit-------- For an overview, here's the structure of the project: NetBeansProjects/TelnetConsole/src/ ├── connection.properties └── telnet ├── connection │   ├── CharacterDataQueueWorker.java │  ...
I really need a review on the structure, and how things are done. I want to improve. Command.class: <?php /** * Command * Processing commands to the server, acting, receiving response. * * @author Jony <driptonethemes@gmail.com> */ class Command extends PrepareCommand { /...
I just finished a widget clock that displays the actual seconds and changes an ImageView each 15 minutes. I have used a BroadcastReceiver with AlarmManager;. I also have setup a click on an ImageView to change it for another image and play a sound, and this image is back to an original one after 5 seconds. I'm using...
I've been doing a lot of searching on PHP, logins, forms, cookies, sessions, etc. And so, I've tried to gather all the info that I got from all over the place. But, I didn't find a place with all the info, and tried to do the best secure login I could do. This is what I have. If this ends up being good, others can u...
I am trying to learn events and delegates in C#. To do that I am trying to create a hypothetical console project where when some user submits the orders in his/her shopping cart, I need the Billing department and mailing department to handle that event. Can someone please critique this code for doing the same? using Sy...
This is a simple jQuery script that I use to vertically center elements on pages. It's quite simple, but I would love to know if there is room for improvement. (function( $ ){ $.fn.flexVerticalCenter = function( onAttribute, verticalOffset, parentSelector ) { return this.each(function() { var...
Currently, the code below looks awful because of all the callbacks involved. How can I reduce the amount of nesting? Also, would you recommend the use of q or Async.js? var mongoose = require('mongoose'); var User = require('../models/user.js'); var Genre = require('../models/genre.js'); var Album = require('../models...
I append the DOM elements dynamically, and when the data gets changed i use to hide and show lots of DOM elements. How do I improve my code? str_user_details += '<tr ><td class="td_edu td_pad" colspan="2"><div class="div_edu"><span class="headings">Education </span> <span class="user_details_desc" id="alma_span'+key+'"...
I'd really appreciate if any of you could do a code review of my Sopping cart demo. I was wondering whether this could be improved? I'm honestly trying to improve myself too! There's a small problem on the product list! looks like doest work if has more than 1 product. Demo: http://plnkr.co/edit/jLk0VdSgGYPwLhNKkcs7 va...
I use two lists of objects invoices, original list and a new modified list. I would insert in db invoices presents in the new modified list but not presents in the original list. For delete, I would remove from db invoices presents in the original list but absent in the new modified list. This is what I did and that wo...
I've written a vocabulary trainer which does a lot of passing state around, as I have an ACID-database and a temporary state. In my experience with Haskell I've learnt that overusing IO () is a code smell, I think that this is also true for state. Please have a look at the following Main.hs, which is improvable in my o...
Yesterday I found some nice video from some IT conference about removing if statements from code. I saw a very nice example of refactoring. I am curious what do you think about it, especially what weak points do you see in such approach. 1) We have a class with very "nice" method: public int inferCategoryID(Component c...
Is there a way to simplify the code below? I want to simplify it, but I don't know if it is possible. In the table below, I insert data which will end up in a MySQL table. HTML <table border="0"> <tr> <td align="center">Dată / Interval orar</td> <td align="center">Denumire</td> <td align="c...
I have written a script using Beautiful Soup to scrape some HTML and do some stuff and produce HTML back. However, I am not convinced with my code and I am looking for some improvements. Structure of my source HTML file: <!DOCTYPE html> <html> ... <body> ... <section id="article-section-1"> <div id="ar...
I've just started looking at Zend Framework 2 and Doctrine ORM, with a view to possibly using it in one of my future products. So far I have a very simple application which allows the user to select data from a 'configuration' table. This table has just one row and several columns with settings that the application wil...
char* Migrated[]={"026","109"}; int isMigrated(char* codeB) { int i; int n=sizeof(Migrated)/sizeof(*Migrated); for(i=0;i<n;i++) { if(strcmp(Migrated[i],codeB)==0) return 0; } return -1; } is this function optimised from execution time perspective ? Migrated should co...
I'm running this code with the FastMD5 library. Could it lead to memory leaks, or does it seem OK? File[] directory = new File("/PATH/TO/FOLDER/WITH/LOTS/OF/FILES").listFiles(); for(int i = 0; i < directory.length;i++){ System.out.println(MD5.asHex(MD5.getHash(directory[i]))); }
I'm working on a project for an Intro to C/Python class and am looking to improve the efficiency of the program. The program is a lottery simulation where the user inputs the number of tickets they want to buy, then generates tickets, and finally outputs the total winnings and net gain (usually loss). This is my code ...
I was tasked with writing a method which would take in an int (for amount in coins) and then convert the coins, accordingly, by counting how many quarters, dimes, nickels, and pennies were located in the amount. Afterwards, it would return a String which stated each count of individual coin. public class Coins { p...
Long story short, I would like to use OOP for my new PHP project. It has a "login" requirement (i.e. user will first need to enter the username and password (login.php), if it's correct, it will be redirected to index.php and then fetch some products information). Also there will be a settings page that allows user to ...
def fib_m_through_n(m, n): """(number, number) -> list A function which returns a list containing the mth through the nth fibonacci numbers. SHOULD BE MODIFIED IN THE FUTURE so it will remember values already computed, so when it is called again it reuses that information """ fib_list = [0...
You guess heads or tails by clicking one of the buttons on easyGUI. If it's right, you will get a "good job" message. If it's wrong, you will get a "wrong" message! After that, there is an option to play again. Please give me some feedback on how I can make my code better, if there is room for improvement. import ran...
I have a move function in this game that I'm making. It works fine, but I'd like to reduce its size a bit. function move(moveTo, direction) { switch (direction) { case "right": $('#player').animate({ left: "+=" + scale }, "slow", function () { $("#player").appendTo("#" + moveTo...
I have been writing PHP programs in the MVC pattern for quite some time. But I am not sure if I am doing it right. For instance, I have this PHP file that prints results in XML, and I put this file in 'model': header("Content-Type: text/xml"); echo '<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <response> ';...
I want to optimize the following code: #ifdef USE_SSE #define STRING_PREFETCH_TBL(ptr) \ _mm_prefetch(ptr, _MM_HINT_T0); \ _mm_prefetch(ptr+64, _MM_HINT_T0); \ _mm_prefetch(ptr+128, _MM_HINT_T0); \ _mm_prefetch(ptr+192, _MM_HINT_T0) #else #define STRING_PREFETCH_TBL(ptr)...