In .NET there are 8 bytes of overheard for each object. 4 bytes are a pointer to the object's type. What are the other 4 bytes, known as the object header, used for?
I want to keep dependencies for my project in our own repository, that way we have consistent libraries for the entire team to work with. For example, I want our project to use the Boost libraries. I've seen this done in the past with putting dependencies under a "vendor" or "dependencies" folder.
But I still want to be able to update these dependencies. If a new feature appears in a library and we need it, I want to just be able to update that repository within our own repository. I don't want to have to recopy it and put it under version control again. I'd also like for us to have the ability to change dependencies if a small change is needed without stopping us from ever updating the library.
I want the ability to do something like 'svn cp', then be able to 'svn merge' in the future. I just tried this with the boost trunk, but I'm not able to get any history using 'svn log' on the copy I made.
How do I do this? What is usually done for large projects with dependencies?
I am attempting to transfer a set of photos (blobs) from one table to another across databases. I'm nearly there, except for binding the photo parameter. I have the following code:
$conn_db1 = oci_pconnect('username', 'password', 'db1');
$conn_db2 = oci_pconnect('username', 'password', 'db2');
$parse_db1_select = oci_parse($conn_db1,
"SELECT
REF PID,
BINARY_OBJECT PHOTOGRAPH
FROM
BLOBS");
$parse_db2_insert = oci_parse($conn_db2,
"INSERT INTO
PHOTOGRAPHS
(PID,
PHOTOGRAPH)
VALUES
(:pid,
:photo)");
oci_execute($parse_db1_select);
while ($row = oci_fetch_assoc($parse_db1_select)) {
$pid = $row['PID'];
$photo = $row['PHOTOGRAPH'];
oci_bind_by_name($parse_db2_insert, ':pid', $pid, -1, OCI_B_INT);
// This line causes an error
oci_bind_by_name($parse_db_insert, ':photo', $photo, -1, OCI_B_BLOB);
oci_execute($parse_db2_insert);
}
oci_close($db1);
oci_close($db2);
But I get the following error, on the error line commented above:
Warning: oci_execute() [function.oci-execute]: ORA-03113: end-of-file on communication channel Process ID: 0 Session ID: 790 Serial number: 118
Does anyone know the right way to do this?
I'm creating a list of my defined objects like so
List<clock> cclocks = new List<clocks>();
for each object in the list i'm calling a method moveTime, like so
foreach(clock c in cclocks)
{
c.moveTime();
}
is the a way i can write some cleaver thing so i can call
cclocks.moveTime();
it would then go though the list doing that method
I guess I want to create a collection method?
I'm guessing there must be some thing I can do I just don't know what.
thanks for your help
I'm using tablesorter in on a table I added to a view in django's admin (although I'm not sure this is relevant).
I'm extending the html's header:
{% block extrahead %}
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.js"></script>
<script type="text/javascript" src="http://mysite.com/media/tablesorter/jquery.tablesorter.js"></script>
<script type="text/javascript">
$(document).ready(function()
{ $("#myTable").tablesorter(); }
);
</script>
{% endblock %}
When I click on a column header, it sorts the table using this column in descending order - that's ok.
When I click the same column header a second time - it does not reorder to ascending order. What's wrong with it?
the table's html looks like:
<table id="myTable" border="1">
<thead>
<tr>
<th>column_name_1</th>
<th>column_name_2</th>
<th>column_name_3</th>
</tr>
</thead>
<tbody>
{% for item in extra.items %}
<tr>
<td>{{ item.0|safe }} </td>
<td>{{ item.1|safe }} </td>
<td>{{ item.2|safe }} </td>
</tr>
{% endfor %}
</tbody>
</table>
I have a site which has been running for some time now that uses a great deal of user input to build the site. Naturally there are dozens of forms on the site. When building the site, I often used hidden form fields to pass data back to the server so that I know which record to update.
an example might be:
<input type="hidden" name="id" value="132" />
<input type="text" name="total_price" value="15.02" />
When the form is submitted, these values get passed to the server and I update the records based on the data passed (i.e. the price of record 132 would get changed to 15.02).
I recently found out that you can change the attributes and values via something as simple as firebug. So...I open firebug and change the id value to "155" and the price value to "0.00" and then submit the form. Viola! I view product number 155 on the site and it now says that it's $0.00. This concerns me.
How can I know which record to update without either a query string (easily modified) or a hidden input element passing the id to the server?
And if there's no better way (I've seen literally thousands of websites that pass the data this way), then how would I make it so that if a user changes these values, the data on the server side is not executed (or something similar to solve the issue)?
I've thought about encrypting the id and then decrypting it on the other side, but that still doesn't protect me from someone changing it and just happening to get something that matches another id in the database.
I've also thought about cookies, but I've heard that those can be manipulated as well.
Any ideas? This seems like a HUGE security risk to me.
I have a logic problem: We have a database that has a donations table with name, address, last donation year, and last donation term (Spring and Fall). We want to pull all donors unless they donated in the last term (Spring or Fall). I have been trying to figure out the logic of pulling all years up to the current year while omitting the last term. So for example this year is 2012 and we are in the Spring term (I defined the spring term between 1/1 and 6/30) so I only want to display donors before and including spring 2011 (we will exclude the current term which is spring 12 and the last term which is fall 2011). The problem is I want to pull sprig 2011, fall 2010, spring 2010 etc, but only omit the current term and last term donated.
I can't seem to figure out how to get Objective-c to auto box my primitives.
I assumed that i would be able to do the following
NSString* foo = @"12.5";
NSNumber* bar;
bar = [foo floatValue];
However i find that i have used to the more verbose method of
NSString* foo = @"12.5";
NSNumber* bar;
bar = [NSNumber numberWithFloat:[foo floatValue]];
Am i doing it wrong or is this as good as it gets?
I'm afraid this question is pretty basic, but I think it's relevant to a lot of Objective-C programmers who are getting into blocks.
What I've heard is that since blocks capture local variables referenced within them as const copies, using self within a block can result in a retain cycle, should that block be copied. So, we are supposed to use __block to force the block to deal directly with self instead of having it copied.
__block typeof(self) bself = self;
[someObject messageWithBlock:^{ [bself doSomething]; }];
instead of just
[someObject messageWithBlock:^{ [self doSomething]; }];
What I'd like to know is the following: if this is true, is there a way that I can avoid the ugliness (aside from using GC)?
What is a "Visual Studio SharePoint Package file" (.package)? I am trying to extract some data and this is the only file that looks large enough to contain what I'm after.
I'm using Spring.NET to connect to ActiveMQ and do some fairly simple pub sub routing. Everything works fine when my selector is a simple expression like Car='Honda' but if I try a compound expression like Car='Honda' AND Make='Pilot' I never get any matches on my subscription.
Here's the code to generate the subscription, does anyone see where I might be doing something wrong?
public bool AddSubscription(string topicName, Dictionary<string,string> selectorList, GDException exp)
{
try
{
ActiveMQTopic topic = new ActiveMQTopic(topicName);
string selectorString = "";
if (selectorList.Keys.Count == 0)
{
// Select all items for this topic
selectorString = "2>1";
}
else
{
foreach (string key in selectorList.Keys)
{
selectorString += key + " = '" + selectorList[key] + "'" + " AND ";
}
selectorString = selectorString.Remove(selectorString.Length - 5, 5);
}
IMessageConsumer consumer = this._subSession.CreateConsumer(topic, selectorString, false);
if (consumer != null)
{
_consumers.Add(consumer);
consumer.Listener += new MessageListener(HandleRecieveMessage);
return true;
}
else
{
exp.SetValues("Error adding subscription, null consumer returned");
return false;
}
}
catch (Exception ex)
{
exp.SetValues(ex);
return false;
}
}
And then the code to send the message, which seems simple enough to me
public void SendMessage(GDPubSubMessage messageToSend)
{
if (!this.isDisposed)
{
if (_producers.ContainsKey(messageToSend.Topic))
{
IBytesMessage bytesMessage = this._pubSession.CreateBytesMessage(messageToSend.Payload);
foreach (string key in messageToSend.MessageProperties.Keys)
{
bytesMessage.Properties.SetString(key, messageToSend.MessageProperties[key]);
}
_producers[messageToSend.Topic].Send(bytesMessage, false, (byte)255, TimeSpan.FromSeconds(1));
}
else
{
ActiveMQTopic topic = new ActiveMQTopic(messageToSend.Topic);
_producers.Add(messageToSend.Topic, this._pubSession.CreateProducer(topic));
IBytesMessage bytesMessage = this._pubSession.CreateBytesMessage(messageToSend.Payload);
foreach (string key in messageToSend.MessageProperties.Keys)
{
bytesMessage.Properties.SetString(key, messageToSend.MessageProperties[key]);
}
_producers[messageToSend.Topic].Send(bytesMessage);
}
}
else
{
throw new ObjectDisposedException(this.GetType().FullName);
}
}
07/102009: Update
Ok, found the problem
bytesMessage.Properties.SetString(key, messageToSend.MessageProperties[key]);
This justs sets a single property, so my messages are only being tagged with a single property, hence the combo subscription never gets hit. Anyone know how to add more properties? You'd think bytesMessage.Properties would have a Add method, but it doesn't.
What's the best way of writing robust code so that a variable can be checked for null and blank.
e.g.
string a;
if((a != null) && (a.Length() > 0))
{
//do some thing with a
}
I have a dict of lists in python:
content = {88962: [80, 130], 87484: [64], 53662: [58,80]}
I want to turn it into a list of the unique values
[58,64,80,130]
I wrote a manual solution, but it's a manual solution. I know there are more concise and more elegant way to do this with list comprehensions, map/reduce , itertools , etc. anyone have a clue ?
content = {88962: [80, 130], 87484: [64], 53662: [58,80]}
result = set({})
for k in content.keys() :
for i in content[k]:
result.add(i)
# and list/sort/print just to compare the output
r2 = list( result )
r2.sort()
print r2
Is there an event which will get whether the user has moved his finger outside of the button?
Kind of like TouchUpOutside except without the "up" bit.
Like how the iphone keyboard, the letter gets smaller (back to normal) as you move your finger of the letter.
My configuration: Win7 + Python 2.6 + eclipse + PyDev
How do I enable Unicode print statements in:
PyDev console in eclipse
Idle Python GUI
Example print statement:
print(u"???? ????")
This comes out as:
ùìåí òåìí
I've been developing websites for over a decade now, but quickly found that many of my habits in developing for the web are useless when developing for email clients. This has caused me an enormous amount of frustration, so I thought I would ask a question that would hopefully surface the best practices and necessary considerations for others like myself who may find themselves designing for gmail, outlook, etc. from time to time.
Example: <style>...</style> vs inline CSS.
In short: what transfers over from the web-world to the email-world, and what doesn't.
I can get the active window's process, but I have no idea how to get the location of that process, as far as I can see the process object only has ProcessName property which just returns like chrome instead of C:\pathtochrome\chrome.exe
How can I get the latter because I'm trying to get the process's File Description attribute, but I need the full path to it.
I have an application that uses CoreData and I'm trying to figure out the best way to implement tagging and filtering by tag. For my purposes, if I was doing this in raw SQLite I would only need three tables, tags, item_tags and of course my items table. Then filtering would be as simple as joining between the three tables where only items are related to the given tags. Quite straightforward.
But, is there a way to do this in CoreData and utilizing NSFetchedResultsController? It doesn't seem that NSPredicate give you the ability to filter through joins. NSPredicate's aren't full SQL anyway so I'm probably barking up the wrong tree there. I'm trying to avoid reimplementing my app using SQLite without CoreData since I'm enjoying the performance CoreData gives me in other areas. Yes, I did consider (and built a test implementation) diving into the raw SQLite that CoreData generates, but that's not future proof and I want to avoid that, too.
Has anyone else tried to tackle tagging/filtering with CoreData in a UITableView with NSFetchedResultsController
I'm using the post-receive-email script included with git. (Source is here.) It works just fine, but I want each email to be sent from the author of the commits pushed. How do I do it?
My post-receive file currently looks like this, and I want to customize the from-email-address.
#!/bin/sh
export [email protected]
$(dirname $0)/post-receive-email
Last year I heard that Installer Projects were going away and we should be switching to Windows Installer XML. Whatever happened with that?
So you know where I'm coming from, support for TFS-based buil machines is very important to me. I know Installer Projects kinda-sorta work with TFS, but they have issues.
The alerts that I setup for source code changes isn't being triggered. I suspect that the email server settings are wrong, but where would I configure them?
Hi!
I need to retrieve the name, email and picture from a google account.
I am already using the openid to make the user login with it's google acc.
Can I have the picture URL from the openid proccess?
with OAuth I cant'seem to find the right scope to retrieve this information... See this link:
http://code.google.com/apis/gdata/docs/directory.html
there is a list of scopes that you can fetch with REST api to google and I didnt't see the one related to the profile.
Btw, I am using PHP and the openid is already working, but didn't start with the oauth untill I know if I can(and need) retrieve the picture (because email and name already comes within the openid proccess)
thanks,
Joe
Found the following in an Oracle-based application that we're migrating (generalized):
SELECT
Table1.Category1,
Table1.Category2,
count(*) as Total,
count(Tab2.Stat) AS Stat
FROM Table1, Table2
WHERE (Table1.PrimaryKey = Table2.ForeignKey(+))
GROUP BY Table1.Category1, Table1.Category2
What does (+) do in a WHERE clause? I've never seen it used like that before.