instruction
stringlengths
71
71.9k
I have some .csv files compressed in .bz2 format. I need to take a subset of the records (and data) and switch to .gz. I am not happy with the performance. Is there a more efficient way to do it? //For each file in a folder: try (BufferedReader br = new BufferedReader(new InputStreamReader( new BZip2CompressorI...
This little function can make object creation much easier. Sometimes you need to switch between representing your data as objects vs. having the members in separate containers. Example: class Foo { public: Foo(int a_, double b_): a(a_), b(b_){} int a; double b; }; And then: std::vector<int> as = {1,2,3,4,...
I want to compare the values in two arrays. The order of the values doesn't matter. Basically they are two Sets. This function returns true if the values are the same in both arrays, or false otherwise. function compareSets(a1, a2) { if (a1.length !== a2.length) { return false; } var len = a1.lengt...
I am starting an angular app and I was wondering if I am on the right track with this. I worked on my last angular app when I was just a youngun who didn't understand the important of designing the code properly. I failed so hard at keeping the code clean and maintainable, mostly due to not understanding directives or ...
(define (tridiagonal n) (build-list n (lambda (x) (build-list n (lambda (x) (cond [(= x n) 2] [(or (= x (- n 1)) (= x (+ n 1))) 1...
This is not "real life" code. I'm trying to expand upon the well known Sakila sample database for MySQL to make it more complex. Step 7 (or 6) is running surprisingly slow. PS: Note these are all separate queries executed against the same database in the order specified. Add columns to sakila.customer table: USE sak...
I wrote a function to convert a hexadecimal string representation (like 0x00) of some binary data to the data itself. How can I improve this code? QByteArray restoreData(const QByteArray &data, const QString prepender = "x") { QByteArray restoredData = data; return QByteArray::fromHex(restoredData.replace(prep...
I'm try to create array of strings from a text file. I need a review from experienced programmers about my program. (MinGW gcc, Win7) #include <stdio.h> #include <string.h> #include <stdlib.h> main() { FILE *file; char *fname = "lines.txt"; file = fopen(fname, "r"); if(file == NULL) printf("Can't read %s", fname...
Can someone check my Merge Sort implementation on Java? Is it good/bad and can it be improved further? public class MyMergeSort { private int [] data; public MyMergeSort(int[] data){ this.data = data; } public int[] sort(int[] data){ if (data.length < 2){ return data; ...
I'm using Express 4 to provide routes to HTML/Jade files, and as well to provide an API. I want to separate routes from server file, and go even further- separate API from WWW. My code now looks like this: server.js //================== ROUTES ====================================== require('./routes/api')(app, express...
I've created a Views Counter in Python, Gevent and MongoDB (Flask is also included in the full stack as you can see from the context issue in the code). My gut still tells me that it can be still somehow improved though. What the code does is initializing a dict "buffer" (just a shelve persisted in memory [no writeback...
Here's part of code in Java for battleships game I'm working on: lblGrid2 = new JLabel(new ImageIcon(myPicture)); lblGrid2.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { for (int i = 0; i < shipList.size(); i++) if (shipList....
I defined a function that multiplies its argument by 3: coffee> foo = (x) -> x * 3 [Function] We can call it with an input of 1: coffee> foo(1) 3 However, when I tried with a non-Number type: coffee> foo("3") 9 This behavior appears wrong to me since a String cannot be multiplied by a Number. To fix it, I'd add some...
In Kernighan and Ritchie (the C programming language): Write a program to copy its input to its output, replacing each string of one or more blanks by a single blank. I wrote the following code. Do you have advice to improve it? #include <stdio.h> /* copy input to output, replacing each string of one or more blank...
There's a new version of this as v2 - Adding a duplicate entry randomly into a list in haskell using random monad I wrote this trying to set up a Haskell testcase. The aim is to take a list and add a single duplicate from any place in the list to anywhere else in the list. I'm trying to learn to use the Random Monad p...
I have 3 tables, 1 where voters information is stored, 2 where their address is stored and 3 where voter ids are matched with address ids. I thought this approach was best as several voters can occupy the same address. Now I have Query that selects all the voters on a given street / road. Although it works, I'm not su...
This problem: The Shallow Alto city council has organized a special committee to review the traffic situation in the city. Despite the fact that there is nothing whatsoever to do in the city, citizens still write complaints about the amount of time it takes them to get from one unexciting location to the next. The com...
I'm taking user input from a file in form (1, 2, 3) to create a color, and I just wanted to know if I was taking most cases into account, and if there is any way I could improve this method in terms of being robust and readable. private Color getColorFromString(String rgb) throws MalformedColorException{ rgb = rgb...
I am working on a bookmarker project for replacing storage of bookmarks in a web browser. It will be storing bookmarks as per categories in a database. I have written some jQuery for the WIP search page. A bit about functionality There is a search box for categories with autocomplete which is done by my app On clicki...
I've just started to play around with Python and I've decided to create a little script that post tweets every hour (cronjob on Ubuntu) telling what time it is. I'm not sure if I follow best practices or if I can make the code even shorter/cleaner/nicer? I'm a C# developer so I miss a few things in Python, like string....
I'm wondering what the best approach might be. One approach is to chain cachedPromise and "regular", thus, if cachedPromise fails, we call a regular one (and caching results). The second is to have a wrapper function, something like a decorator in python, and being able to wrap any promise-returning function when neede...
I was given an assignment, it was as follows: Give a JS code snippet which writes to the console from: "0" to "ZZZZZ" all the combination of the characters of a-z, 0-9 and A-Z. Is my solution correct? I am sure there are better ways to achieve the same, can anybody show some? My code is: function createCharSet(){ ...
I have a very basic OpenGL instanced rendering setup, which is compiling and running, however it is super slow, and even though I spent days of asking and reading how to fix it, I still have no clue, what causes the problem.. What does slow mean? At the moment as you can see, it draws 16 000 instances (48 000 vertices...
Please critique this CoffeeScript code. Is it idiomatic? MoneyAccount = (balance = 0) -> obj = { withdraw: (x) -> if balance < x throw new Error("not enough funds in account") else balance -= x console.log "withdrew funds." x deposit: (x) -> if (typeof x isnt ...
I am to use VBA code to simply retrieve certain data from all Excel files in certain folder and paste it in working spreadsheet. I am not sure that this is the most efficient (which matters as I would like to learn how to write the most possible efficient codes). I am using simple copy/paste actions but maybe there are...
I was recently working on a project where I had the following setup: from stargaze.sg import SGObject from stargaze.constants import NegInf, Infinite, PATH_CLAMPED, PATH_REVERSIBLE, PATH_ACCELERATABLE from stargaze.utils import clamp __all__ = [ 'PathIdentifier', '_basePath', '_clampedPath', '_reversiblePath', ...
I have both the regular for each loop and its equivalent paralleled version. The loop simply iterates through a collection, looking for the rate key in a local db instance and then updating the topic code. using (var db = new SomeEntities()) { foreach (var measure in measures) { var keytofind= measure....
I ran into a problem recently where I had to decide whether a set of sum types was homogeneous (all the same). In itself, this is a pretty simple problem. However, there were a few complicating factors: There exists a type within the types (call it Id) that is ignored in the comparisons. There exists a type (call it M...
I need a lock-free queue which is implemented by doubly linked list. Is my code correct? Are there any errors? Are there any improvements to be made? linkedlist.h /* * linkedlist.h * * Created on: 2014. 5. 10. * Author: dlaru_000 */ #ifndef LINKEDLIST_H_ #define LINKEDLIST_H_ /* * circular doubly linked...
I've been designing UIChessboardView in the likeness of UITableView using protocols and delegates. UIChessboardView.h @interface UIChessboardView : UIView @property (retain) id chessdelegate; -(void) selectChesstileWithID:(NSInteger) tileID; -(void) deselectChesstileWithID:(NSInteger) tileID; @end @protocol Chessb...
I was attempting to write my own simple version of the Piano Tiles game app in Java just as a fun exercise. GameLogic.java import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; public class GameLogic extends JPanel { Tile[][] tileArray = new Tile[4][10]; int lowestIndex; i...
I understand that using goto in C++ code is strictly unadvised, but sometimes, it really reduces the number of lines of code like in the following case. This is my code for SPOJ. I know this does not reduce too many lines of code, but in a big project, it potentially could. #include<iostream> #include<cstring> #include...
The following is my solution to Java vs C++. I think the way I have used the re library is inefficient, and possible erroneous as I am getting tle. import sys import re cpp = re.compile("^[a-z]([a-z_]*[a-z])*$") java= re.compile("^[a-z][a-zA-Z]*$") r = re.compile("[A-Z][a-z]*") lines = [line for line in sys.stdin.read...
I wrote a program for downloading files in concurrent / parallel (GOMAXPROCS > 1) manner. This is my 2nd (non-toy) program written in Go. Please point out areas for improvement: package main import ( "errors" "fmt" "github.com/kennygrant/sanitize" "github.com/nu7hatch/gouuid" "...
I'm designing a simple GUI using tabs to separate each 'window' of the application. There are 3 main tabs, each with 2 sub-tabs. In one class I create the entire hierarchy of panes and panels: mainPane = new JTabbedPane(); mainPane.setBounds(0, 0, WIDTH, HEIGHT); //instantiate main tabs, get panes added to them create...
I know using global variables in JavaScript is bad practice. Here I am using config, host and port as global variables as I have added a watch function to watch for the changes in the config.json file. Is the use of global variables in this example a bad practice or is it ok to use them? config.json file { "host"...
#include <stdio.h> #define MAXLINE 1000 /* Maximum length of a line */ #define TABSTOP 4 /* Length of tabstop */ int getLine(char line[], int limit); int lookAhead(char line[], int start, int end); /* * Exercise 1-21 * Write a program entab that replaces strings of blanks * by the minimum...
In the Python library, sklearn is implemented the algorithm for SparsePCA. I have written the code for a another version of this algorithm that is much faster in some situations. I have not enough experience with Python and sklearn in order to write code that could be loaded in the sklearn repositories. It would be n...
Background I was writing a promises/a+ implementation, just for fun. About halfway through I decided it wasn't that fun after all, so I decided to do something a little different. Thinking of promises as a pattern (and not a contract), I figured they basically amount to the following (if I'm missing the point, please c...
I'm using passport to setup login in an express site. The site is just a playground for me to learn. The code inside login was exhibiting the arrow anti pattern so I decided it was time to learn to use promises. But I don't know if what I've arrived at is good, bad, idiomatic, or idiotic. Any and all feedback appreciat...
I am trying to print a board exactly like this with the multidimensional array. char score[10][10] = {' '}; a b c d e f g h i j +-------------------+ 0| | 1| | 2| | 3| | 4| | 5| | 6| ...
This is the first time I've actually made my own jQuery script from scratch, because I couldn't find exactly what I was looking for. My code works how I want it to, although I don't know if I did it correctly. Just something about it is screaming to me, and although it works, I didn't do it properly. So I figured I ...
I feel like there is too much repetitive code going on here. All I am doing is doing a basic regex match for a string in the URL. If a match is found, I find a li with a class (.index, .grid or .type) and add the active class. This is just for my main nav in an attempt to make it somewhat dynamic. However, I feel like ...
Please let me know if you see any performance improvements, bugs, or anything you'd change and why. public static bool TrySpeculativeUpdate(ref int field, out int result, Func<int, int> update, Func<int, bool> shouldAbort) { SpinWait spinWait = new SpinWait(); while (true) { ...
I have this JavaScript excerpt, and I was wondering if this (primarily the usage of switch case) would be considered good practice. One item of note is that I have it separated into two similar parts to not evaluate the same boolean check over and over again when it is static the whole time. if (strict) { for (var i ...
Please help in code reviews for readability, optimizing it, functionality etc. import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.math.BigInteger; import java.util.ArrayList; public class Merge { static BigInteger cntInv = new Bi...
I wrote a simple class that substitutes all file inputs in an HTML for a more complex template and set some actions on it. The code is rather small, but I'm not used to write JavaScript. I wonder if there is a design pattern or extensively used way to set the callbacks? Of course, overall improvements are welcome as w...
I have a WPF MVVM Application. I have a Customer Model which is generated by an entity framework (Database first approach) and one CustomerViewModel where I created an instance of a Customer Model and used Model members inside the ViewModel property get and set. Here is my Customer Model: public partial class TblCusto...
The backend supplies an attribute called content which clashes with the controller content, so I'm remapping it: App.Webinar = DS.Model.extend({ body: DS.attr('string') }); /** * Remap content -> body so it doesn't clash with the controller. */ App.EventSerializer = DS.DjangoRESTSerializer.extend({ normalize: fu...
I am trying to learn the clean architecture by Uncle Bob. I wanted some basics and following this good post I tried to implement it in python with some minor differences. class ValidationError(Exception): pass class Repository(object): repositories = {} @classmethod def register(cls, type_, repo): ...
I've been working with jQuery for a few days now and starting to get the hang of it (it does the thing that I want to do). I've made an accordion, and the header of each accordion item has an arrow that points up (for being open) or down (for being closed). This code works fine, does what it has to do. When I wrote it,...
By any means, if any can tell me if this code can be more optimized than it already is, please say so. It's a select statement to my PDO class. When I glare over my code, I'm certain there is a lot of easy improvements. public function select($table, $where = array(), $Innerjoin = array(), $group = array(), $select...
The SPOJ problem: Given a 40 character string representing outcomes of 40 coin tosses, find the frequency destribution of all the possible outcome triplets. So, for string like : HHHH....40 Hs ,the result is HHH : 38 and the rest 0. The exact input output format is given in the link. My approach, as is clear fr...
I have a script used for installing few rpms depending on operating system type. Here in this example, the script will install packages on two system "centos" and "suse". The system names are listed in nodes.txt and read as an input while executing the script. For example: ~]# cat systems.txt centos suse ~]# ./myscr...
I am a big fan of one-liners using sed awk perl and other tools. But there are that are things hard to do in one-liner, such as when you working with a CSV file and there are commas between quotes, or when you want to print a centralized field with printf. A few months ago I wrote ftable more for fun than anything else...
I'm just looking for some review for my code. This is a script that checks for outbound links in posts in vBulletin forums, and if it is an external link it will redirect to a template which will load the external site in an iFrame that I also coded, inspired by themeforest and stumbleupon's way of showing external li...
This is my first real web project and I have never touched JavaScript (barely touched CSS), so I just skipped that and went to dart for fun. Here's a live demo The code for the dart file is down below. If you could help me improve the code in any way, that would be nice. Sudoku.dart import 'dart:html'; TableElement ...
I have some lines that form triangles. I'd like to challenge the fastest way to find all triangles. In particular the code should take an ArrayList of Line2D object and return an ArrayList of Triangle2D. The only constrain is to use p1.distanceToSquared(p2) < 1) as equal function. Note: My code does not work because i...
I have created a PHP to change the user's login password: <?php require_once('Connections/conexion.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gp...
I'm new to CSS and HTML and while I've achieved a centering of the logo and navigation links, it feels wrong. I'm developing a site for a small non-profit for a side project. I have a logo next to a few navigation links. I put the logo and navigation links in a list. Could someone take a look at this and tell me if ...
I implemented std::stack from the STL for deeper understanding of the language and memory since I still am only a beginner. I implemented the stack using a singly linked list. Header file: /* Header file for abstract data type "STACK" implemented using a linked list */ #ifndef STACK_H #define STACK_H template <class...
I have the following code that splits a combination of names on either the word and or the & ampersand: var name = 'Ron & Peggy Sue'; //or 'Ron and Peggy Sue'; if ( name.indexOf('&') > -1 ){ names = name.split(/ & /g); } if ( name.toLowerCase().indexOf(' and ') > -1 ) { names = name.sp...
This is a follow-up to this post. In this project (C# Win forms) I'm supposed to calculate wages of employees. These are the steps: Calculate earnings from Attendance data. Here all regular earnings like BasicSalary, OverTimeAmount etc will be calculated. Then these earning details will be shown in a grid where user c...
The problem statement can be found here. In short, here's what the problem is about: You're given a set of numbers and you need to find whether the the numbers are ordinary or psycho. For a number to be psycho, its number of prime factors that occur even times should be greater than the number of prime factors that oc...
Here is the piece of my controller action that takes a session[:auth] hash and then assigns the values to the ActiveRecord object represented by @user whilst the key names happen to be the same. def new @user = User.new if session[:auth].present? @user.first_name = session[:auth].extra.raw_info.first_name ...
In a wage processing system which employees MVP pattern We have Model classes WageInfo, EarningInfo, DeductionInfo and AdvanceInfo and entity class Advance. (With several other classes) EarningInfo and DeductionInfo has a composition relationship with WageInfo (contained in WageInfo) and also since Advance amount is a...
Assumptions: The array is sorted. There is only one duplicate. The array is only populated with numbers [0, n], where n is the length of the array. Example array: [0,1,2,3,4,5,6,7,8,8,9] Here is my implementation: public static int DuplicateBinaryFind(int[] arr, int left, int right) { int dup =0; if(...
I'm a beginner in MVP design pattern and In a MVP triad, I have Model - AdvanceInfo View - AdvanceForm Presenter - AdvancePresneter and Entity class Advance as follows. public class Advance { public int AdvanceID { get; set; } public decimal AdvanceAmount { get; set; } public DateTime AdvanceEnteredDate { ...
I have wrote a program that lets the user open up their text file that would look something like this: 1 2 3 4 5 6 It would then let the user enter a name for the list such as "numbers" The program would then let the user choose where they want to save the list. The user would then click go and the program would turn ...
I want to insert all rows of an SQL server Table into a BigQuery Table having the same schema. The streaming insert row by row is very slow: to insert 1000 rows the execution of the code below took about 10 minutes. In this code I loop over the first 10 files in a certain folder, and I insert the content of this file i...
I am trying to write binary values in a file using fputc. In my case it is a short int. The file must be opened in "w" mode. I'm using this function, which is working. I need to know if I'm doing it right or if there are cases that I hadn't anticipated. void writeListPos(Compressor* comp, short int listPos){ ++list...
There many other better ways to parse BLAST output in .xml format, but I was curious to try using regex, even if it is not so straightforward and common. Here is the code how to extract translated query sequences from BLASTX output in fasta format. ################ fasta_out = True ################# import re import sy...
This loops through a vector of vector of A and adds a smaller array to a bigger one at a specified position+random shift. Then it is checked if it is a better solution, and if yes, it is stored, else it is discarded. I have already parallelized it. Can this be improved to run faster? I am not sure if a vector<vector<...
Is there anyway to simplify this code so there aren't so many redundant w = File.AppendText(filePath) and w.flush() and w.close() in each if statement? Anything else I have tried ends up locking the file, and crashing the site because to text file is in use by another process. Public filePath As String = "c:\inetpub\lo...
I recently handed in a test assignment for a job application, which I was declined, with the motivation that it had scalability issues. The test was to setup a REST-like backend for a hypothetical game, with three methods: create session with a given user id (implicitly creating the user if it did not exist). register...
I have made the changes that people have suggested from my previous question. I want to try and make it even tidier if possible. What can I change to make it more optimized? My imports are quite messy and I am not sure what ones I actually need, so if you can help with that, please do. #Imports import tkinter from tk...
In an attempt to begin properly programming in Haskell, I wrote two functions for calculating numbers and sequences with Collatz's conjecture. I also commented the program quite a lot, because it helps me with my remembering of certain things. -- The Collatz sequence takes in a number, and either -- divides by 2 if it ...
Convert a sorted linkedlist into a balanced binary search tree. Looking for code-review, optimizations, and best practices. public class SortedLinkedListToBalancedBST<T> { private TreeNode<T> root; private static class TreeNode<T> { TreeNode<T> left; T item; TreeNode<T> right; }; ...
Any ideas to simplify this beauty; I would prefer a LinQ expression if possible: private object[] array; public abstract bool Condition(object o); //... private object FindStuff() { for (int i = 0; i < array.Length; i++) { if (Condition(array[i])) { return i == 0 ? null : array[i-1];...
This program calculates the \$n\$th fibonacci number, in \$O(\log n)\$ time. I'm looking for code review, optimizations, and best practices. public final class Fibo { private Fibo() { } public static int getNthfibo(int n) { if (n < 0) { throw new IllegalArgumentException("The fibo value ca...
I am working on a simple "to do list" app in Django (two models: List and Item). I'm trying to learn and make use of class-based generic views. I have the following three display views working, but am requesting a quick code review to see if there's anything I can do to improve my usage/understanding of Django's ListV...
I decided on making a small notepad editor in Java using Swing and I think it functions pretty well. Unfortunately, my skills in making my project tidy and organized has abandoned me; it looks like spaghetti code, which many renowned programmers discourage from doing. What can I do to make my code simpler? Note: The JF...
I recently wrote a DSN class for use with the Access flavor of VBA. I'm preparing to refactor and would appreciate feedback. I am aware of two issues. I added the findSectionKey() function to the Registry class (which is separate and out of scope for this question) that I call, but never went back to remove the duplic...
Would someone tell how I can improve this piece of code? <?php include_once './Core/Database/Db_connection.php'; class Post extends Db_connection { private $totalPage; private $per_page; private $page; function __construct() { parent::__construct(); } function set_per_page($per_pag...
For a given file name path, I need to get the folder one level before it. This can be accomplished in ruby with the following code: File.dirname(File.dirname("/a/b/c.txt")) => "/a" Independently from this exact case, how can I DRY two method calls in sequence?
Using .net 3.5, implementation of the repository pattern along with enterprise library 5 and stored procedures. Did not use EF, stored procedures already available and VS2008 is limited to EF 3/4. Looking at the following code, what are your recommendations for each section: Domain/Repositories/IRepository.cs public in...
I find myself frequently converting between formats, so I have come up with the following conversion framework. The converter interface surfaces a method to convert from a source type to a target type. public interface IConverter<in TSource, out TTarget> { TTarget Convert(TSource source); } The factory is for prod...
I've written a program for calculating the future date after certain number of business days. function add_business_days($startdate,$businessdays,$holidays,$dateformat){ $i=1; $dayx = strtotime($startdate); while($i < $businessdays){ $day = date('N',$dayx); $date = date('Y-m-d',$dayx); ...
I'm new to C# and OOP and am struggling to move away from the procedural way of doing things. I understand the tutorials I have looked at but find it more difficult when actually doing something a little more involved. The code works out the number of presses and time taken for the supplied message. public partial cla...
I'm trying to set up a very lightweight permission system using Google App Engine and Flask. The end result I am hoping for is that each individual view is its own permission, and in an admin panel you can assign the views each user is allowed to see. How would I set this up better? It works fine, but I'm going to be q...
I am new to programming and entirely self-taught. Below is a program I wrote to retrieve text content via an API and scan the text for important words. If the word is found URI is returned. The API returns data in JSON. The important words and URIs are linked via a dictionary. It works. I'm at a point in my programming...
A friend of mine has a spreadsheet where she coded a classroom video for various teaching events, which I needed to help her plot. For each recording, she used several video cassettes, and her time codes were relative to each video cassette (ie. they always start on 0). To be able to plot these on a timeline, I needed ...
Description To make it simple, this code is the Controller Packet corresponding to a View with multiple tabs. All but one of these tabs are showing a list of dependent entries. This Construction was once a single class, that did everything and I thought "Why not refactor that thing?" So I began to extract functionality...
I am using a script to open a bunch of Excel files, copying two or more sheets into a new file and saving this new file. It sure beats doing it manually, but I think it could be faster. Here's my script: Sub Flujo() Const FilePath = "A path..." Const Destination = "Another path..." Dim app As New Excel.Application ap...
No, this question has no roosting construction workers. I'm not sure if what I'm doing is a good use of the builder pattern or whether its a bastardization of what its intended purpose was. I'm trying to set up mocks in my tests and find myself repeating myself often to set up the mocks, so I've tried to simplify it us...
I tried to create a class which downloads the HTML source from a link and saves it. I'm a newbie to all this Android stuff, even new to Java, but this is what I have so far. It seems to work at least, although I cannot see the file since it is hidden. package com.example.test; import java.io.File; import java.io.FileN...
I've written ordinary least squares fitting of market data for learning purposes, so performance is not an issue. I'd like a reviewer to look at correctness and programming flaws, if any, in the code: #!/usr/bin/env python import math import sys import csv import traceback import ipdb def excepthook_pm(typ, value, ...
I'm trying to extend bootstrap 3 modal window with ability to disable closing it. I've built this code: (function ($, window, document, undefined) { var oldHide = $.fn.modal.Constructor.prototype.hide; $.fn.modal.Constructor.prototype.hide = function (_relatedTarget) { if (this.isLocked) return; ...
So I wrote this class to handle my ajax calls simply: ajaxCon.php: class ajaxCon{ private $init = false; private $functionArray = array(); private $Message = false; private $function = null; private $arguments = null; private $post = null; public function __construct(){ if(!isset($_...
Is there a more efficient way to write this? This script will be used heavily and I want to make sure I do not have any memory leaks or speed issues. This script gets an input from a form and searches the database for that record. <?php date_default_timezone_set('America/Los_Angeles'); $hostname='xxx'; $username='xxx'...