text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
How can I get a history of uptimes for my debian box? After a reboot, I dont see an option for the uptime command to print a history of uptimes. If it matters, I would like to use these uptimes for graphing a page in php to show my webservers uptime lengths between boots.
Update:
Not sure if it is based on a length of time or if last gets reset on reboot but I only get the most recent boot timestamp with the last command. last -x also does not return any further info. Sounds like a script is my | [
0.5389651656150818,
-0.12680009007453918,
0.1943933516740799,
0.2671205699443817,
-0.07037830352783203,
-0.18016237020492554,
0.4093542993068695,
0.07848143577575684,
-0.5550360679626465,
-0.8421347141265869,
0.22362422943115234,
0.6079007983207703,
-0.1478135734796524,
0.00574176153168082... | |
best bet.
Update:
Uptimed is the information I am looking for, not sure how to grep that info in code. Managing my own script for a db sounds like the best fit for an application.
You could create a simple script which runs uptime and dumps it to a file.
```
uptime >> uptime.log
```
Then set up a cron job for it. | [
0.3403477072715759,
0.1736578345298767,
0.3058027923107147,
-0.0336662158370018,
-0.011657271534204483,
-0.0365162268280983,
0.22466424107551575,
-0.13289083540439606,
-0.012847213074564934,
-0.5661178827285767,
0.04377126693725586,
0.7083866596221924,
-0.04846460744738579,
0.0378784388303... | |
I am looking for a way to connect to Facebook by allowing the user to enter in their username and password and have our app connect to their account and get their contacts so that they can invite them to join their group on our site. I have written a Facebook app before, but this is not an app as much as it is a connector so that they can invite all their friends or just some to the site we are working on.
I have seen several other sites do this and also connect to Yahoo, Gmail and Hotmail contacts. | [
0.7086588144302368,
0.11330743879079819,
0.11761569231748581,
-0.041369590908288956,
0.05184011533856392,
0.06205360218882561,
-0.012813198380172253,
0.17414630949497223,
-0.1993081420660019,
-0.6671083569526672,
0.2989216446876526,
0.19526831805706024,
-0.030619703233242035,
0.06500931084... | |
I don't think they are using Facebook Connect to do this since it is so new, but they may be.
Any solution in any language is fine as I can port whatever example to use C#. I cannot find anything specifically on Google or Facebook to address this specific problem. Any help is appreciated.
I saw a first answer get removed that had suggested I might need to scrape the friends page. The more I look around, this might be what I need to do. Any other way I think will require the person to add it as an app. | [
0.3559105098247528,
0.24704137444496155,
-0.13749465346336365,
0.3147067725658417,
0.04298301413655281,
0.04077332094311714,
0.5638899803161621,
0.4955812394618988,
-0.11105316132307053,
-0.6252507567405701,
0.17304542660713196,
0.5119732618331909,
0.09147952497005463,
0.057495780289173126... | |
I am wondering how a answer can get removed, maybe that user deleted it.
I asked this question awhile ago and before facebook connect was live and well. The best way to really do this is using facebook connect.
<http://developers.facebook.com/connect.php?tab=website>
I am currently using this on our live site and using the Facebook Developer Toolkit for .NET on Codeplex here:
<http://www.codeplex.com/FacebookToolkit>
Good luck! | [
0.525297224521637,
-0.03590765595436096,
0.33005625009536743,
0.09818922728300095,
0.05713626742362976,
-0.18922865390777588,
0.42894864082336426,
0.1730303317308426,
-0.37023603916168213,
-0.7317953705787659,
0.1436428427696228,
0.26980331540107727,
0.03235766664147377,
0.0988012477755546... | |
Does anyone know much about the Asp.Net webconfig element ?
I'm looking at it because I'm implementing an MS Ajax updatepanel in an existing site,
and after doing some looking around, on the web I'm not finding a lot of info about it.
And to avoid the flood of replies telling me how inefficient the update panel is, and that it's not actually providing any benefit etc. etc. I know! Let's say I've got my reasons for using it and leave it at that.
I guess my main question is;, will setting enableCompression="true" and enableCaching="true" help the performace of my update panel | [
0.32881492376327515,
0.24069298803806305,
0.2735707461833954,
0.0839926227927208,
-0.0885610356926918,
-0.3061603009700775,
0.5005280375480652,
-0.02181488461792469,
0.0800841823220253,
-0.6420619487762451,
-0.022374741733074188,
0.8692030906677246,
-0.04097365215420723,
-0.278009206056594... | |
in any way?
Given the traversing of the DOM that is actually happening with an update panel it's generally not the content that is hindering performance.. it is the PC/Browser.
I know this is exactly what you aren't looking for but unless your panel contains a significant amount of data then compression and caching isn't going to help you terribly. | [
0.13874101638793945,
0.310733824968338,
0.5556013584136963,
0.10814043134450912,
-0.0792161226272583,
-0.16982080042362213,
0.16365200281143188,
0.12260949611663818,
-0.15901054441928864,
-0.5206936001777649,
-0.1562776416540146,
0.9186207056045532,
0.060501277446746826,
0.1273818612098693... | |
What is the best compilable scripting language for Win32? I prefer .EXE's because I don't want to install the runtime on the servers first (my company administrates many via remote), but I need to be able to do things like NTFS permissions and (if possible) APIs over the network.
There was a small Perl which appeared to be able to do most of this, but it does not seem to have been updated/developed in quite a while. I have wondered about Lua, but I don't know if it has everything I need yet (and don't want to hunt through fifty library | [
0.17609013617038727,
-0.023828599601984024,
0.18892911076545715,
-0.02348528616130352,
-0.029667750000953674,
-0.23630763590335846,
-0.00541123328730464,
0.3771817088127136,
-0.02229270152747631,
-0.7036648392677307,
0.026513908058404922,
0.7515217661857605,
-0.15818864107131958,
0.0114861... | |
sites trying to find out). Any thoughts?
Have you considered using an EXE maker? For example, you can code in Python and use [py2exe](http://www.py2exe.org) to create a standalone EXE that runs anywhere (it actually packages Python into the exe, so you don't have to install the runtime). | [
0.8610918521881104,
-0.11133724451065063,
-0.03242058679461479,
0.2465803474187851,
0.07280364632606506,
-0.3916274905204773,
0.28913652896881104,
0.37572890520095825,
-0.3209138512611389,
-0.657805860042572,
-0.1134457215666771,
0.4539516568183899,
-0.2836921215057373,
-0.1697050780057907... | |
I am writing a web application that requires user interaction via email. I'm curious if there is a best practice or recommended source for learning about processing email. I am writing my application in Python, but I'm not sure what mail server to use or how to format the message or subject line to account for automated processing. I'm also looking for guidance on processing bouncebacks.
There are some pretty serious concerns here for how to send email automatically, and here are a few:
Use an email library. Python includes one called 'email'. This is your friend, it will stop you from | [
0.37904003262519836,
0.27613958716392517,
0.0779055655002594,
-0.09009828418493271,
-0.060383882373571396,
-0.09446051716804504,
0.2765585780143738,
0.26715368032455444,
-0.25594690442085266,
-0.4564517140388489,
0.2286873459815979,
0.41670382022857666,
-0.25908875465393066,
-0.23428252339... | |
doing anything tragically wrong. Read an example from [the Python Manual](http://docs.python.org/lib/node161.html).
Some points that will stop you from getting blocked by spam filters:
Always send from a valid email address. You must be able to send email to this address and have it received (it can go into /dev/null after it's received, but it must be possible to /deliver/ there). This will stop spam filters that do Sender Address Verification from blocking your mail.
The email address you send from on the server.sendmail(fromaddr, [toaddr]) line will be where bounces go. The From: line in the email is a totally different address, and that's | [
0.4327526092529297,
-0.16472570598125458,
0.5730084776878357,
0.023647692054510117,
0.03241331875324249,
-0.08312977850437164,
0.5412418842315674,
-0.06559406220912933,
-0.6321749091148376,
-0.2506435215473175,
0.0039012692868709564,
0.10538540780544281,
-0.5983461141586304,
-0.11589323729... | |
where mail will go when the user hits 'Reply:'. Use this to your advantage, bounces can go to one place, while reply goes to another.
Send email to a local mail server, I recommend postfix. This local server will receive your mail and be responsible for sending it to your upstream server. Once it has been delivered to the local server, treat it as 'sent' from a programmatic point of view.
If you have a site that is on a static ip in a datacenter of good reputation, don't be afraid to simply relay the mail directly to the internet. If you're | [
0.5146828889846802,
-0.12136147171258926,
0.6193094849586487,
0.07703844457864761,
-0.14278578758239746,
-0.15506823360919952,
0.16293323040008545,
0.12628664076328278,
-0.3273242115974426,
-0.5159335136413574,
-0.004221969749778509,
0.13435137271881104,
-0.30711257457733154,
-0.0079499371... | |
in a datacenter full of script kiddies and spammers, you will need to relay this mail via a public MTA of good reputation, hopefully you will be able to work this out without a hassle.
Don't send an email in only HTML. Always send it in Plain and HTML, or just Plain. Be nice, I use a text only email client, and you don't want to annoy me.
Verify that you're not running SPF on your email domain, or get it configured to allow your server to send the mail. Do this by doing a TXT lookup on your domain.
```
$ dig google.com | [
0.7023148536682129,
0.05878608673810959,
0.2800835072994232,
0.32640504837036133,
-0.31478214263916016,
-0.38401055335998535,
0.46316248178482056,
0.5068543553352356,
-0.12875443696975708,
-0.7524592876434326,
-0.1330341398715973,
0.2941109538078308,
-0.2922617495059967,
-0.159199804067611... | |
txt
...snip...
;; ANSWER SECTION:
google.com. 300 IN TXT "v=spf1 include:_netblocks.google.com ~all"
```
As you can see from that result, there's an SPF record there. If you don't have SPF, there won't be a TXT record. Read more about [SPF on wikipedia](http://en.wikipedia.org/wiki/Sender_Policy_Framework).
Hope that helps. | [
0.7020459175109863,
0.034778255969285965,
0.732916533946991,
-0.007484355941414833,
-0.030802424997091293,
0.026586413383483887,
0.4052015542984009,
-0.21822066605091095,
-0.49896636605262756,
-0.6638501286506653,
-0.3380279242992401,
0.43727391958236694,
-0.35944974422454834,
-0.301990836... | |
I have a two tables joined with a join table - this is just pseudo code:
```
Library
Book
LibraryBooks
```
What I need to do is if i have the id of a library, i want to get all the libraries that all the books that this library has are in.
So if i have Library 1, and Library 1 has books A and B in them, and books A and B are in Libraries 1, 2, and 3, is there an elegant (one line) way todo this in rails?
I was thinking:
```
l = Library.find(1)
allLibraries = l.books.libraries
```
But that doesn't seem to work. Suggestions?
```
l = Library.find(:all, :include => | [
0.31453683972358704,
0.25722265243530273,
0.10251298546791077,
0.17423276603221893,
0.11270233243703842,
-0.08533510565757751,
-0.11138026416301727,
-0.056631796061992645,
-0.00015926267951726913,
-0.7885595560073853,
0.10521508753299713,
0.37101876735687256,
-0.45184579491615295,
0.122658... | |
:books)
l.books.map { |b| b.library_ids }.flatten.uniq
```
Note that `map(&:library_ids)` is slower than `map { |b| b.library_ids }` in Ruby 1.8.6, and faster in 1.9.0.
I should also mention that if you used `:joins` instead of `include` there, it would find the library and related books all in the same query speeding up the database time. `:joins` will only work however if a library has books. | [
0.196848064661026,
0.0627145990729332,
0.45400482416152954,
0.15442366898059845,
-0.05360228195786476,
-0.30311858654022217,
0.2701978385448456,
-0.2150045931339264,
-0.2794731557369232,
-0.7519770264625549,
-0.41249457001686096,
0.3485533595085144,
-0.47432681918144226,
0.0949187576770782... | |
I have a list of timesheet entries that show a start and stop time. This is sitting in a MySQL database. I need to create bar charts based on this data with the 24 hours of the day along the bottom and the amount of man-hours worked for each hour of the day.
For example, if Alice worked a job from 15:30 to 19:30 and Bob worked from 12:15 to 17:00, the chart would look like this:
[](https://i.stack.imgur.com/HHrs0.png)
I have a WTFey solution right now that involves a spreadsheet going out to column DY or something like that. The needed resolution is | [
0.5295230150222778,
0.30160918831825256,
0.38715437054634094,
-0.26556429266929626,
0.2001766562461853,
0.24333199858665466,
0.3184676170349121,
-0.12767353653907776,
-0.6568728685379028,
-0.5023196339607239,
0.25549474358558655,
0.2869526743888855,
-0.20682567358016968,
0.1855549067258834... | |
15-minute intervals.
I'm assuming this is something best done in the database then exported for chart creation. Let me know if I'm missing any details. Thanks.
Create a table with just time in it from midnight to midnight containing each minute of the day. In the data warehouse world we would call this a time dimension. Here's an example:
```
TIME_DIM
-id
-time_of_day
-interval_15
-interval_30
```
an example of the data in the table would be
```
id time_of_day interval_15 interval_30
1 00:00 00:00 | [
0.35181957483291626,
-0.05818745493888855,
0.5742615461349487,
0.3129473626613617,
0.2009364664554596,
0.21681511402130127,
-0.2163560837507248,
0.17819206416606903,
-0.5829940438270569,
-0.6816583871841431,
0.03764018416404724,
0.44831815361976624,
-0.15498699247837067,
0.1768859773874282... | |
00:00
...
30 00:23 00:15 00:00
...
100 05:44 05:30 05:30
```
Then all you have to do is join your table to the time dimension and then group by interval\_15. For example:
```
SELECT b.interval_15, count(*)
FROM my_data_table a
INNER JOIN time_dim b ON a.time_field = b.time
WHERE a.date_field = now()
GROUP BY b.interval_15
``` | [
0.03568509593605995,
0.09351649880409241,
0.7840778231620789,
-0.3810735046863556,
0.39066794514656067,
0.27121850848197937,
-0.32187941670417786,
-0.42771464586257935,
-0.33826544880867004,
-0.7299973368644714,
-0.12832055985927582,
0.45705217123031616,
-0.10539956390857697,
0.24616852402... | |
How do I convert a datetime *string in local time* to a *string in UTC time*?
I'm sure I've done this before, but can't find it and SO will hopefully help me (and others) do that in future.
**Clarification**: For example, if I have `2008-09-17 14:02:00` in my local timezone (`+10`), I'd like to generate a string with the equivalent `UTC` time: `2008-09-17 04:02:00`.
Also, from <http://lucumr.pocoo.org/2011/7/15/eppur-si-muove/>, note that in general this isn't possible as with DST and other issues there is no unique conversion from local time to UTC time.
Thanks @rofly, the full conversion from string to string is as follows:
```
import time
time.strftime("%Y-%m-%d | [
0.1614733785390854,
-0.28832298517227173,
0.6186246871948242,
-0.07502999901771545,
-0.13640163838863373,
-0.11106590926647186,
0.20922641456127167,
0.15723949670791626,
-0.139179989695549,
-0.6743024587631226,
-0.12399789690971375,
0.41426554322242737,
-0.21702580153942108,
0.182203918695... | |
%H:%M:%S",
time.gmtime(time.mktime(time.strptime("2008-09-17 14:04:00",
"%Y-%m-%d %H:%M:%S"))))
```
My summary of the `time`/`calendar` functions:
`time.strptime`
string --> tuple (no timezone applied, so matches string)
`time.mktime`
local time tuple --> seconds since epoch (always local time)
`time.gmtime`
seconds since | [
-0.2575153112411499,
0.09600874781608582,
0.8821096420288086,
-0.1660088449716568,
-0.0345601812005043,
0.26147860288619995,
0.2620176076889038,
0.1412046104669571,
-0.3705093562602997,
-0.932591438293457,
-0.2725827991962433,
0.2920991778373718,
-0.057515256106853485,
0.30270862579345703,... | |
epoch --> tuple in UTC
and
`calendar.timegm`
tuple in UTC --> seconds since epoch
`time.localtime`
seconds since epoch --> tuple in local timezone | [
-0.19399623572826385,
-0.19486390054225922,
0.4067535400390625,
0.019062310457229614,
0.16103564202785492,
0.328019917011261,
-0.0461939200758934,
0.4947104752063751,
-0.40863513946533203,
-0.9246615171432495,
-0.3527474105358124,
-0.0029409744311124086,
-0.0036908993497490883,
0.617440164... | |
I'd like a short smallest possible javascript routine that when a mousedown occurs on a button it first responds just like a mouseclick and then if the user keeps the button pressed it responds as if the user was continously sending mouseclicks and after a while with the button held down acts as if the user was accelerating their mouseclicks...basically think of it like a keypress repeat with acceleration in time.
i.e. user holds down mouse button (x=call function) - x\_\_\_x\_\_\_x\_\_\_x\_\_x\_\_x\_x\_x\_x\_xxxxxxx
```
function holdit(btn, action, start, speedup) {
var t;
var repeat = function () | [
0.10784732550382614,
-0.19875408709049225,
0.6009683609008789,
-0.27468186616897583,
0.10795530676841736,
0.2063884735107422,
0.3688313961029053,
-0.2173498570919037,
-0.2195187211036682,
-0.4818248450756073,
0.05092226713895798,
0.4957992434501648,
-0.3815259039402008,
0.19490641355514526... | |
{
action();
t = setTimeout(repeat, start);
start = start / speedup;
}
btn.mousedown = function() {
repeat();
}
btn.mouseup = function () {
clearTimeout(t);
}
};
/* to use */
holdit(btn, function () { }, 1000, 2); /* x..1000ms..x..500ms..x..250ms..x */
``` | [
0.27015572786331177,
-0.5538777709007263,
0.524933934211731,
-0.42622941732406616,
0.3181762993335724,
0.3157365024089813,
0.5048367381095886,
-0.39329639077186584,
-0.46350812911987305,
-0.5003468990325928,
-0.39318981766700745,
0.6666048169136047,
-0.1560688465833664,
0.09964815527200699... | |
The situation is this:
* You have a Hibernate context with an
object graph that has some lazy
loading defined.
* You want to use
the Hibernate objects in your UI as
is without having to copy the data
somewhere.
* There are different UI
contexts that require different
amounts of data.
* The data is too
big to just eager load the whole
graph each time.
What is the best means to load all the appropriate objects in the object graph in a configurable way so that they can be accessed without having to go back to the database to load more data?
Any help.
Let's say you have the Client and at one point | [
0.20986410975456238,
-0.1533297747373581,
0.3607475161552429,
0.2458776980638504,
-0.40730464458465576,
0.029783811420202255,
0.2365742325782776,
0.05529572442173958,
-0.39176833629608154,
-0.9142155647277832,
0.036227647215127945,
0.6364927887916565,
-0.31553736329078674,
-0.0895440131425... | |
you have to something with his Orders and maybe he has a Bonus for his Orders.
Then I would define a Repository with a fluent interface that will allow me to say something like :
```
new ClientRepo().LoadClientBy(id)
.WithOrders()
.WithBonus()
.OrderByName();
```
And there you have the client with everything you need. It's preferably that you know in advance | [
0.19506245851516724,
0.02682403475046158,
0.4422683119773865,
-0.051199231296777725,
0.23613156378269196,
-0.07200630009174347,
0.04013641178607941,
0.08472458273172379,
-0.4571433961391449,
-0.6601731181144714,
-0.31374475359916687,
0.8175696730613708,
-0.25334271788597107,
0.089928694069... | |
what you will need for the current operation. This way you can avoid unwanted trips to the database.(new devs in your team will usually do this - call a property and not be aware of the fact that it's actually a call to the DB) | [
0.3743598461151123,
-0.24841631948947906,
-0.024621129035949707,
0.487029105424881,
0.3334212303161621,
-0.3387064039707184,
0.223501056432724,
-0.3674642741680145,
-0.2824961841106415,
-0.446281760931015,
-0.11085396260023117,
0.6855952739715576,
0.011053075082600117,
-0.07675493508577347... | |
I've inherited a network spread out over a warehouse/front office consisting of approximately 50 desktop PCs, various servers, network printers, and routers/switches.
The "intelligent" routers live in the server room. As the company has grown, we've annexed additional space and not very elegantly run various lengths of CAT5 thru the ceilings etc. I've been finding various hubs and switches in the ceilings -- none of which is labeled or documented in any way.
Of course, das blinken-lights tell me that *someone* is connected to these devices, I just have no way of finding out *who*.
I can run traditional network map tools | [
0.49261099100112915,
0.29242441058158875,
0.5653112530708313,
0.25695300102233887,
0.5616509914398193,
0.26485997438430786,
0.07468672096729279,
0.347930908203125,
-0.37952110171318054,
-0.814712405204773,
0.0415523461997509,
-0.042161427438259125,
0.12216878682374954,
0.46876972913742065,... | |
(there are tons of these things) and it shows me the IP-based things in the network. That's nice, but information I already have. What I need to know is the network topology -- how the switches (bridges) are interconnected etc.. And since they are off-the-shelf linksys unmanaged-types, they don't respond to SNMP so I can't use that...
What's the best/cheapest tool out there that I can use to analyze and detect things like hubs and switches in the network that don't respond to SNMP?
If there's no tool that you're aware of -- what generalized algorithm would you suggest to find | [
0.324540913105011,
0.05950723588466644,
0.16276735067367554,
0.46914684772491455,
-0.08708620816469193,
-0.2628629803657532,
-0.17131656408309937,
0.10822024196386337,
-0.30592432618141174,
-0.7984896302223206,
0.31144192814826965,
0.4567148685455322,
-0.16037793457508087,
0.23486393690109... | |
this out? My guess would be that I could look at the MAC forward tables for the devices (switches, desktops, etc.) and build a chain that way, but I don't know if it's possible to get that from an unmanaged switch (let alone a hub).
(This patent has some neat ideas but I can't find any software built with it: <http://www.freepatentsonline.com/6628623.html>)
Thanks!!
An idea could be to use a program like 3com network director trial version (or The Dude). Use it to discover all of your workstations and anything else with an IP address.
Wait for a quiet time and unplug each hub/switch ... | [
0.6232736706733704,
-0.0436118058860302,
0.4593554437160492,
0.18458253145217896,
0.04639226198196411,
-0.6163710355758667,
0.29549580812454224,
-0.046483106911182404,
-0.23974043130874634,
-0.3563251793384552,
-0.0033083923626691103,
0.4631134569644928,
-0.25668904185295105,
0.20882025361... | |
you'll then at least begin to be able to make a map, the rest will be crawling about following cables. Network administration does mean getting dirty. | [
0.7702187895774841,
-0.2363954484462738,
0.3066681921482086,
0.5817903876304626,
0.10667606443166733,
-0.5329605340957642,
0.1268557906150818,
0.28775519132614136,
-0.5451462864875793,
-0.671443521976471,
0.12445612996816635,
0.26852864027023315,
-0.07066419720649719,
0.11632414162158966,
... | |
I'd like to create a utility in C# to allow someone to easily create a Certificate Authority (CA) in Windows. Any ideas/suggestions?
I know I can use OpenSSL to do this. In the end, I'll want this utility to do more than just generate a CA. I'd also like to avoid requiring the installation of OpenSSL in order to run my utility.
Since OpenSSL is Apache-licensed (i.e. BSD-style), you can simply distribute it as a DLL along with your application. (Maybe build it yourself to have only the features you need and all in a single DLL.) Then use p/invoke calls to | [
0.6416153311729431,
0.4185182750225067,
0.059014420956373215,
0.06655139476060867,
-0.3501429259777069,
-0.5191702246665955,
-0.01270323246717453,
0.12434215843677521,
-0.2552356719970703,
-0.5189963579177856,
-0.10260669142007828,
0.4150451123714447,
-0.33032625913619995,
0.30028349161148... | |
talk with this DLL.
(Maybe you can even link the native code straight into your .NET executable? Not sure about that.) | [
0.367628812789917,
-0.195805162191391,
0.06678541004657745,
0.5715941786766052,
-0.01061570830643177,
-0.535798966884613,
0.2451774775981903,
0.6521886587142944,
-0.11198818683624268,
-0.6776548624038696,
0.07115022838115692,
0.41722339391708374,
-0.03626815602183342,
0.23402011394500732,
... | |
I'm looking for a variation on the `#save` method that will only save
attributes that do not have errors attached to them.
So a model can be updated without being valid overall, and this will
still prevent saving invalid data to the database.
By "valid attributes", I mean those attributes that give nil when calling @model\_instance.errors.on(:attribute)
Anyone have an idea of how to accomplish this?
So far, I have the following:
```
def save_valid_attributes
valid?
update_atrtibutes attributes.inject({}){|k, v, m| m[k] = v unless errors_on(k.to_sym); m}
end
```
This works if there's no processing done on assignment, which in my case there is.
For example, I | [
0.17174184322357178,
0.15611231327056885,
0.342948853969574,
0.04990154504776001,
0.00839184783399105,
0.09242993593215942,
0.39255523681640625,
-0.17623640596866608,
-0.20654961466789246,
-0.6892998218536377,
0.16821616888046265,
0.9279710054397583,
-0.20363333821296692,
0.281044304370880... | |
have a database column "start\_date", and two methods defined:
```
def nice_start_date=(startdate)
self.start_date = Chronic.parse(startdate) || startdate
end
def nice_start_date
self.start_date.to_s
end
```
These two methods allow me to properly parse the user inputted dates using Chronic before saving. So, second way of doing this, one attribute at a time:
```
def save_valid_attributes(attrib)
valid?
attrib.each{|(k,v)| send("${k}=", v); save; reload)
end
```
The model needs to be reloaded each time since, if one of the dates is invalid and doesn't save, it will prevent all further attributes from saving.
Is there a better way to do this? I'm sure this isn't an uncommon problem in the Rails world, I just can't | [
-0.3027257025241852,
0.07078588008880615,
0.3218667507171631,
-0.01236721035093069,
-0.027085786685347557,
-0.07692037522792816,
0.10156715661287308,
-0.10728947073221207,
-0.10585059970617294,
-0.8227329254150391,
0.2531295120716095,
0.569494366645813,
-0.1905338019132614,
0.1580260246992... | |
seem to find anything in the Google universe of knowledge.
Since OpenSSL is Apache-licensed (i.e. BSD-style), you can simply distribute it as a DLL along with your application. (Maybe build it yourself to have only the features you need and all in a single DLL.) Then use p/invoke calls to talk with this DLL.
(Maybe you can even link the native code straight into your .NET executable? Not sure about that.) | [
0.03489629179239273,
0.030754495412111282,
0.39402148127555847,
0.4332757592201233,
-0.23512625694274902,
-0.42318668961524963,
0.16590847074985504,
0.4487941563129425,
-0.2287655919790268,
-0.6987339854240417,
-0.3253588080406189,
0.19930149614810944,
-0.26942163705825806,
0.1264503896236... | |
* What are the stack and heap?
* Where are they located physically in a computer's memory?
* To what extent are they controlled by the OS or language run-time?
* What is their scope?
* What determines their sizes?
* What makes one faster?
The stack is the memory set aside as scratch space for a thread of execution. When a function is called, a block is reserved on the top of the stack for local variables and some bookkeeping data. When that function returns, the block becomes unused and can be used the next time a function is called. The stack is always reserved | [
0.07997460663318634,
-0.1174795925617218,
0.11685402691364288,
0.3393762409687042,
0.11133898794651031,
0.23217518627643585,
0.04593050852417946,
-0.0014415088808164,
-0.3170383870601654,
-0.4812253713607788,
-0.17822670936584473,
0.14496932923793793,
-0.021286945790052414,
0.2118556797504... | |
in a LIFO (last in first out) order; the most recently reserved block is always the next block to be freed. This makes it really simple to keep track of the stack; freeing a block from the stack is nothing more than adjusting one pointer.
The heap is memory set aside for dynamic allocation. Unlike the stack, there's no enforced pattern to the allocation and deallocation of blocks from the heap; you can allocate a block at any time and free it at any time. This makes it much more complex to keep track of which parts of the heap are | [
-0.09326483309268951,
-0.2110999971628189,
0.25173327326774597,
-0.09791966527700424,
0.02670685574412346,
-0.13926418125629425,
-0.1712992638349533,
-0.13008886575698853,
-0.2809270918369293,
-0.6138256788253784,
-0.4507546126842499,
0.16013847291469574,
-0.4362422525882721,
-0.1471156477... | |
allocated or free at any given time; there are many custom heap allocators available to tune heap performance for different usage patterns.
Each thread gets a stack, while there's typically only one heap for the application (although it isn't uncommon to have multiple heaps for different types of allocation).
To answer your questions directly:
> *To what extent are they controlled by the OS or language runtime?*
The OS allocates the stack for each system-level thread when the thread is created. Typically the OS is called by the language runtime to allocate the heap for the application.
> *What is their scope?*
The stack is attached | [
0.20296359062194824,
-0.0771564394235611,
0.10929353535175323,
0.44658568501472473,
0.016005689278244972,
0.055518440902233124,
-0.13609462976455688,
-0.10483121871948242,
-0.6082350611686707,
-0.6409508585929871,
-0.3839961290359497,
0.03031051531434059,
-0.2163924127817154,
0.25430843234... | |
to a thread, so when the thread exits the stack is reclaimed. The heap is typically allocated at application startup by the runtime, and is reclaimed when the application (technically process) exits.
> *What determines the size of each of them?*
The size of the stack is set when a thread is created. The size of the heap is set on application startup, but can grow as space is needed (the allocator requests more memory from the operating system).
> *What makes one faster?*
The stack is faster because the access pattern makes it trivial to allocate and deallocate memory from it (a pointer/integer | [
-0.08365799486637115,
-0.13082897663116455,
0.4225946366786957,
0.21186643838882446,
0.22186222672462463,
0.08539313077926636,
-0.02574915997684002,
-0.14363045990467072,
-0.57706618309021,
-0.6604490876197815,
-0.25444296002388,
0.017818916589021683,
-0.15839004516601562,
0.43598794937133... | |
is simply incremented or decremented), while the heap has much more complex bookkeeping involved in an allocation or deallocation. Also, each byte in the stack tends to be reused very frequently which means it tends to be mapped to the processor's cache, making it very fast. Another performance hit for the heap is that the heap, being mostly a global resource, typically has to be multi-threading safe, i.e. each allocation and deallocation needs to be - typically - synchronized with "all" other heap accesses in the program.
A clear demonstration:

Image source: [vikashazrati.wordpress.com](http://vikashazrati.wordpress.com/2007/10/01/quicktip-java-basics-stack-and-heap/) | [
-0.26212093234062195,
-0.04708010330796242,
-0.05788271129131317,
0.04822217673063278,
0.10484310239553452,
0.0742500051856041,
0.36059507727622986,
-0.24477125704288483,
-0.6292721033096313,
-0.5518726706504822,
-0.5037782788276672,
-0.024093305692076683,
-0.3723662495613098,
-0.070658959... | |
Scenario:
A stored procedure receives from code a DateTime with, let's say DateTime.Now value, as a datetime parameter.
The stored procedure needs to store only the date part of the datetime on the row, but preserving all date related arithmetics for, to say, do searches over time intervals and doing reports based on dates.
I know there is a couple of ways, but what is the better having in mind performance and wasted space?
Business Logic should be handled outside of the proc. The procs jobs should be to save the data passed to it. If the requirment is to only store | [
-0.1804180145263672,
-0.20062685012817383,
0.07982058078050613,
0.0637054592370987,
0.4408969283103943,
0.2830677032470703,
-0.10394863039255142,
-0.06623002141714096,
-0.1944657266139984,
-0.5533323287963867,
-0.20473620295524597,
0.4881132245063782,
-0.20840905606746674,
-0.0275861099362... | |
Date and not time, then the BL/DL should pass in DateTime.Now\*\*.Date\*\* (or the equiv...basically the Date part of your DateTime object).
If you can't control the code for some reason, there's always convert(varchar(10), @YOURDATETIME, 101) | [
0.475005567073822,
-0.37409693002700806,
0.6962444186210632,
-0.00287635438144207,
0.18664255738258362,
-0.1601601243019104,
-0.11923292279243469,
0.12781235575675964,
-0.06782025843858719,
-0.8029538989067078,
-0.27432823181152344,
0.6115711331367493,
-0.29764124751091003,
0.3768995404243... | |
I recently started using Eclipse at work for my Java servlet projects. I've been using jEdit for years, which is a uber-powerful text editor. It has syntax highlighting, but it doesn't have any language-specific features like code completion and intelligent refactoring. I'm finding that's hindering my productivity. I *desperately* want to like Eclipse. I really do. But I keep running into problem after problem.
1. Now that Eclipse can use an ant script to build, instead of just creating its own build environment from an ant script then ignoring any changes to it, I found some online guides and set | [
0.2880832552909851,
0.19445449113845825,
-0.194478839635849,
-0.05091547966003418,
-0.40078234672546387,
0.17549486458301544,
0.20028918981552124,
-0.0003699094522744417,
-0.07459287345409393,
-1.0479594469070435,
0.20703454315662384,
0.39217549562454224,
-0.09155170619487762,
-0.108898289... | |
it up. It doesn't seem ready for prime time, though. My ant script builds fine from the command line, but I get all these build errors because I need to tell Eclipse all this stuff the build.xml already has in it, like the CLASSPATH, and where external jars are.
2. When I leave Eclipse running for too long, or sometimes after my laptop wakes up from hibernate, the UI starts breaking. For instance, the tabs on the editor pane disappear, so I can only edit one file at a time, and it doesn't say which one it is.
3. We have faced | [
0.24653971195220947,
-0.17637576162815094,
0.47646230459213257,
-0.005412471480667591,
-0.21316154301166534,
-0.22730150818824768,
0.05100499838590622,
-0.22733676433563232,
-0.15463097393512726,
-0.7421314716339111,
0.2673815190792084,
0.4830358624458313,
-0.02564563974738121,
-0.04801312... | |
several instances where classes weren't rebuilt that should have been, leading to inaccurate line numbers in debugging walkthroughs and other unpredictable behavior (this isn't just me; the two other developers trying it out with me are seeing the same thing).
4. I find it a huge hassle that the workspace is in a different place than my source code. I have other files I need to edit (xml files, etc), and for each directory I want to edit files in, I need to set up a special entry, and it doesn't even default to where my source code is when setting | [
0.12234127521514893,
-0.06274150311946869,
-0.07010379433631897,
0.18903715908527374,
-0.0382772721350193,
-0.17254842817783356,
0.471273809671402,
0.10313339531421661,
-0.2203376293182373,
-0.5428721308708191,
-0.1988915055990219,
0.09835249185562134,
-0.026238586753606796,
0.347412288188... | |
that up.
Do others face these same issues?
Are there better alternatives?
Try [NetBeans](http://www.netbeans.org/)
> A free, open-source Integrated
> Development Environment for software
> developers. You get all the tools you
> need to create professional desktop,
> enterprise, web, and mobile
> applications with the Java language,
> C/C++, and Ruby. | [
0.43746185302734375,
0.09780658036470413,
0.06615935266017914,
0.1276826113462448,
0.009825815446674824,
-0.1577668935060501,
0.12780095636844635,
0.052327752113342285,
-0.2669200301170349,
-0.7954115867614746,
-0.13314935564994812,
0.6435201168060303,
-0.23425482213497162,
-0.022415544837... | |
I have a asp:menu object which I set up to use a *SiteMapDataSource* but everytime I try to run the site, I get a yellow screen from firefox saying it cannot find the `web.sitemap`. Here's the code for the *sitemapdatasource* and the menu. The Web.sitemap file is sitting in the root directory of the website.
```
<div>
<asp:Menu ID="MainMenu" CssClass="wTheme" Orientation="Horizontal" runat="server" DataSourceID="SiteMapDataSource1">
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" SiteMapProvider="Web.sitemap" />
</div>
```
And this is the Web.sitemap looks like so:
```
<?xml version="1.0" encoding="utf-8" ?>
```
I had a similar problem where I was specifying the path to | [
0.10464075207710266,
0.19549629092216492,
0.5996603965759277,
-0.2521401345729828,
0.20695051550865173,
0.013612058945000172,
0.44911062717437744,
-0.05930780619382858,
-0.284772127866745,
-1.0113052129745483,
-0.1732628345489502,
0.3979814350605011,
-0.30661511421203613,
0.003771481802687... | |
the SiteMap from within my DataSource control. I tried removing it and it worked.
Try removing the path from the SiteMapDataSource and ensure that web.sitemap is in the root directory and see if that fixes it. | [
0.1492317169904709,
-0.14402970671653748,
0.36007824540138245,
0.20805825293064117,
0.13831356167793274,
-0.12633872032165527,
0.5393794178962708,
0.027253253385424614,
-0.2547959089279175,
-0.6494329571723938,
0.09183106571435928,
0.6802546977996826,
-0.42544668912887573,
0.12608499825000... | |
My friends and I are starting a game like Pokemon and we wanted to know how will we add monsters to the game? We're using VisualBasic because my friend's brother said it would be easier.
So far we can put pictures of the monsters on the screen and you can click to attack and stuff.
Right now when we want to add a monster we have to make a new window. This will take us a long time to make all the windows for each type of monster. Is there a tool or something to make this go faster? How do game | [
0.7074090838432312,
-0.22332783043384552,
0.2682019770145416,
0.25311997532844543,
-0.25956496596336365,
-0.09541817754507065,
0.030263792723417282,
0.537861168384552,
-0.23353470861911774,
-0.885658323764801,
0.4365999102592468,
0.3222746253013611,
-0.028666581958532333,
0.329489678144454... | |
companies do this?
I think the best solution would be to make a generic window which can take a few parameters which describe the monster.
Im not entirely up-to-date with VB, but in an OO language we would have a Monster base class, and inheritance to create a Pikachu. The base class would define basic things a monster has (like a picture and a name and a type) and things a monster could do (like attack, run away etc). You could even use a second level, and have base classes for each type (like ElectricMonster which inherits from Monster, and Pikachu | [
0.7414573431015015,
-0.021845974028110504,
0.03299013897776604,
0.2984868586063385,
-0.010462967678904533,
-0.3868798017501831,
-0.1268557757139206,
0.20468421280384064,
-0.12701375782489777,
0.024380849674344063,
-0.04110933095216751,
0.30288803577423096,
-0.2649810314178467,
0.1837759315... | |
inherits from ElectricMonster).
It then becomes really easy to pass a Monster object to a window, and have the window know how to pull out all the relevant information. | [
0.26342472434043884,
-0.451352596282959,
0.5373656153678894,
0.511749804019928,
0.22679255902767181,
-0.353137731552124,
0.0846303254365921,
0.027825355529785156,
-0.06084103509783745,
-0.45706579089164734,
-0.15707112848758698,
0.15959972143173218,
-0.1088714450597763,
0.13032154738903046... | |
In JavaScript, the "this" operator can refer to different things under different scenarios.
Typically in a method within a JavaScript "object", it refers to the current object.
But when used as a callback, it becomes a reference to the calling object.
I have found that this causes problems in code, because if you use a method within a JavaScript "object" as a callback function you can't tell whether "this" refers to the current "object" or whether "this" refers to the calling object.
Can someone clarify usage and best practices regarding how to get around this problem?
```
function TestObject() { | [
0.2939254343509674,
0.03268082067370415,
-0.14906413853168488,
-0.430594801902771,
-0.07709543406963348,
-0.4057294428348541,
0.14832298457622528,
-0.09120277315378189,
0.10920792818069458,
-0.48944056034088135,
-0.38252297043800354,
0.49545446038246155,
-0.5980280637741089,
-0.00311879627... | |
TestObject.prototype.firstMethod = function(){
this.callback();
YAHOO.util.Connect.asyncRequest(method, uri, callBack);
}
TestObject.prototype.callBack = function(o){
// do something | [
0.2816561758518219,
-0.32714518904685974,
-0.2729872167110443,
-0.005328669212758541,
-0.07640818506479263,
0.04001551866531372,
0.44519272446632385,
-0.11942428350448608,
0.30429381132125854,
-0.5079673528671265,
-0.11080323159694672,
0.2731509208679199,
-0.29456260800361633,
-0.172335982... | |
with "this"
//when method is called directly, "this" resolves to the current object
//when invoked by the asyncRequest callback, "this" is not the current object
//what design patterns can make this consistent?
this.secondMethod();
} | [
-0.16538743674755096,
-0.35072004795074463,
0.2938023805618286,
-0.05376612767577171,
0.3010883033275604,
-0.10100165009498596,
0.38551798462867737,
-0.22846351563930511,
0.04451139271259308,
-0.49796873331069946,
-0.19888339936733246,
0.5574727654457092,
-0.4665016531944275,
0.13511416316... | |
TestObject.prototype.secondMethod = function() {
alert('test');
}
}
```
In JavaScript, `this` always refers to the object invoking the function that is being executed. So if the function is being used as an event handler, `this` will refer to the node that fired the event. But if you have an object and call a function on it like:
```
myObject.myFunction();
```
Then `this` inside `myFunction` will refer to `myObject`. | [
0.20069283246994019,
-0.164815291762352,
-0.36515888571739197,
-0.23319895565509796,
-0.014293934218585491,
-0.305380254983902,
0.39294275641441345,
0.08245024085044861,
0.1206434816122055,
-0.4858522117137909,
-0.2563576102256775,
0.32545197010040283,
-0.5562583804130554,
-0.1177376583218... | |
Does it make sense?
To get around it you need to use closures. You can change your code as follows:
```
function TestObject() {
TestObject.prototype.firstMethod = function(){
this.callback();
YAHOO.util.Connect.asyncRequest(method, uri, callBack);
}
var that = this;
TestObject.prototype.callBack = function(o){
that.secondMethod();
}
TestObject.prototype.secondMethod = function() { | [
-0.0443367101252079,
-0.02979077771306038,
-0.14852984249591827,
-0.1259186714887619,
-0.02581048384308815,
0.14323623478412628,
0.36646339297294617,
-0.07789573818445206,
0.10330602526664734,
-0.44837209582328796,
-0.058023132383823395,
0.1540849655866623,
-0.5186175107955933,
0.250246584... | |
alert('test');
}
}
``` | [
0.3347608745098114,
-0.013953380286693573,
0.006713758688420057,
-0.23124997317790985,
0.370626300573349,
-0.4181971251964569,
0.2515708804130554,
0.25865548849105835,
0.16317246854305267,
-0.5274969339370728,
-0.49387696385383606,
0.781390905380249,
-0.5077680349349976,
0.0590771846473217... | |
I am currently programming a scheduling application which loosely based on iCalendar standard. Does anyone knows in which property can I store the event creator's information? By browsing through the iCalendar RFC 2445, I find this property: [Organizer](http://www.kanzaki.com/docs/ical/organizer.html). can I store the event creator's information in the property even if he/she is the only person involved in the event? or there is already a field to store the event creator's information???!
Some notes from the rfc2445
Conformance: This property MUST be specified in an iCalendar object
that specifies a group scheduled calendar entity. This property MUST
be specified in an iCalendar object | [
0.28536170721054077,
-0.03435753285884857,
0.09892504662275314,
0.184237539768219,
-0.010766110382974148,
-0.25024744868278503,
-0.26138415932655334,
-0.26459556818008423,
-0.3072460889816284,
-0.48720216751098633,
0.08935457468032837,
0.35627686977386475,
0.19902469217777252,
0.4737672209... | |
that specifies the publication of
a calendar user's busy time. This property **MUST NOT be specified** in
an iCalendar object that specifies only a time zone definition or
that **defines calendar entities that are not group scheduled entities,
but are entities only on a single user's calendar**. | [
0.18108519911766052,
-0.10618259012699127,
0.5034163594245911,
0.24723497033119202,
0.2896037995815277,
-0.14070995151996613,
-0.185020312666893,
0.2741169035434723,
-0.5528725981712341,
-0.479221373796463,
-0.024804100394248962,
0.014055120758712292,
-0.016282720491290092,
0.2044448405504... | |
I've never really understand why a web service implementer would choose one over the other. Is XML-RPC generally found in older systems? Any help in understanding this would be greatly appreciated.
Differences?
SOAP is more powerful, and is much preferred by software tool vendors (MSFT .NET, Java Enterprise edition, that sort of things).
SOAP was for a long time (2001-2007ish) seen as the protocol of choice for SOA. xml-rpc not so much. REST is the new SOA darling, although it's not a protocol.
SOAP is more verbose, but more capable.
SOAP is not supported in some of the older stuff. For example, no SOAP | [
0.0040925415232777596,
-0.3815917670726776,
0.6003370881080627,
0.0017831107834354043,
-0.6597952246665955,
-0.18379750847816467,
0.22980377078056335,
-0.08210790902376175,
-0.2037236988544464,
-0.7425510287284851,
0.03129545971751213,
0.4029344320297241,
-0.21230126917362213,
0.0314041934... | |
libs for classic ASP (that I could find).
SOAP is not well supported in python. XML-RPC has great support in python, in the standard library.
SOAP supports document-level transfer, whereas xml-rpc is more about values transfer, although it can transfer structures such as structs, lists, etc.
xm-rpc is really about program to program language agnostic transfer. It primarily goes over http/https. SOAP messages can go over email as well.
xml-rpc is more unixy. It lets you do things simply, and when you know what you're doing, it's very fast to deploy quality web services, even when using terminal text editors. Doing SOAP that | [
0.23019233345985413,
-0.050749290734529495,
0.3121277689933777,
-0.08600235730409622,
-0.6820732355117798,
-0.2263411283493042,
0.0772484689950943,
-0.21295815706253052,
-0.05415219068527222,
-0.7285963296890259,
0.04947122931480408,
0.49731990694999695,
-0.3805520832538605,
-0.20516873896... | |
way is a zoo; you really need a good IDE to make it feasible.
Knowing SOAP, though, will look much better on your resume/CV if you're vying for a Fortune 500 IT job.
xml-rpc has some issues with non-ascii character sets.
XML-RPC does not support named parameters. They must be in correct order. Not sure about SOAP, but think so. | [
0.5731075406074524,
-0.18330828845500946,
0.32360708713531494,
0.3124990463256836,
0.11646720767021179,
-0.13591913878917694,
0.15232661366462708,
-0.0851234570145607,
-0.08570227771997452,
-0.4169573187828064,
0.009287962689995766,
0.4723551869392395,
-0.050400737673044205,
-0.23279879987... | |
Our team is setting up nightly and continuous integration builds. We own Team Foundation Server and could use Team Foundation Build. I'm more familiar with CC.Net and lean that way but management sees all the money spent on TFS and wants to use it.
Some things I like better about CC.Net is the flexibility of notifications as well as the ease of implementing custom scripts.
If you have experience with both products, which do you prefer and why?
I've used both. I guess it depends on what your organization values.
Since you are familiar with CC Net, I won't speak much to that. You | [
0.900174617767334,
0.16917574405670166,
-0.2051181197166443,
0.12463482469320297,
-0.28646042943000793,
-0.38362574577331543,
0.12274085730314255,
0.05376671999692917,
-0.26317641139030457,
-0.802992045879364,
0.4438023865222931,
0.5385093092918396,
0.1354859471321106,
-0.1545693725347519,... | |
already know what makes it cool.
**Here's what I like about Team Foundation Build:**
* Build Agents. It's very simple to turn any box into a build machine and run a build on it. MSFT got this one right.
* Reporting. All relevant build results (test included) are stored in a SQL database and reported on via SQL Server Reporting Services. This is an immensely powerful tool for charting build and test results over time. CC Net doesn't have this built in.
* You can do similar customizations via MSBUILD. It's basically the same as using NAnt with CC Net
**Here's what drives me up | [
0.8584620952606201,
0.0524248443543911,
-0.010316446423530579,
0.15018384158611298,
-0.17280127108097076,
-0.41795942187309265,
0.17421497404575348,
-0.09544318914413452,
-0.272458553314209,
-0.7308988571166992,
0.24660266935825348,
0.5033636093139648,
0.12090553343296051,
-0.2274932563304... | |
the wall about Team Foundation Build:**
* To build C++/CLI projects (or run unit tests...?) the build agent must have VSTS Dev or Team Suite installed. This, friends, is just batsh\*t crazy.
* It must be connected to the TFS Mothership
If you're in a big org with lots of bosses who have huge budgets and love reports (and don't get me wrong, this has huge value) OR you need to scale up to a multi-machine build farm, I'd prefer Team Foundation Build.
If you're a leaner shop, stick with CC Net and grow your own reporting solutions. That's what we did.
Until we | [
1.0169113874435425,
0.24650174379348755,
-0.06316151469945908,
0.2521096467971802,
-0.20416469871997833,
-0.562109112739563,
0.17400233447551727,
0.14814533293247223,
-0.11976952105760574,
-0.47364744544029236,
0.12091267853975296,
0.2409607321023941,
0.15818281471729279,
-0.04035933688282... | |
got acquired. And got TFS :P | [
0.11415315419435501,
-0.32556697726249695,
0.5849209427833557,
0.4115714728832245,
0.2938400208950043,
0.21872824430465698,
-0.35529714822769165,
0.03358476608991623,
-0.7261694669723511,
-0.04511727765202522,
-0.02943616732954979,
0.14082463085651398,
0.11142554879188538,
-0.1699651479721... | |
What algorithms and processes are involved in storing revision changes like stackoverflow and wikipedia do?
Is only one copy of the message kept? And if so is it only the latest copy? Then only changes to go back to the previous version(s) are stored from there? (This would make for a faster display of the main message).
Or are complete messages stored? And if so is the compare done between these on each display?
What algorithms are best used to determine the exact changes in the message? How is this data stored in a database?
If anyone knows exactly what wikipedia or stackoverlfow does | [
0.03143220767378807,
0.17298847436904907,
0.6337053179740906,
0.1926485300064087,
0.11622613668441772,
0.006220369134098291,
0.1600421816110611,
-0.09678801149129868,
-0.5128236413002014,
-0.5863181352615356,
0.052890874445438385,
0.5103699564933777,
-0.06173379719257355,
0.388630241155624... | |
I'd love to know.
The [longest common substring algorithm](http://en.wikipedia.org/wiki/Diff#Algorithm) can be used to detect differences between versions, but it is limited. For example, it does not detect the moving around of text as such, but it would see this as unrelated removals and insertions.
I suppose that websites normally store the latest copy in full, and apply reverse diffs from there. This is also the way [CVS](http://en.wikipedia.org/wiki/Concurrent_Versions_System) works, but [Subversion](http://en.wikipedia.org/wiki/Subversion_(software)) uses forward diffs, which results in slower checkouts.
To store this in a database, one could maintain a main table with the latest versions, and have a separate table with the reverse differences. | [
0.5429736375808716,
-0.16740962862968445,
0.5154536366462708,
0.1917010396718979,
0.04581579193472862,
-0.13538701832294464,
-0.12965324521064758,
-0.003872038796544075,
-0.060034651309251785,
-0.3722955286502838,
0.040820199996232986,
0.06486755609512329,
0.014216877520084381,
0.371795713... | |
This table would have rows in the format `(article_id, revision_id, differences)`. | [
-0.3463202714920044,
0.24750936031341553,
0.6363707184791565,
-0.09504576772451401,
0.13603173196315765,
0.1943918615579605,
-0.38642460107803345,
-0.2494145631790161,
0.05518534407019615,
-0.45665332674980164,
-0.036310918629169464,
0.06423859298229218,
-0.273222953081131,
0.2108498811721... | |
I want to use javascript to insert some elements into the current page.
Such as this is the original document:
<p>Hello world!</p>
Now I want to insert an element in to the text so that it will become:
<p>Hello <span id=span1>new</span> world!</p>
I need the span tag because I want to handle it later.Show or hide.
But now problem comes out, if the original page has already defined a strange CSS style on all <span> tags, the "new" I just inserted will not appear to be the same as "Hello" and "world". How can I avoid this? I want the "new" be exactly the same as | [
0.34959688782691956,
0.044373758137226105,
0.47988227009773254,
-0.10370898991823196,
-0.2159736454486847,
0.02543048746883869,
0.18981069326400757,
-0.2343696802854538,
-0.2719351649284363,
-0.6390445232391357,
-0.04091483727097511,
0.23201867938041687,
-0.286598801612854,
0.0440427698194... | |
the "Hello" and "world".
Simply override any span styles. Set layout properties back to browser defaults and set formating to inherit from the parent:
```
span#yourSpan {
/* defaults */
position: static;
display: inline;
margin: 0;
padding: 0;
background: transparent;
border: none;
/* inherit from parent node */
font: inherit;
color: inherit;
text-decoration: inherit;
line-height: inherit;
letter-spacing: inherit;
text-transform: inherit;
white-space: inherit;
word-spacing: inherit;
}
```
This should be sufficient, although you may need to add !important if you are not using an id:
```
<span class="hello-node">hello</span>
span.hello-node {
/* defaults */ | [
-0.026027552783489227,
-0.09454847872257233,
0.6564861536026001,
0.0502631776034832,
-0.063165083527565,
0.05634453520178795,
0.23920418322086334,
-0.5897448062896729,
-0.26904547214508057,
-0.7383963465690613,
-0.5506783127784729,
0.3984549641609192,
-0.08553282171487808,
0.03808275610208... | |
position: static !important;
display: inline !important;
...
}
``` | [
-0.42027270793914795,
0.32309237122535706,
0.3418729901313782,
-0.22615061700344086,
0.0458378791809082,
0.17039000988006592,
-0.2120724618434906,
0.2511344254016876,
-0.08842549473047256,
-0.45364874601364136,
-0.34921514987945557,
0.578373372554779,
-0.31207576394081116,
0.12097359448671... | |
Is there any library available to query Btrieve databases without buying something from Pervasive? I'm looking to code in C# or Python.
As far as I know that is not possible. It is not an open source database, so writing drivers for it is really hard. | [
0.6411653161048889,
0.3647652566432953,
-0.27532416582107544,
0.2435390055179596,
-0.11635341495275497,
0.00977291353046894,
0.04228184372186661,
0.5725011229515076,
0.2225174605846405,
-0.4035980999469757,
0.3727208971977234,
1.101932168006897,
-0.2947225570678711,
0.013748016208410263,
... | |
I was writing a database handler class in PHP using the mysqli class and prepared statements. I was attempting to print out the result. It didn't work right off the bat so I decided to do some debugging. I tried to use the `num_rows()` method from the `mysqli_statement` class, but it kept returning 0. I decided to write a small portion of the test code to keep it simpler so I could see what was going wrong. I was then able to return the data I wanted, but the `num_rows()` method still returns 0 even when it is actually selecting | [
0.1610410511493683,
0.20546816289424896,
-0.19143259525299072,
-0.05096394568681717,
-0.3579230308532715,
0.04353918880224228,
0.3617318570613861,
-0.23888689279556274,
0.21146026253700256,
-0.17025470733642578,
0.3810429573059082,
0.34618502855300903,
-0.4906010627746582,
0.11098356544971... | |
and retrieving some data. Here is the code:
```
$mysqli = new mysqli('localhost', 'username', 'password', 'database');
if(mysqli_connect_errno())
{
die('connection failed');
}
$statement = $mysqli->stmt_init();
$query = "SELECT name FROM table WHERE id = '2000'";
if($statement->prepare($query))
{
$statement->execute();
$statement->bind_result($name);
$statement->fetch();
$statement->store_result();
echo $statement->num_rows();
echo $name;
}
else
{
echo 'prepare statement failed';
exit();
}
```
The expected result is:
```
1name
```
And the actual result is:
```
0name
```
Can anyone tell me why this is?
I wonder if num\_rows() is reporting relative to the current resultset. Try capturing num\_rows() prior to fetching the data. e.g.
```
if($statement->prepare($query))
{ | [
-0.08787459880113602,
-0.0872744470834732,
0.6017804145812988,
-0.19573065638542175,
0.09550625085830688,
0.24221789836883545,
0.41131749749183655,
-0.6785491704940796,
-0.22195544838905334,
-0.3709215223789215,
-0.4689684212207794,
0.6341977715492249,
-0.1528426855802536,
0.19789890944957... | |
$statement->execute();
$statement->store_result();
echo $statement->num_rows();
$statement->bind_result($name);
$statement->fetch();
echo $name;
}
```
Does that have any effect? | [
0.2552768588066101,
0.04300382733345032,
0.24668993055820465,
-0.41192397475242615,
0.037863947451114655,
-0.1066693589091301,
0.2728468179702759,
-0.48115286231040955,
-0.08175715804100037,
-0.01422610692679882,
-0.3415357172489166,
0.2719822824001312,
-0.5444941520690918,
0.3029525578022... | |
I've read in a couple of places that the desktop wallpaper can be set to an HTML document. Has anyone had any success changing it programmatically?
The following snippet of VB6 helps me set things up for BMPs but when I try to use it for HTML, I get a nice blue background and nothing else.
```
Dim reg As New StdRegistry
Public Function CurrentWallpaper() As String
CurrentWallpaper = reg.ValueEx(HKEY_CURRENT_USER, "Control Panel\Desktop", "Wallpaper", REG_SZ, "")
End Function
Public Sub SetWallpaper(cFilename As Variant)
reg.ClassKey = HKEY_CURRENT_USER
reg.SectionKey = "Control Panel\Desktop"
reg.ValueKey = "Wallpaper" | [
0.34580641984939575,
0.14246074855327606,
0.6998832821846008,
-0.08770702034235,
0.12074557691812515,
0.027864402160048485,
-0.026373501867055893,
-0.08206585049629211,
-0.4237472712993622,
-0.6917672753334045,
-0.1541309654712677,
0.39440786838531494,
-0.23145806789398193,
0.2126080393791... | |
reg.ValueType = REG_SZ
reg.Default = ""
reg.Value = cFilename
End Sub
Public Sub RefreshDesktop()
Dim oShell As Object
Set oShell = CreateObject("WScript.Shell")
oShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True
End Sub
```
Perhaps there's some other setting that's required. Any ideas?
I'm not sure if there's an official API for this, but if you have your heart set on it you could use Sysinternal's [Process Monitor](http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx) and see what registry keys get touched when you set an HTML desktop background via the UI. Then you'd just need to repeat those edits | [
0.28419554233551025,
0.03107442893087864,
0.83135586977005,
0.09077325463294983,
0.1813792586326599,
-0.09165873378515244,
0.5872489213943481,
-0.24517086148262024,
-0.3200109899044037,
-0.7871621251106262,
-0.016480736434459686,
0.6549502611160278,
-0.08770540356636047,
0.1795371770858764... | |
in your code. However, an API call would be far preferable in terms of backward/forward compatibility. | [
0.39752086997032166,
0.008339754305779934,
0.002786448458209634,
0.20889168977737427,
0.1492455005645752,
-0.16666004061698914,
0.43592050671577454,
0.22715993225574493,
0.031314752995967865,
-0.5536268949508667,
-0.2221851348876953,
0.5930168628692627,
-0.14379172027111053,
0.014966166578... | |
I've been looking into report definition customization extensions (RDCE) in SQL2K8 recently and I've been at a loss to find much documentation or even chatter on the internet about it.
MSDN has a brief overview: <http://msdn.microsoft.com/en-us/library/cc281022.aspx>
And the sample report from this book [http://www.amazon.com/Applied-Microsoft-Server-Reporting-Services/dp/0976635313/ref=pd\_bbs\_sr\_2?ie=UTF8&s=books&qid=1221629676&sr=8-2](https://rads.stackoverflow.com/amzn/click/com/0976635313) is something, but I was wondering if anyone had real experience with this and how it worked out for them. And if anyone has other references worth looking at I'd appreciate it.
You have to code it all yourself -- Poppler only handles the PDF part, you have to write the GUI. Look at the code to [Evince](http://www.gnome.org/projects/evince/) for | [
0.07241565734148026,
-0.05373842641711235,
0.2681974172592163,
0.02087581716477871,
0.019037241116166115,
-0.07826556265354156,
0.05479751527309418,
-0.2639434039592743,
-0.3577127158641815,
-0.5488302111625671,
-0.21847306191921234,
0.49688395857810974,
-0.16902270913124084,
-0.1938930153... | |
a good example. | [
0.32969048619270325,
0.15601646900177002,
-0.2148413360118866,
-0.0011505481088533998,
0.02134675905108452,
-0.03888644278049469,
0.3604324758052826,
-0.025737356394529343,
-0.227177232503891,
-0.18918201327323914,
0.19871550798416138,
0.11523076146841049,
0.039550986140966415,
-0.04309232... | |
I have tried:
1. Xdebug and Eclipse. Eclipse launches a web browser, but the browser tries to access a non-existent file in Eclipse's .app bundle.
2. Xdebug and NetBeans. It does a little bit better; a browser opens a page in /tmp which says "Launching. Please wait…" but nothing happens beyond that.
3. Xdebug and debugclient, the CLI tool which comes with Xdebug. MacPorts (which I used to install PHP and Xdebug) doesn't seem to install this by itself, and when I try compiling it by hand, I get told "you have strange libedit". Installing libedit via MacPorts doesn't solve that.
4. Zend's debugger | [
0.45069533586502075,
0.08801878243684769,
0.3023306727409363,
0.000421721488237381,
-0.5567773580551147,
-0.28303006291389465,
-0.08584378659725189,
0.05185398831963539,
-0.15980717539787292,
-0.773467481136322,
0.03314797580242157,
0.5229785442352295,
-0.37468430399894714,
0.2006905376911... | |
(the precise name escapes me right now) and Eclipse. I can't recall what the problem was, as this was some time ago, but it didn't work.
With regards to Xdebug, at least, I'm fairly confident I've installed it correctly. It shows up with both a phpinfo() in a PHP file and a `php -i` in the CLI.
If anyone has managed to get PHP debugging working in some way or other on the Mac, I'd appreciate it if you could share with me how. Littering code with `var_dump($foo);die();` gets old quick. Bonus points if it can be done *without* using some bloatware | [
0.3740563690662384,
0.2061576247215271,
0.2579248249530792,
-0.050395041704177856,
-0.29671773314476013,
-0.26887860894203186,
0.2423648238182068,
0.21177737414836884,
-0.20279353857040405,
-0.5340895056724548,
0.1613072007894516,
0.7129330635070801,
-0.24964803457260132,
0.181143507361412... | |
editor like Eclipse, or that expensive proprietary thing Zend wants to sell me.
My server is connecting to PHP via FastCGI, if that makes a diff.
You may want to look into [MacGDBp](http://www.bluestatic.org/software/macgdbp/). It's new, free, and the UI looks great. It utilizes the Xdebug PHP extension as well. You can find instructions in the [help](http://www.bluestatic.org/software/macgdbp/help.php) section, which includes Xdebug configurations, and there's also a nice overview of the app from the guys at Particletree here: [Silence The Echo with MacGDBp](http://particletree.com/notebook/silence-the-echo-with-macgdbp/). | [
0.2607397735118866,
-0.10748784989118576,
0.2469414472579956,
-0.09440406411886215,
-0.3973217010498047,
-0.1953417807817459,
0.16051416099071503,
0.005483212415128946,
-0.25378358364105225,
-0.8564636707305908,
0.1825610250234604,
0.5353081822395325,
-0.3617421090602875,
-0.08252394944429... | |
Is there a quick way to find every match of a regular expression in Ruby? I've looked through the Regex object in the Ruby STL and searched on Google to no avail.
Using [`scan`](http://ruby-doc.org/core-1.9.3/String.html#method-i-scan) should do the trick:
```
string.scan(/regex/)
``` | [
0.3185415267944336,
-0.011170954443514347,
0.393950492143631,
0.027732135728001595,
-0.09436976909637451,
-0.04182026535272598,
0.35842883586883545,
0.06361757963895798,
-0.05346401408314705,
-0.5348531603813171,
0.05356341600418091,
0.586689829826355,
-0.40870773792266846,
-0.091033235192... | |
I'm trying to trigger a progress animation when ever the ViewModel/Presentation Model is Busy. I have an IsBusy Property, and the ViewModel is set as the DataContext of the UserControl. What is the best way to trigger a "progressAnimation" storyboard when the IsBusy property is true? Blend only lets me add event triggers at the UserControl level, and I can only create property triggers in my data templates.
The "progressAnimation" is defined as a resource in the user control.
I tried adding the DataTriggers as a Style on the UserControl, but when I try to start the StoryBoard I get the following | [
0.29065603017807007,
-0.2681320309638977,
0.44318222999572754,
0.07069066166877747,
-0.03527091071009636,
0.03835718706250191,
0.12310779094696045,
-0.11964542418718338,
-0.09535053372383118,
-0.730587363243103,
-0.03465766832232475,
0.5580052137374878,
-0.133718803524971,
-0.0689620748162... | |
error:
> 'System.Windows.Style' value cannot be assigned to property 'Style'
> of object'Colorful.Control.SearchPanel'. A Storyboard tree in a Style
> cannot specify a TargetName. Remove TargetName 'progressWheel'.
ProgressWheel is the name of the object I'm trying to animate, so removing the target name is obviously NOT what I want.
I was hoping to solve this in XAML using data binding techniques, instead of having to expose events and start/stop the animation through code.
What you want is possible by declaring the animation on the progressWheel itself:
The XAML:
```
<UserControl x:Class="TriggerSpike.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="300" Width="300">
<UserControl.Resources>
<DoubleAnimation x:Key="SearchAnimation" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:4"/>
<DoubleAnimation x:Key="StopSearchAnimation" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:4"/>
</UserControl.Resources>
<StackPanel> | [
-0.27502119541168213,
0.007165499497205019,
0.3769306540489197,
-0.04742654785513878,
-0.23118478059768677,
0.32452210783958435,
0.13322167098522186,
-0.2868395745754242,
-0.3770982623100281,
-0.10966211557388306,
-0.19940434396266937,
0.27358773350715637,
-0.31169530749320984,
0.001291297... | |
<TextBlock Name="progressWheel" TextAlignment="Center" Opacity="0">
<TextBlock.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding IsBusy}" Value="True">
<DataTrigger.EnterActions> | [
-0.302993506193161,
-0.0003496876161079854,
0.4919629693031311,
-0.0326206311583519,
-0.13331128656864166,
0.022109312936663628,
0.18885216116905212,
-0.4561946988105774,
-0.19128142297267914,
-0.3559355139732361,
-0.25838345289230347,
0.056824080646038055,
-0.3858675956726074,
0.064712628... | |
<BeginStoryboard>
<Storyboard>
<StaticResource ResourceKey="SearchAnimation"/> | [
0.052601754665374756,
-0.23781681060791016,
0.1828262209892273,
0.12183969467878342,
0.4645795524120331,
-0.3520030975341797,
0.2749637961387634,
0.17512699961662292,
-0.30307409167289734,
-0.7543815970420837,
-0.42392170429229736,
0.16370199620723724,
0.26352035999298096,
0.19950130581855... | |
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions> | [
-0.37226101756095886,
-0.12852086126804352,
0.2606189250946045,
0.208729088306427,
0.4628007709980011,
-0.01054935622960329,
0.18293771147727966,
-0.14530488848686218,
-0.31624138355255127,
-0.7399630546569824,
-0.5311957597732544,
-0.11572566628456116,
0.04133715480566025,
-0.316772222518... | |
<BeginStoryboard>
<Storyboard>
<StaticResource ResourceKey="StopSearchAnimation"/> | [
0.07395932078361511,
-0.2015146166086197,
0.1380632221698761,
0.2712678015232086,
0.3560650944709778,
-0.10115385055541992,
0.17988845705986023,
0.29168474674224854,
-0.4152476489543915,
-0.7130722403526306,
-0.3547818660736084,
0.019012419506907463,
0.18637168407440186,
-0.164272740483284... | |
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger> | [
-0.33075135946273804,
-0.21792367100715637,
0.1901988387107849,
0.27582821249961853,
0.44893503189086914,
-0.1371554583311081,
0.07437295466661453,
-0.04446703568100929,
-0.24535563588142395,
-0.6440355777740479,
-0.4882119297981262,
-0.04327563941478729,
0.0758654847741127,
-0.22797349095... | |
</Style.Triggers>
</Style>
</TextBlock.Style>
Searching
</TextBlock>
<Label Content="Here your search query"/>
<TextBox Text="{Binding SearchClause}"/>
<Button Click="Button_Click">Search!</Button>
<TextBlock Text="{Binding Result}"/>
</StackPanel>
```
Code behind:
```
using System.Windows;
using System.Windows.Controls;
namespace TriggerSpike
{
public partial class UserControl1 : UserControl
{
private MyViewModel myModel; | [
0.02519630640745163,
-0.15596316754817963,
0.3348604440689087,
-0.010825734585523605,
0.007234333548694849,
0.024325931444764137,
-0.027242617681622505,
-0.37965402007102966,
-0.19965720176696777,
-0.5927525758743286,
-0.13082030415534973,
0.3993658423423767,
-0.2254566103219986,
-0.003370... | |
public UserControl1()
{
myModel=new MyViewModel();
DataContext = myModel;
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
myModel.Search(myModel.SearchClause); | [
-0.6135509610176086,
-0.2931057810783386,
0.676245927810669,
-0.18550853431224823,
0.44640201330184937,
0.05562659353017807,
0.29736244678497314,
0.15580511093139648,
-0.16684626042842865,
-0.7964032888412476,
-0.5168863534927368,
0.5983484983444214,
-0.3463473320007324,
0.3787099123001098... | |
}
}
}
```
The viewmodel:
```
using System.ComponentModel;
using System.Threading;
using System.Windows;
namespace TriggerSpike
{
class MyViewModel:DependencyObject
{
public string SearchClause{ get;set;}
public bool IsBusy
{
get { return (bool)GetValue(IsBusyProperty); }
set { SetValue(IsBusyProperty, value); }
} | [
-0.017672965303063393,
-0.44085389375686646,
0.5341178774833679,
-0.14992322027683258,
0.09360532462596893,
0.10997358709573746,
0.1987268179655075,
0.045531775802373886,
-0.11999683827161789,
-0.5178580284118652,
-0.37927013635635376,
0.8577568531036377,
-0.3446597456932068,
-0.0456152334... | |
public static readonly DependencyProperty IsBusyProperty =
DependencyProperty.Register("IsBusy", typeof(bool), typeof(MyViewModel), new UIPropertyMetadata(false));
public string Result
{
get { return (string)GetValue(ResultProperty); }
set { SetValue(ResultProperty, value); }
}
public static readonly DependencyProperty ResultProperty = | [
-0.1546844244003296,
-0.2839086949825287,
0.502060055732727,
0.006785574834793806,
0.26817238330841064,
0.14309433102607727,
0.36598852276802063,
-0.10548964142799377,
-0.035302769392728806,
-0.4024561643600464,
-0.4428892433643341,
0.923781156539917,
-0.41860848665237427,
0.28372290730476... | |
DependencyProperty.Register("Result", typeof(string), typeof(MyViewModel), new UIPropertyMetadata(string.Empty));
public void Search(string search_clause)
{
Result = string.Empty;
SearchClause = search_clause;
var worker = new BackgroundWorker();
worker.DoWork += worker_DoWork;
worker.RunWorkerCompleted | [
0.008525839075446129,
-0.347329318523407,
0.6717512011528015,
-0.3120521605014801,
0.4819537401199341,
0.33033299446105957,
0.28550654649734497,
-0.1954129934310913,
-0.3190419673919678,
-0.44992581009864807,
-0.21347889304161072,
0.8873735666275024,
-0.7207326292991638,
0.3462853729724884... | |
+= worker_RunWorkerCompleted;
IsBusy = true;
worker.RunWorkerAsync();
}
void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
IsBusy=false;
Result = "Sorry, no results found for: " + SearchClause;
} | [
-0.21534430980682373,
-0.17053170502185822,
0.3105977773666382,
-0.3334312438964844,
0.21585844457149506,
0.2094581127166748,
0.6945822238922119,
-0.1725391447544098,
-0.28311407566070557,
-0.4699869155883789,
-0.42488008737564087,
0.48168036341667175,
-0.5194926857948303,
0.26988273859024... | |
void worker_DoWork(object sender, DoWorkEventArgs e)
{
Thread.Sleep(5000);
}
}
}
```
Hope this helps! | [
0.4399075210094452,
0.13060103356838226,
0.18786606192588806,
-0.4729255437850952,
0.4076133072376251,
-0.08249297738075256,
0.4648389220237732,
0.002555681159719825,
-0.3746712803840637,
-0.8190568685531616,
-0.04240412265062332,
0.5219396352767944,
-0.2627420723438263,
0.4576843082904815... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.