Friday, November 06, 2009
Chit-chatting with dbus and the U1 SyncDaemon
- dbus-send --print-reply --session --dest=com.ubuntuone.SyncDaemon --type=method_call /config com.ubuntuone.SyncDaemon.Config.bandwidth_throttling_enabled
- dbus-send --print-reply --session --dest=com.ubuntuone.SyncDaemon --type=method_call /config com.ubuntuone.SyncDaemon.Config.get_throttling_limits
- dbus-send --print-reply --session --dest=com.ubuntuone.SyncDaemon --type=method_call /config com.ubuntuone.SyncDaemon.Config.set_throttling_limits int32:2031616 int:2031616
Friday, October 02, 2009
Stupid python tricks - list of paths from a file
#!/usr/bin/python
import re
results={}
f = open('filelist.txt','r')
for line in f:
m=re.search(r"(.:\\\S+)",line)
if m != None:
path=m.group(0).rpartition('\\')
results[path[0]]=True
pathlist=results.keys()
pathlist.sort()
for path in pathlist:
print pathTuesday, September 29, 2009
Using umdh to trace down Windows memory leaks
- Install Windbg
- set path="C:\Program Files\Debugging Tools for Windows (x64)";%path%
- enable sysmtem stack trace - gflags -r +ust
- md c:\websymbols
- set symbols path - set _NT_SYMBOL_PATH=SRV*c:\websymbols*http://msdl.microsoft.com/download/symbols;X:\Symbols\exe64ex
- snap process memory - umdh -p:pid -f:output-1-file
- snap process memory again - umdh -p:pid -f:output-2-file
- compare two memory snap - umdh output-1-file output-2-file -f:cmp.txt
- cmp.txt should contain leak information.
Wednesday, September 09, 2009
bazaar and launchpad
$ bzr branch lp:mago (downloads >1mb of crap)
You do some config and:
Magical!
~/.bazaar/bazaar.conf:
[ALIASES]
~/.bazaar/locations.conf:
[/home/jtatum/Projects]
$ mkdir ~/Projects/repos/mago
Then, pull down a branch:
$ bzr cbranch lp:~who/mago/whatever
Or make a new one:
$ bzr cbranch mago myawesomecode
Push works magically thanks to the shorthand in location.conf. Neato!
Wednesday, August 26, 2009
Embrace and extend
Well, it seems ISA does support this. They call NAT clients without any additional proxy configuration SecureNAT clients, and according to this article, the firewall can be configured to redirect outbound web traffic to the IIS proxy. SecureNAT... Because it's magically better than regular NAT with transparent proxying, right?
In happier news, I started on a mago test suite for gcalctool. My branch is here. It's a work in progress but I am pretty happy with the results so far. I'm getting more and more certain about what goes where in the Mago testing paradigm. LDTP is dead simple, although the documentation is really a sore point. I definitely plan to contribute to the docs when I know what I'm doing.
TODO:
- Readme
- Math tests
- Figure out the right place for init in a test suite
Monday, March 23, 2009
REST web service client in C#
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;
using System.Web;
class Simple_REST
{
public static string Get_URI(string uri)
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri);
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader(responseStream);
string responseString = reader.ReadToEnd();
reader.Close();
responseStream.Close();
response.Close();
return responseString;
}
public static string Post_URI(string uri, Dictionary<string, string> postDataDictionary)
{
string postData = "";
foreach (KeyValuePair<string, string> kvp in postDataDictionary)
{
postData += string.Format("{0}={1}&", HttpUtility.UrlEncode(kvp.Key), HttpUtility.UrlEncode(kvp.Value));
}
postData = postData.Remove(postData.Length - 1); // remove the trailing ampersand
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri);
req.Method = "POST";
byte[] postArray = Encoding.UTF8.GetBytes(postData);
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = postArray.Length;
Stream dataStream = req.GetRequestStream();
dataStream.Write(postArray, 0, postArray.Length);
dataStream.Close();
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader(responseStream);
string responseString = reader.ReadToEnd();
reader.Close();
responseStream.Close();
response.Close();
return responseString;
}
}
Tuesday, November 25, 2008
Wordpress plugin: Get Post
Labels: get post, plugin, wordpress