This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.json.JSONArray; | |
import org.json.JSONObject; | |
import java.sql.ResultSet; | |
import java.text.DecimalFormat; | |
import java.text.DecimalFormatSymbols; | |
import java.util.Locale; | |
/** | |
* Utility for converting ResultSets into some Output formats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean id="entityManagerFactory" | |
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> | |
<property name="dataSource" ref="dataSource"/> | |
<property name="jpaVendorAdapter"> | |
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> | |
<property name="showSql" value="true" /> | |
<property name="databasePlatform" value="${hibernate.databasePlatform}" /> | |
</bean> | |
</property> | |
<property name="jpaProperties"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="me" vocab="http://xmlns.com/foaf/0.1/" prefix="v: http://rdf.data-vocabulary.org/#" typeof="Person v:Person" resource="http://carlboettiger.info#me"> | |
<p> | |
<img property="depiction" src="assets/img/carlboettiger.png" alt="Photo of Carl Boettiger" style="float: right; margin: 10px 10px"/> I am | |
<a property="homepage v:url" href="http://carlboettiger.info"> | |
<span property="name v:name"> | |
<span property="firstName v:givenName">Carl | |
</span> | |
<span property="lastName v:familyName">Boettiger | |
</span> | |
</span></a>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off & python -x "%~f0" %* & goto :eof | |
# ========================================================== | |
# one way to place python script in a batch file | |
# place python code below (no need for .py file) | |
# ========================================================== | |
import sys | |
print "Hello World!" | |
for i,a in enumerate(sys.argv): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add / Update a key-value pair in the URL query parameters | |
function updateUrlParameter(uri, key, value) { | |
// remove the hash part before operating on the uri | |
var i = uri.indexOf('#'); | |
var hash = i === -1 ? '' : uri.substr(i); | |
uri = i === -1 ? uri : uri.substr(0, i); | |
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); | |
var separator = uri.indexOf('?') !== -1 ? "&" : "?"; | |
if (uri.match(re)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Method 1*/ | |
/* Original reference http://gradle.1045684.n5.nabble.com/converting-from-ant-ivy-to-gradle-td4408318.html */ | |
task generateDependencies() << { | |
ivyFile = new File('ivy.xml') | |
gather = { dependencies, conf -> | |
dependencies.findAll( { | |
it['@conf'].toString().contains(conf.ivyConf) }).each { | |
String line = "\t${conf.gradleConf} group: | |
'${it['@org']}', name: '${it['@name']}', version: '${it['@rev']}'" | |
if(it['@org'].toString().contains('carfax')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace YourNamespace | |
{ | |
/// <summary> | |
/// Uses the Name value of the <see cref="ColumnAttribute"/> specified to determine | |
/// the association between the name of the column in the query results and the member to | |
/// which it will be extracted. If no column mapping is present all members are mapped as | |
/// usual. | |
/// </summary> | |
/// <typeparam name="T">The type of the object that this association between the mapper applies to.</typeparam> | |
public class ColumnAttributeTypeMapper<T> : FallbackTypeMapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Reflection; | |
using System.Runtime.InteropServices; | |
namespace Utility | |
{ | |
public class Loader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Data.Entity; | |
using System.Data.Entity.Core.Mapping; | |
using System.Data.Entity.Core.Metadata.Edm; | |
using System.Data.Entity.Infrastructure; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
using System.Text; |
OlderNewer