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
@app.route('/locations/add', methods=['POST']) | |
def add_loc(): | |
db.execute('insert into locations(name, blurb, phone_number, address, url) values(?,?,?,?,?)', [request.form['name'], request.form['blurb'], request.form['phone'], request.form['address'], request.form['url']]) | |
db.commit() | |
return |
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
class CheckIn(db.Model): | |
__tablename__ = 'checkins' | |
id = db.Column(db.Integer, primary_key=True) | |
location_id = db.Column(db.Integer) | |
user_id = db.Column(db.Integer) | |
date = db.Column(db.DateTime) | |
def to_dict(self): | |
return{ |
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
public static Bitmap convertToMutable(Bitmap imgIn) { | |
try { | |
//this is the file going to use temporally to save the bytes. | |
// This file will not be a image, it will store the raw image data. | |
File file = new File(Environment.getExternalStorageDirectory() + File.separator + "temp.tmp"); | |
//Open an RandomAccessFile | |
//Make sure you have added uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" | |
//into AndroidManifest.xml file | |
RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw"); |
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
public Bitmap getResizedBitmap(Bitmap bm, int newHeight, int newWidth) { | |
int width = bm.getWidth(); | |
int height = bm.getHeight(); | |
float scaleWidth = ((float) newWidth) / width; | |
float scaleHeight = ((float) newHeight) / height; |
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
/** | |
* Checks if the device is a tablet or a phone | |
* | |
* @param activityContext | |
* The Activity Context. | |
* @return Returns true if the device is a Tablet | |
*/ | |
public static boolean isTabletDevice(Context activityContext) { | |
// Verifies if the Generalized Size of the device is XLARGE to be | |
// considered a Tablet |
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
public boolean isTablet(Context context) { | |
boolean xlarge = ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == 4); | |
boolean large = ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE); | |
return (xlarge || large); | |
} |
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
@Override | |
public boolean onCreateOptionsMenu(Menu menu) { | |
MenuInflater inflater = getSupportMenuInflater(); | |
inflater.inflate(R.menu.entry_menu, menu); | |
MenuItem mItem = menu.findItem(R.id.menu_comments); | |
commentCount = (TextView)mItem.getActionView().findViewById(R.id.actionEntryCommentCount); | |
commentCount.setText(Integer.toString(article.numComments)); | |
mItem.getActionView().setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { |
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
**Paste this shiz where you need to troubleshoot***************************************************** | |
java.util.logging.Logger.getLogger("org.apache.http.wire").setLevel(java.util.logging.Level.FINEST); | |
java.util.logging.Logger.getLogger("org.apache.http.headers").setLevel(java.util.logging.Level.FINEST); | |
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); | |
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true"); | |
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "debug"); | |
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "debug"); | |
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.headers", "debug"); |
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
public class ButtonStuff extends BaseButtonStuff { | |
private boolean whatevs; | |
//Broadcast Receiver | |
private BroadcastReceiver br = new BroadcastReceiver() { | |
@Override | |
public void onReceive(Context context, Intent intent) { | |
updateShit(); | |
} | |
}; |
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
//Do them SlidingMenu as so | |
SlidingMenu menu; | |
private void setUpSideMenu(){ | |
menu = new SlidingMenu(this); | |
menu.setMenu(R.layout.side_menu); | |
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN); | |
menu.setBehindOffsetRes(R.dimen.actionbar_home_width); | |
menu.setBehindScrollScale(0.25f); | |
menu.setShadowDrawable(R.drawable.shadow); |
OlderNewer