text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
more than project development :-) How currently organizations handle legal expenses for customer projects in most cases: via overhead or via time and materials?
Since it looks, from the comments, like you're specifically trying to avoid infringing on anyone else's patents in your software development process, I'll addr... | [
0.6673142910003662,
0.3502125144004822,
-0.008926939219236374,
0.1619754433631897,
0.3078596591949463,
-0.1264646351337433,
-0.119742251932621,
-0.4627092778682709,
-0.19227835536003113,
-0.3090389370918274,
0.16400283575057983,
1.040553092956543,
0.32186827063560486,
0.04647711664438248,
... | |
(or some "risky" subset) of your code base as it's developed is unlikely to be cost-effective for a customer, and I doubt you'll find anyone willing to pay for it -- the risk/benefit ratio, especially for custom code (which nobody else is going to see source for). I can theoretically envisage some ultra-paranoid compan... | [
0.7722179889678955,
0.42877665162086487,
-0.12373320013284683,
0.39854153990745544,
0.22321659326553345,
-0.08909077942371368,
0.20986402034759521,
0.112080417573452,
-0.06950295716524124,
-0.25043347477912903,
0.021995224058628082,
0.7319551110267639,
0.09868278354406357,
-0.0822341144084... | |
finding *any* relevant patents that might apply. I know a couple of patent-searching lawyers (doing IT for them was a speciality of a former job), and it's not a simple task to identify which patent(s) might infringe a chunk of code you've written. I'd expect that you'd almost need a patent lawyer per developer to keep... | [
0.7373676300048828,
0.5786091685295105,
-0.20798508822917938,
0.24814297258853912,
0.32166895270347595,
-0.04181687533855438,
0.17377938330173492,
0.014733557589352131,
-0.13486066460609436,
-0.15237656235694885,
0.05439825728535652,
0.8995689153671265,
0.32456696033477783,
0.1430245935916... | |
suspect. You can't second-guess them, either, otherwise all those carefully-crafted protections you're selling to your customers are utterly worthless, so your code will have to be squeaky-clean to pass the lawyer(s)' scrutiny. Good luck writing code at a reasonable pace without using any new technology, process, or al... | [
0.6247150301933289,
0.3268865644931793,
0.31866031885147095,
0.4674593210220337,
0.5030838251113892,
-0.3364184498786926,
0.11237972229719162,
-0.38694748282432556,
-0.2510397136211395,
-0.131670281291008,
0.17118321359157562,
0.47286441922187805,
-0.14775687456130981,
-0.08354499191045761... | |
have to sue the lawyer who stuffed up (or, rather, his/her professional indemnity insurance) to get any money out of them. What's more, all the patent search agreements I've seen have been of the "all care, but no responsibility" form. You might be able to crack that facade, with some extra legal maneuvering, but it'll... | [
0.8391230702400208,
0.4937969148159027,
0.05803278461098671,
0.3597053289413452,
0.40234506130218506,
-0.18757954239845276,
-0.10127604752779007,
-0.10436099767684937,
-0.4318844676017761,
-0.06735401600599289,
0.10473649203777313,
0.7344971299171448,
0.20028133690357208,
0.263262718915939... | |
product?). For copyright, your best protection is to educate your developers on what constitutes copyright infringement, and thwack *hard* anyone dumb enough to break the rules. | [
0.9140537977218628,
0.37857428193092346,
0.26098188757896423,
0.13385722041130066,
0.4099160432815552,
-0.42564693093299866,
0.19485832750797272,
0.09924162179231644,
-0.03958505764603615,
-0.038469813764095306,
-0.3237042725086212,
0.6251221299171448,
0.19176942110061646,
0.32209172844886... | |
I've the coordinates of the letters (e.g. using SVG). How could I generate a TrueType/PostScript font for my computer ?
(**edited** : changed *vectorial* to TrueType/PostScript )
You may look at [FontForge](http://fontforge.sourceforge.net/) the ugly yet powerful font editor. It can also import SVG. | [
0.4561217129230499,
0.18604883551597595,
0.7130188941955566,
0.03626256436109543,
-0.19239839911460876,
-0.04635912925004959,
0.15450821816921234,
-0.023612117394804955,
-0.006312134210020304,
-0.9083586931228638,
0.05979744717478752,
0.34609130024909973,
-0.004742822609841824,
-0.05155448... | |
What prerequisites are needed to do strict Unicode programming?
Does this imply that my code should not use `char` types anywhere and that functions need to be used that can deal with `wint_t` and `wchar_t`?
And what is the role played by multibyte character sequences in this scenario?
Note that this is not about "st... | [
0.1751018911600113,
0.2613779604434967,
0.07879666984081268,
-0.03340795636177063,
-0.01858002133667469,
-0.047988902777433395,
0.09140659123659134,
-0.06466387212276459,
-0.003912496380507946,
-0.5508109331130981,
-0.13848991692066193,
0.3768606185913086,
-0.3015708327293396,
0.1279828399... | |
too much about performance hits. When performance was an issue, we also supplied UTF-16 interfaces (using our own datatype).
Applications could remain largely as-is (using char), although in some cases they need to be aware of certain issues. For instance, instead of strncpy() we use a wrapper which avoids cutting off... | [
0.15481434762477875,
-0.010324808768928051,
0.18212488293647766,
0.38110703229904175,
-0.41847026348114014,
-0.017819253727793694,
0.2960757315158844,
-0.15309453010559082,
-0.03326667472720146,
-0.5608537793159485,
-0.07868370413780212,
0.33306095004081726,
-0.16617843508720398,
-0.125484... | |
there (depending on your application).
We do not use wchar\_t. Using ICU avoids unexpected issues in portability (but not other unexpected issues, of course :-). | [
0.3041607439517975,
0.17507824301719666,
0.4613623023033142,
0.19452419877052307,
0.1791166067123413,
-0.28828564286231995,
0.11078419536352158,
0.24428097903728485,
-0.07218325138092041,
-0.6445375084877014,
-0.07235099375247955,
0.5675042867660522,
-0.3174814283847809,
0.2127992063760757... | |
I am new to JQuery but I've started by making a list creator essentially. I have an empty list and an input field and a link for the user to add elements to the list. When I add something, I would like it to be hidden at first and then show up dynamically using JQuery. Currently, it adds it to the list but it sets the ... | [
0.5660445094108582,
-0.13871000707149506,
0.3993038833141327,
-0.1512012779712677,
-0.19920995831489563,
-0.1680331975221634,
0.19274838268756866,
-0.2264023721218109,
-0.3023199439048767,
-0.7338026165962219,
0.2839876413345337,
0.44707876443862915,
-0.29981765151023865,
0.276609838008880... | |
$('<li />')
.text($('#step').val())
.hide()
.appendTo('ol#instructions')
.show('normal');
}
});
```
Here is some HTML
```
<ol id="instructions"></ol>
<input type="text" id="step" size="60" />
<a href="#" id="addstep">Add</a>
```
I'm not exactly sure why your addin... | [
0.5261216163635254,
-0.2927948236465454,
0.6446244716644287,
-0.06632202118635178,
-0.05786219984292984,
-0.15777230262756348,
0.5321513414382935,
-0.5519163012504578,
-0.10196740180253983,
-0.652978241443634,
-0.39039599895477295,
0.5469056963920593,
-0.4887113571166992,
-0.18979282677173... | |
have to.
```
$('a#addstep').click(function() {
if ( $('#step').val().length > 0 ) {
$('<li />')
.text($('#step').val())
.hide()
.appendTo('ol#instructions') | [
0.45500048995018005,
-0.16253162920475006,
0.4011995196342468,
-0.1737430989742279,
0.607994019985199,
0.020183924585580826,
0.609745442867279,
-0.6397066116333008,
0.20189087092876434,
-0.6570253372192383,
-0.46037161350250244,
0.5147463083267212,
-0.4563998579978943,
-0.22553250193595886... | |
.show('normal', function() {
$(this).css('display', 'list-item')
});
}
});
``` | [
0.30513978004455566,
0.034579936414957047,
0.46266067028045654,
-0.1673535257577896,
-0.008599797263741493,
-0.18083226680755615,
0.209581658244133,
0.0290205255150795,
-0.05872086435556412,
-0.6397462487220764,
-0.643766462802887,
0.4562769830226898,
-0.6623571515083313,
0.389356911182403... | |
I have a simple model that is defined as:
```
class Article(models.Model):
slug = models.SlugField(max_length=50, unique=True)
title = models.CharField(max_length=100, unique=False)
```
and the form:
```
class ArticleForm(ModelForm):
class Meta:
model = Article
```
The validation here fails w... | [
0.11838526278734207,
0.3024343252182007,
0.6776620149612427,
-0.16096310317516327,
0.07418134808540344,
0.024226123467087746,
0.08920180797576904,
-0.4880915582180023,
0.03988869860768318,
-0.5719885230064392,
0.21807122230529785,
0.6350278258323669,
-0.1841166764497757,
0.3769260942935943... | |
longer passes.
The "errors" property had nothing, but I dropped into the debugger and deep within the Django guts I saw this:
slug: "Article with this None already exists"
So it looks like is\_valid() fails on a unique value check, but all I want to do is **update** the row.
I can't just do:
```
form.save(force_u... | [
0.4343775510787964,
0.3817082345485687,
0.45613110065460205,
-0.360575407743454,
-0.1379462480545044,
-0.40311214327812195,
0.38128024339675903,
-0.2291961908340454,
0.01247215922921896,
-0.5137878060340881,
0.33316880464553833,
0.548186182975769,
-0.34232959151268005,
0.08772598206996918,... | |
more or less the same content, especially the slug, and thus you will get an error. It is a bit strange that you don't get better error reporting, but also I do not know what the rest of your view looks like.
What if you where to try something along these lines (I have included a bit more of a possible view function, ... | [
0.5861566662788391,
0.30604955554008484,
0.5148352384567261,
0.05295875295996666,
-0.02185233309864998,
-0.24046234786510468,
0.23183731734752655,
-0.04265967011451721,
-0.35998374223709106,
-0.5869535207748413,
-0.06119648367166519,
0.7675604820251465,
-0.21864189207553864,
0.069752357900... | |
pk=id)
if request.method == 'POST':
form = ArticleForm(request.POST, instance=article)
if form.is_valid():
form.save()
return HttpResponseRedirect(to-some-suitable-url)
else:
form = ArticleForm(instance=article)
return render_to_response('article_update.html', { 'form':... | [
-0.022223439067602158,
0.007933663204312325,
0.5369916558265686,
0.05972914770245552,
-0.003804979845881462,
-0.026653343811631203,
0.10503784567117691,
-0.4781891703605652,
0.030755113810300827,
-0.4843786060810089,
-0.2710939943790436,
0.4043808579444885,
-0.3035622239112854,
0.147397592... | |
I'm trying to write an application that responds whenever the Shift key is pressed, no matter what application currently has focus.
I tried this with `SetWindowsHookEx()` and with `GetKeyboardState()`, but both of these only work when the application's window has focus. I need it to work globally.
How do I do this?
N... | [
0.17394934594631195,
-0.1524200439453125,
0.429190456867218,
-0.27034932374954224,
0.11559455096721649,
0.04566168412566185,
0.28657862544059753,
0.023338226601481438,
-0.22194546461105347,
-0.8203102350234985,
-0.22372455894947052,
0.5135431885719299,
-0.4297833740711212,
0.02784923650324... | |
DLL. I used
`User32`, which is a DLL that is always loaded anyway and is used by all
processes with a GUI. I got this idea from [a CodeProject post about this](http://www.codeproject.com/KB/cs/CSLLKeyboardHook.aspx).
Thus, the code looks a bit like this:
```
instance = LoadLibrary("User32");
hhook = SetWindowsHookEx(... | [
-0.047235287725925446,
-0.20954415202140808,
0.5308525562286377,
-0.312526136636734,
-0.06705357879400253,
-0.1914496272802353,
-0.021199949085712433,
-0.17441082000732422,
-0.25782519578933716,
-0.6321921348571777,
-0.09307395666837692,
0.578717052936554,
-0.48827064037323,
0.151429995894... | |
I've got a client with an HTML page with a couple of scrolling divs with text content. She's using a heavily image-based design so the default scroll bars don't suit it at all. She'd like to use a different style but to my knowledge that isn't possible.
What do you think?
There's a jQuery answer to this -
[jScrollPa... | [
0.24757304787635803,
-0.35455891489982605,
0.5688709020614624,
0.04378234222531319,
-0.039738867431879044,
0.12037233263254166,
-0.3159819543361664,
-0.08679094165563583,
-0.3699789345264435,
-0.4143965244293213,
0.3791477382183075,
0.47224339842796326,
0.41771596670150757,
-0.031793542206... | |
How to get the time from a Chronometer? I tried getText, getFormat, getBase, etc, but none of them could work.
Example code snippet:
```
Chronometer t = (Chronometer)findViewById(R.id.toptime);
long time = SystemClock.elapsedRealtime()-t.getBase();
Log.d(null,"Was: "+time); //time is not the proper time for some reas... | [
0.46451592445373535,
-0.1526024490594864,
0.8708875775337219,
0.03244873881340027,
0.38584351539611816,
0.056098297238349915,
0.13254711031913757,
-0.42944762110710144,
-0.20057767629623413,
-0.3743903636932373,
0.05629930645227432,
0.44951626658439636,
-0.000029919438020442612,
0.26138868... | |
you have started your clock something like this:
```
chronometerInstance.setBase(SystemClock.elapsedRealtime());
chronometerInstance.start();
```
Here's a full example:
```
public class ChronoExample extends Activity {
Chronometer mChronometer;
@Override
protected void onCreate(Bundle savedInstanceState) {
sup... | [
0.5196139216423035,
-0.38992634415626526,
1.144393801689148,
-0.09555237740278244,
0.34144601225852966,
0.3295121490955353,
0.3651173412799835,
-0.5144465565681458,
-0.4917503595352173,
-0.4295235574245453,
-0.16708652675151825,
0.4279594123363495,
-0.2729704976081848,
0.3385676443576813,
... | |
resetButton.setOnClickListener(mResetListener);
layout.addView(resetButton);
setContentView(layout);
}
private void showElapsedTime() {
long elapsedMillis = SystemClock.elapsedRealtime() - mChronometer.getBase();
Toast.makeText(ChronoExample.this, "Elapsed milliseconds: " + elapsed... | [
-0.010687880218029022,
-0.14263662695884705,
1.047273874282837,
-0.3635413348674774,
0.05461692437529564,
0.269126832485199,
0.6364848017692566,
-0.5506017208099365,
-0.35406219959259033,
-0.444395512342453,
-0.37312597036361694,
0.4897100329399109,
-0.15017709136009216,
0.3371801674365997... | |
= new OnClickListener() {
public void onClick(View v) {
mChronometer.stop();
showElapsedTime();
}
};
View.OnClickListener mResetListener = new OnClickListener() {
public void onClick(View v) {
mChronometer.setBase(SystemClock.elapsedRealtime());
showElapsedTime();
}
};
}... | [
0.40598347783088684,
-0.11706329137086868,
1.096979022026062,
0.023110060021281242,
0.32339757680892944,
-0.056748077273368835,
0.07535944879055023,
-0.3210153877735138,
-0.45478224754333496,
-0.03406677767634392,
0.3007463812828064,
0.5676481127738953,
-0.3279683291912079,
0.4139848649501... | |
reset it, *no matter how many times and for how long you have stopped it in the meantime*. When it is stopped, it simply stops updating the display.
If you need something like a stopwatch you'll have to subclass Chronometer or maybe create your own version using the [source](http://www.google.com/codesearch/p?hl=en#uX... | [
0.45940303802490234,
-0.17543256282806396,
0.6357792019844055,
0.05991179123520851,
0.256433367729187,
0.2394622415304184,
0.3124900460243225,
-0.0037552393041551113,
-0.721630334854126,
-0.4496136009693146,
-0.1507369875907898,
0.3608495593070984,
-0.364057719707489,
-0.056226372718811035... | |
I have a website design that includes text input fields that look like this:
[Input Field http://img401.imageshack.us/img401/4453/picture1ts2.png](http://img401.imageshack.us/img401/4453/picture1ts2.png)
I'm wondering what the best solution for creating this input field is.
One idea I have is to always have a div ar... | [
0.649313747882843,
-0.13731896877288818,
0.5214474201202393,
-0.1635250300168991,
-0.09250569343566895,
-0.12372494488954544,
-0.016499748453497887,
0.02416439913213253,
-0.21892406046390533,
-0.9228800535202026,
0.15020138025283813,
0.6677272319793701,
-0.23756030201911926,
0.036554269492... | |
background-color: #fff;
background:url(/images/input-bkg-w173.gif) no-repeat;
width:173px;
height:28px;
padding:8px 5px 4px 5px;
border:none;
font-size:10px;
}
</style>
<input type="text" class="custom" size="12" />
```
but in IE (6 & 7) it does the following when you type more than the width:... | [
0.2047218680381775,
-0.17319142818450928,
0.6262271404266357,
-0.1793624609708786,
0.060283176600933075,
0.26211032271385193,
0.24290500581264496,
-0.23834960162639618,
-0.5587491393089294,
-0.5636700391769409,
-0.20763200521469116,
0.6913583874702454,
-0.1548333317041397,
-0.4314531087875... | |
everything fits correctly.
It is - in my eyes- definitely the best solution since in any other case you're working with a whole input field. And the whole input field is - by definition - a box where users can enter text.
If you can rely on JavaScript you could wrap such div-Elements around your input fields programa... | [
0.319446325302124,
-0.03560199961066246,
0.5467549562454224,
-0.0159829743206501,
0.08509170264005661,
0.11839617788791656,
0.3489365875720978,
-0.47588473558425903,
-0.28599363565444946,
-0.5816264152526855,
-0.25059378147125244,
0.5386514067649841,
-0.34360045194625854,
-0.28098651766777... | |
/>
``` | [
0.5794865489006042,
0.8074163198471069,
0.01491545606404543,
-0.029436662793159485,
-0.05705378204584122,
0.13981081545352936,
0.35237956047058105,
0.47313281893730164,
0.22152136266231537,
-0.6699236035346985,
-0.23965460062026978,
0.34233570098876953,
0.03839300945401192,
0.0272010546177... | |
I'm building an XML Deserializer for a project and I run across this type of code situation fairly often:
```
var myVariable = ParseNDecimal(xml.Element("myElement")) == null ?
0 : ParseNDecimal(xml.Element("myElement")).Value;
```
Is there a better way to write this statement?
EDIT : Perhaps I sh... | [
0.21958377957344055,
-0.07252690941095352,
0.2451898753643036,
-0.10803365707397461,
-0.09378506243228912,
-0.037187833338975906,
0.2525356709957123,
0.011135654523968697,
0.015412903390824795,
-0.38906413316726685,
-0.33607789874076843,
0.5290766954421997,
-0.35607701539993286,
0.12147791... | |
return (T)element.Value;
}
...
...
var myVariable = xml.Element("myElement").TryGetValue<decimal>();
```
**EDIT:**
The "universal" solution:
```
static class Program {
static void Main() {
var xmlDecimal = new XElement( "decimal" );
xmlDecimal.Value = ( 123.456m ).ToString();
decimal val... | [
-0.13206566870212555,
-0.027263717725872993,
0.6469177603721619,
-0.2550308406352997,
0.238397017121315,
0.13527126610279083,
0.17753157019615173,
-0.27147504687309265,
-0.08714312314987183,
-0.24669431149959564,
-0.6890100836753845,
0.5533221960067749,
-0.3095855712890625,
0.1216798424720... | |
decimal valueOfDecimal_2 = xmlBool.ValueAs<decimal>( decimal.TryParse );
bool valueOfBool_2 = xmlBool.ValueAs<bool>( bool.TryParse );
}
}
public static class StaticClass {
public delegate bool TryParseDelegate<T>( string text, out T value );
public static T ValueAs<T>( this XElement element, TryPar... | [
-0.29829272627830505,
0.07770518958568573,
0.31132394075393677,
0.0421496219933033,
0.010430271737277508,
0.22958357632160187,
0.11198072880506516,
-0.18015152215957642,
-0.16716429591178894,
0.0018761088140308857,
-0.5657361745834351,
0.34484487771987915,
-0.27531981468200684,
0.133012488... | |
== element ) { return defaultValue; }
T result;
bool ok = parseDelegate( element.Value, out result );
if ( ok ) { return result; }
return defaultValue;
}
}
``` | [
-0.44083020091056824,
-0.02155163325369358,
0.1628425270318985,
-0.3913315236568451,
0.08913347125053406,
-0.009512143209576607,
0.5919046401977539,
-0.4030071496963501,
-0.04034647345542908,
-0.2043432742357254,
-0.5545349717140198,
0.6954419612884521,
-0.40538784861564636,
0.164966478943... | |
This may sound like a newbie question - and it is. I'm relatively new to vs, we started using it a few months ago, and I still haven't "mentally" made the change from the command line. So, if you could help me with 2 things:
1. I create a new project (not a solution). He puts the files in some directory. After putting... | [
0.5715638995170593,
0.00928154680877924,
0.2141476273536682,
0.29100552201271057,
0.35087552666664124,
0.12140661478042603,
-0.06472963094711304,
-0.036514025181531906,
-0.32575738430023193,
-0.6226041316986084,
-0.18331460654735565,
0.08872547000646591,
-0.3834134340286255,
0.125835418701... | |
and I don't feel like getting the whole VS up just for that. How can I do that Debug thing from the command line, with the assumption I didn't change anything else.
2. Where do I tell him not to create a "Debug" subdirectory, not to create a HTML Build log, an object file ... and so on, generally, where can I find the ... | [
0.3840409815311432,
0.19928403198719025,
0.4276002049446106,
0.22088003158569336,
0.010270754806697369,
-0.25127553939819336,
0.4295769929885864,
-0.09906359016895294,
-0.24099883437156677,
-0.6092844009399414,
-0.1603456288576126,
0.5373038649559021,
-0.21494829654693604,
0.08040288090705... | |
getting the whole VS up just for that. How can I do that Debug thing from the command line, with the assumption I didn't change anything else.
I think what you want here is not debugging but a rebuild of your project.
> Where do I tell him not to create a "Debug" subdirectory, not to create a HTML Build log, an objec... | [
0.4343734085559845,
-0.018748121336102486,
0.3634052276611328,
0.30668896436691284,
-0.06332826614379883,
-0.19301339983940125,
0.23587919771671295,
-0.17268139123916626,
-0.3343532383441925,
-0.5163516998291016,
-0.0053735882975161076,
0.6756510138511658,
-0.3460516631603241,
0.1356311440... | |
to use the command line! You can make VS emit a make file from the loaded project. Use NMAKE to build this make file after you have made your desired modifications. The ".obj" files are created as an intermediate step between compilation and linking phase this is how the C++ [compilation model](http://www.cs.cf.ac.uk/D... | [
0.7608214020729065,
-0.03762606903910637,
0.29141756892204285,
-0.04662845656275749,
-0.11965517699718475,
-0.24345970153808594,
0.39283788204193115,
-0.2047499716281891,
-0.33639541268348694,
-0.5292550921440125,
-0.013473950326442719,
0.4208061099052429,
-0.2245953381061554,
-0.067316621... | |
Is there any reason not to set up the install so that major upgrade is always done and productcode changed?
I find that supporting different kinds of installs needs more code, and "repair" install seems to work easier with major upgrade. Also the application that needs to be installed is not very big, thus there is no... | [
0.48892858624458313,
0.19770768284797668,
0.2267681360244751,
0.012231196276843548,
0.25630396604537964,
-0.2076183408498764,
0.27768364548683167,
-0.22915349900722504,
-0.20195353031158447,
-0.6881204843521118,
-0.2370349019765854,
0.9364539980888367,
-0.18544459342956543,
-0.141245856881... | |
experience was unacceptable. | [
0.051445282995700836,
0.2873976528644562,
-0.31213313341140747,
0.10056425631046295,
-0.3097267150878906,
-0.11859561502933502,
0.4146614968776703,
-0.09980262070894241,
0.08885458111763,
-0.13447889685630798,
0.2520449459552765,
0.3268674612045288,
-0.05385880917310715,
0.1910407841205597... | |
I am developing a simple platform game in Java using BlueJ.
Over the next few weeks I will be posting a few questions asking for help with this project as am not very proficient at programming. So I hope I don't become annoying and I would be very grateful if you can kindly help me.
In my game I have a gameOver metho... | [
0.3812717795372009,
0.029204024001955986,
0.2874954640865326,
-0.06434112787246704,
-0.08501662313938141,
-0.1405458003282547,
0.06539418548345566,
0.23755642771720886,
-0.11994745582342148,
-0.733718991279602,
0.2502096891403198,
0.11946376413106918,
0.13028152287006378,
0.364787459373474... | |
bottom of the screen to represent some kind of hazard (like water) and when the player collides with it, it calls the gameOver method and the game ends. However, I would still prefer if the game ended if the player fell below a certain height of the screen.
This is my gameOver method (from the 'Game' class)-
```
/** ... | [
-0.17769363522529602,
0.12132595479488373,
0.7803253531455994,
0.06634392589330673,
0.14863671362400055,
0.16646970808506012,
0.2474358230829239,
-0.021151745691895485,
-0.2955525815486908,
-0.5633289217948914,
-0.16621807217597961,
0.3003813326358795,
0.01052471250295639,
0.45137065649032... | |
174, 140,
193, 140, 188, 134, 202, 118, 186,
118, 170, 102));
setColor(new Color(254, 167, 184));
```
This is the code (from the 'Enemy' class, similar code is used in a Hazard class also) that ends the game when player collides with an enemy-
```
if (e.contact.involves(player) && (player.getLives() < 1)) {... | [
-0.13485944271087646,
-0.0531240776181221,
0.7310965061187744,
0.1227499395608902,
0.09519653767347336,
0.09215172380208969,
0.27203837037086487,
-0.29759982228279114,
-0.5037654638290405,
-0.5284704566001892,
-0.5698288679122925,
0.2504291534423828,
-0.20151877403259277,
0.284983336925506... | |
kindly provide a sample/example code, with comments to help me understand it, in order to give an idea of what I should do to achieve this.
Thank you very much and I look forward to your answers.
To get you started:
1. Think about how you might get the player's current position.
2. Think about what makes the player f... | [
0.0625123679637909,
-0.12712441384792328,
0.2935541570186615,
0.3640705645084381,
0.09951423108577728,
-0.04163949936628342,
0.010458049364387989,
-0.17262254655361176,
-0.1285591721534729,
-0.6093696355819702,
0.24978387355804443,
0.17462371289730072,
0.1045469269156456,
-0.04911323264241... | |
height that the player has to keep above to stay alive. Remember this value.
2. If you get your player's vertical position and compare to this minimum height, you should get a boolean result (safe vs. dead).
3. Note that screen position starts at the top left and increases as you go right and down, so you're player pos... | [
-0.03890600427985191,
-0.09265759587287903,
0.6680921316146851,
-0.026523783802986145,
0.052351076155900955,
-0.004130272194743156,
0.26399776339530945,
-0.21434907615184784,
-0.2239379584789276,
-0.627165675163269,
0.09280713647603989,
0.3207465708255768,
0.21533916890621185,
-0.040829226... | |
about this a bit yourself. If you have no idea where to start, tell us that instead; we can try to steer you in the right direction.
Update: Sounds like you've done a bit of thinking already, which is great! Sorry if I was harsh to jump down your throat, but your original post suggested otherwise. Next time, though, d... | [
0.2824821174144745,
-0.1375107616186142,
0.042513493448495865,
0.38022488355636597,
-0.1683916449546814,
-0.17334476113319397,
0.4738149642944336,
0.40635213255882263,
0.05301883816719055,
-0.6218298673629761,
0.11816294491291046,
0.35975977778434753,
0.445896714925766,
-0.3550450503826141... | |
I am having a qt question. I want the QLineEdit widget to have the focus at application startup. Take the following code for example:
```
#include <QtGui/QApplication>
#include <QtGui/QHBoxLayout>
#include <QtGui/QPushButton>
#include <QtGui/QLineEdit>
#include <QtGui/QFont>
int main(int argc, char *argv[])
{
... | [
0.03284281864762306,
-0.16934162378311157,
0.7880594730377197,
-0.21116966009140015,
-0.21066665649414062,
0.23193219304084778,
0.23792722821235657,
-0.45238786935806274,
0.30115386843681335,
-0.6866152882575989,
-0.3449993133544922,
0.39402925968170166,
-0.302156001329422,
0.0520385056734... | |
hello->setText("Select all");
hello->resize(150, 25);
hello->setFont(QFont("Droid Sans Mono", 12, QFont::Normal));
// Add the widgets to the layout.
layout->addWidget(line);
layout->addWidget(hello);
line->setFocus();
QObject::connect(hello, SIGNAL(clicked()), line, SLOT(selectAll(... | [
-0.00962989591062069,
-0.09653680771589279,
1.1665581464767456,
-0.32226359844207764,
-0.08384064584970474,
0.37928012013435364,
0.011848065070807934,
-0.4015086889266968,
-0.016659440472722054,
-0.8332085013389587,
-0.6792371273040771,
0.526010274887085,
-0.6125783324241638,
-0.2713901400... | |
is related to widget [tab order](https://doc.qt.io/qt-5/qwidget.html#setTabOrder), and the default tab order *is based on the order in which widgets are constructed*. Therefore, creating more widgets changes the keyboard focus. That is why you must make the [`QWidget::setFocus`](https://doc.qt.io/qt-5/qwidget.html#setF... | [
0.32269641757011414,
-0.40685543417930603,
1.1423430442810059,
-0.061004698276519775,
-0.1848299503326416,
-0.050643615424633026,
0.03198469802737236,
-0.0236164852976799,
-0.020770272240042686,
-0.47420746088027954,
-0.34213632345199585,
0.617473840713501,
-0.426950067281723,
0.0589334815... | |
I'm trying to add custom fields to an InlineFormset using the following code, but the fields won't show up in the Django Admin. Is the InlineFormset too locked down to allow this? My print "ding" test fires as expected, I can print out the form.fields and see them all there, but the actual fields are never rendered in ... | [
0.18843521177768707,
0.26216447353363037,
0.5419970154762268,
-0.3056662082672119,
-0.0669470801949501,
0.23341433703899384,
0.19496174156665802,
-0.6357411742210388,
0.21195638179779053,
-0.6433576345443726,
0.062031153589487076,
0.5320667028427124,
-0.5093834400177002,
0.0151374218985438... | |
super(ProgressInlineFormset, self).add_fields(form, index)
for criterion in models.Criterion.objects.all():
form.fields[slugify(criterion.name)] = forms.IntegerField(label=criterion.name)
class ProgressInline(admin.TabularInline):
model = models.Progress
extra = 8
formset = ProgressInli... | [
-0.2565865218639374,
-0.40892356634140015,
1.0187984704971313,
0.06505204737186432,
-0.2085556834936142,
0.28501325845718384,
0.03889257833361626,
-0.5951351523399353,
-0.4931994378566742,
-0.6051322221755981,
-0.2443544566631317,
0.21308094263076782,
-0.367362380027771,
0.2751758098602295... | |
options:
* In the model definition, add those new additional fields (make them optional!)
* In the admin model (*admin.TabularInline*), add something something like:
fields = ('newfield1', 'newfield2', 'newfield3')
Take a look at [fields](http://docs.djangoproject.com/en/dev/ref/contrib/admin/#fields), [fieldsets](h... | [
0.00943488534539938,
-0.2189844697713852,
0.2360948771238327,
-0.10502686351537704,
0.26669031381607056,
0.09487459063529968,
-0.21301686763763428,
-0.20457646250724792,
-0.18254953622817993,
-0.38054078817367554,
-0.33988654613494873,
0.6305974125862122,
-0.2853878438472748,
-0.3217680454... | |
Here is the spec:
1. Multiple clients using a WPF winforms application on their local machines
2. Clients initiate requests to the server to execute a simulation. This initiation should probably be via a web service but other suggestions are welcome
3. Requests are queued on the server
4. Server sends out sequential r... | [
0.7125740647315979,
-0.17446985840797424,
0.5267758965492249,
0.1772015392780304,
-0.07434305548667908,
-0.4152334928512573,
0.10505563020706177,
-0.5864942073822021,
-0.24020810425281525,
-0.5523755550384521,
0.1403786987066269,
0.5330817103385925,
-0.07123243808746338,
-0.078232772648334... | |
a particular simulation run completed (or failed)
To begin with I thought I could do all of this with a single asmx web service, but now I think that might be unwieldy. WCF seems like another option, but I am not familiar with it and it seems far more complicated than the functionality I need.
Any ideas?
***Client:*... | [
0.5958392024040222,
-0.06698596477508545,
0.2525949776172638,
0.23689384758472443,
-0.015760604292154312,
-0.044960372149944305,
0.2970011830329895,
-0.11744384467601776,
-0.21075347065925598,
-0.760738730430603,
0.12453287094831467,
0.6396710276603699,
-0.12577120959758759,
-0.08184351027... | |
Services Asynchronously in .NET Design Patterns](http://www.codeproject.com/KB/cpp/wsasync.aspx)".
***Server:*** A vanilla .Net 2.0 asmx web service can queue the incoming calls for serial processing on the server. You can build a simple dispatcher using the BackgroundWorker class. The dispatcher takes each incoming r... | [
0.27233269810676575,
-0.25107476115226746,
0.21564148366451263,
0.0920129269361496,
-0.25212332606315613,
0.23647046089172363,
0.3768620193004608,
0.02925562858581543,
-0.5477882623672485,
-0.5304710865020752,
-0.11759336292743683,
0.23656035959720612,
-0.3238675892353058,
0.27935639023780... | |
dictionary. A CancelSimulation method on the web service accepts the id, looks up the BackgroundWorker ref in the dictionary and calls its CancelAsync method. Remove the dictionary entry when the task completes or is cancelled. The dictionary needs to be shared by all web service calls so it should be static/Shared. Fo... | [
-0.07895399630069733,
0.05689733475446701,
0.44490665197372437,
0.09855496138334274,
0.061741285026073456,
-0.27739351987838745,
0.3190724551677704,
0.20949935913085938,
-0.2085772156715393,
-0.3001028597354889,
-0.5454264879226685,
0.3828026354312897,
-0.47892633080482483,
0.3127032518386... | |
This is probably an easy question, but I want to understand better how Apache works with virtual hosts. I am setting up virtual hosts because I work on multiple websites at once and I don't want to use subdirectories. I was pretty much using the default Apache httpd.conf file with the DocumentRoot pointing to something... | [
0.07369685918092728,
0.23430754244327545,
0.590994119644165,
-0.02169647067785263,
-0.21096858382225037,
-0.3010271489620209,
0.4388118088245392,
-0.17703500390052795,
-0.17361235618591309,
-0.9125967621803284,
-0.10312215238809586,
0.39674845337867737,
-0.2884049713611603,
0.1601627469062... | |
for site1.
I'm sure there is a reason why this makes sense, but I don't quite understand it. I would've thought that only requests that were explicitly to <http://site1.test> would get routed through that directive and it wouldn't just become the default. Can someone explain why it becomes the default.
<http://httpd.a... | [
0.16002221405506134,
-0.19664187729358673,
0.5345515012741089,
-0.008955747820436954,
-0.049205195158720016,
-0.40735477209091187,
0.18895146250724792,
0.017305444926023483,
-0.2150222510099411,
-0.8072209358215332,
-0.3334563076496124,
0.47137877345085144,
-0.5846428871154785,
0.092359833... | |
matches the NameVirtualHost directive. If you would like to have a special configuration for requests that do not match any particular virtual host, simply put that configuration in a container and list it first in the configuration file." | [
0.19731760025024414,
-0.2775265574455261,
0.5993313193321228,
0.21220797300338745,
0.4921891391277313,
-0.5381680727005005,
0.06648804992437363,
0.12649233639240265,
-0.11200770735740662,
-0.5460529923439026,
-0.3423551023006439,
0.39463356137275696,
-0.2526198923587799,
0.0782356038689613... | |
I am fairly new at using the ASP.NET MVC framework and was hoping that I could find some help about best-practises when caching various parts of my MVC web application. I know that stack overflow uses MVC and some pretty freeking awesome caching techniques, and its MILES faster than my app, even when running locally.
... | [
0.3657485544681549,
0.4340251386165619,
0.332678884267807,
-0.1518300175666809,
-0.15591566264629364,
-0.11519613116979599,
0.08174175024032593,
-0.08220469206571579,
-0.14650829136371613,
-0.6947162747383118,
0.18656744062900543,
0.4645973742008209,
-0.2559325695037842,
-0.031633321195840... | |
worried about the timliness of page refreshes, in users not getting the most recent version of the data. Whats the best way to strike a balance between web application speed and displaying "up-to-date" data? What best practises have you guys found when having to deal with this issue?
3. How do I cache different parts (... | [
0.2489704042673111,
-0.014172659255564213,
0.5536957383155823,
0.43982717394828796,
0.0866360142827034,
-0.39706292748451233,
0.20240525901317596,
-0.29304540157318115,
-0.2706565856933594,
-0.7872036695480347,
0.2648015320301056,
0.5571131110191345,
0.17930810153484344,
-0.032953787595033... | |
practises of notes of things to be wary/careful of would be greatly appreciated.
You might want to take a look at [Phil Haack post](http://haacked.com/archive/2008/11/05/donut-caching-in-asp.net-mvc.aspx) for some donut caching. He's THE reference for ASP.NET MVC :) | [
0.5914068818092346,
0.2829621136188507,
0.24098338186740875,
-0.26451531052589417,
0.14292913675308228,
-0.08192133903503418,
0.041388314217329025,
0.12241605669260025,
-0.37848010659217834,
-0.4432787299156189,
-0.17357051372528076,
0.09786970913410187,
-0.1390935480594635,
-0.33438691496... | |
I am using TouchXml because of the given limitations of NSXML on the actual iPhone. Anyway, I'm just starting out with Objective-C, I come from a C# background, and felt like learning something new..anyhow.. here is my xml file...
```
<?xml version="1.0" encoding="utf-8"?>
<FundInfo xmlns:xsi="http://www.w3.org/2001/X... | [
-0.37025701999664307,
0.11075981706380844,
0.8051053285598755,
-0.12632837891578674,
0.03447450324892998,
0.15953491628170013,
0.1284732222557068,
0.05121343582868576,
-0.1894054412841797,
-0.6297937631607056,
0.21465882658958435,
0.6474964022636414,
0.025613021105527878,
-0.20267927646636... | |
[nodes objectAtIndex:1];
}
```
UPDATE 1: I have abandoned parsing using XPath, and have replaced it with NSURLRequest, so now I have the entire XML in a string, but my rude introduction to objective-C continues...I just realized how spoiled I have become to the .NET BCL where things like Regex are so easily available... | [
0.03607352450489998,
-0.05211460590362549,
0.4968181848526001,
-0.004087317734956741,
-0.15483710169792175,
-0.3262440860271454,
0.012955863028764725,
0.07548397034406662,
-0.08324848115444183,
-0.6087772846221924,
-0.04908604547381401,
0.7695698142051697,
-0.3683113157749176,
-0.145582064... | |
has a namespace, which means your XPath does not actually match. Unfortunately there is no default mapping, and XPath does not actually define a good way to handle this internally, so you can't fix it simply by changing the XPath. Instead you need to inform the interpreter how you want to map it in your XPath.
It look... | [
-0.17106859385967255,
-0.032337337732315063,
0.5711878538131714,
0.00038995768409222364,
-0.07087942957878113,
-0.08845033496618271,
0.36779239773750305,
0.09515120089054108,
-0.10808956623077393,
-0.977387547492981,
-0.05610832944512367,
0.5836809873580933,
-0.4565451145172119,
-0.1915330... | |
I am learning Ruby on Rails so I'm sure I'll find this out sooner or later.
Why would the scaffold method be deprecated in version 2 of Rails?
The scaffold method went against the spirit of scaffolding, which is meant to give you a starting point that you are supposed to build upon for your own needs. By generating th... | [
0.43991976976394653,
-0.20319709181785583,
-0.06765808165073395,
0.1641106903553009,
-0.2715703547000885,
-0.2901429533958435,
0.41283151507377625,
-0.035071369260549545,
-0.3010770380496979,
-0.38225245475769043,
0.26915138959884644,
0.38897112011909485,
-0.4451223909854889,
0.04939316958... | |
HI all.
I am working on some code to send/receive SMS messages through Zeep Mobile (<http://zeepmobile.com/developers/>).
I have looked at their google groups and even contacted their support but they've not been very good at communicating back and I am really flying blind now.
I have to get integrated with them (w... | [
0.562221348285675,
0.33241987228393555,
0.33605846762657166,
-0.1383897364139557,
-0.07165780663490295,
-0.04379069432616234,
0.7965438961982727,
0.18061301112174988,
-0.14471346139907837,
-0.38919901847839355,
0.0414913110435009,
0.35070645809173584,
0.16236554086208344,
-0.02270158939063... | |
Zeep or not. If you want me post my code, I can do that too. Let me know.
Thanks and I really appreciate the help.
\*\*
EDIT: I HAVE ADDED SOURCE CODE HERE IN CASE ANYONE CAN HELP WITH THIS!
----------------------------------------------------------------------
\*\*
Please forgive the sloppy code. Its just somethi... | [
0.10324142873287201,
-0.2996554672718048,
0.3077467083930969,
0.3063011169433594,
0.16996313631534576,
-0.3574680984020233,
0.4780278503894806,
-0.03642605245113373,
0.21203632652759552,
-0.7189244627952576,
-0.31048959493637085,
0.7937538623809814,
-0.1118086725473404,
-0.0469268970191478... | |
public static string API_KEY = "MY_API_KEY";
public static string SECRET_ACCESS_KEY = "MY_SECRET_KEY";
public static string PATTERN_RFC1123 = "ddd, dd MMM yyyy HH:mm:ss " + "GMT";
static void Main(string[] args)
{
// URL for sending message -
// send_messag... | [
0.09029407054185867,
-0.3057805895805359,
0.38613539934158325,
-0.1874961405992508,
0.023923277854919434,
0.07576686143875122,
0.45088738203048706,
0.173513263463974,
-0.4242592453956604,
-0.20296479761600494,
-0.5459397435188293,
0.4498957693576813,
-0.5295462608337402,
0.586941659450531,... | |
// blast_message = "https://api.zeepmobile.com/messaging/2008-07-14/blast_message";
string apiurl = "https://api.zeepmobile.com/messaging/2008-07-14/blast_message";
// FORMAT must be Sun, 06 Nov 1994 08:49:37 GMT
string http_date = DateTime.UtcNow.ToString("r");
// ... | [
0.02725854702293873,
0.12933975458145142,
0.45856013894081116,
-0.3459290564060211,
-0.5395845770835876,
0.014240830205380917,
0.3973047137260437,
-0.4689292013645172,
-0.23415842652320862,
-0.06990525126457214,
-0.3713699281215668,
0.22853516042232513,
-0.2207212746143341,
0.1033248826861... | |
// NOTE: Use 'user_id=22&body=' instead of just 'body=' when sending a message to a user.
// 22 is a user I have previously registered with ZEEP and is used for testing purposes.
string parameters = "body=" + body;
// String that will be converted into a signature. | [
0.6122047305107117,
-0.29788631200790405,
0.31023457646369934,
0.04239916428923607,
0.052804816514253616,
-0.11645949631929398,
0.4223577380180359,
-0.4262196123600006,
-0.203888401389122,
-0.39626267552375793,
0.05778759717941284,
0.00776625657454133,
0.005683501251041889,
0.0516405589878... | |
string canonicalString = API_KEY + http_date + parameters;
//------------START HASH COMPUTATION---------------------
// Compute the Base64 HMACSHA1 value
HMACSHA1 hmacsha1 = new HMACSHA1(SECRET_ACCESS_KEY.ToByteArray());
// Compute the hash of the input file.
... | [
-0.25201717019081116,
-0.07043632119894028,
0.6401969790458679,
-0.23078472912311554,
0.07177530974149704,
0.14506413042545319,
0.4734020233154297,
-0.23694835603237152,
-0.3127273619174957,
-0.22307975590229034,
-0.3437296450138092,
0.4319654107093811,
-0.49287864565849304,
0.409812688827... | |
String b64Mac = hashValue.ToBase64String();
String authentication = String.Format("Zeep {0}:{1}", API_KEY, b64Mac);
//-----------END HASH COMPUTATION------------------------
// We are using TCPClient instead of an HTTPWebRequest because we need to manually
// set the "He... | [
-0.14904794096946716,
-0.14356154203414917,
0.3720293939113617,
0.00907495804131031,
-0.03127307444810867,
-0.46169328689575195,
0.4259817600250244,
-0.25842607021331787,
-0.001430353382602334,
-0.09459199756383896,
0.018798483535647392,
0.643028736114502,
-0.2834598422050476,
0.3741913139... | |
Uri reqUrl = new Uri(apiurl);
TcpClient client = new TcpClient(reqUrl.Host, reqUrl.Port);
NetworkStream netStream = client.GetStream();
// SSLStream is used for secure communication. ZEEP requires the use of SSL to send and SMS.
System.Net.Security.SslStream sslStream = n... | [
-0.2388962060213089,
-0.2910988926887512,
1.0106850862503052,
0.007847209461033344,
0.007558766286820173,
-0.06149502471089363,
0.5479030013084412,
-0.21191494166851044,
-0.3516518175601959,
-0.6393519043922424,
-0.3685184717178345,
0.3206164538860321,
-0.5064618587493896,
0.42752844095230... | |
false,
new System.Net.Security.RemoteCertificateValidationCallback(ValidateServerCertificate));
sslStream.AuthenticateAsClient(reqUrl.Host);
// POST content we are going to transmit over the SSL channel.
// See. http://zeepmobile.com/developers/documentation/messag... | [
0.26262766122817993,
-0.10631746798753738,
0.6466653347015381,
-0.013712008483707905,
-0.02138342335820198,
-0.23222482204437256,
1.0800789594650269,
-0.29979878664016724,
-0.1440746933221817,
-0.4142286479473114,
-0.23717893660068512,
0.36176225543022156,
-0.33437496423721313,
0.460693567... | |
s.WriteLine(String.Format("POST {0} HTTP/1.1", "/api/blast"));
s.WriteLine(String.Format("Host: {0}", "api.zeepmobile.com"));
s.WriteLine(String.Format("Authorization: Zeep {0}:{1}", API_KEY, b64Mac));
s.WriteLine(String.Format("Date: {0}", http_date));
s.WriteLine(String... | [
0.09402694553136826,
-0.1597987413406372,
0.8759855628013611,
-0.154349222779274,
0.003655897220596671,
-0.006184832192957401,
0.4085013270378113,
-0.1677779108285904,
0.11357228457927704,
-0.46909424662590027,
-0.5962079167366028,
0.17482112348079681,
-0.2755089998245239,
0.43213745951652... | |
s.Flush();
System.IO.StreamReader r = new StreamReader(sslStream);
string resp = r.ReadToEnd();
Console.WriteLine(resp);
r.Close();
}
// The following method is invoked by the RemoteCertificateValidationDelegate.
// We want | [
-0.12140703946352005,
-0.47818347811698914,
0.7215189337730408,
-0.14573070406913757,
0.31912851333618164,
0.018095726147294044,
0.32372620701789856,
-0.2652710974216461,
-0.06944943219423294,
-0.6726239323616028,
-0.38720035552978516,
0.5497211217880249,
-0.17966718971729279,
0.3891792595... | |
to make sure the SSL has no Policy errors and is safe.
public static bool ValidateServerCertificate(
object sender,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors sslPolicyErrors)
{ | [
-0.12104456126689911,
-0.07828395813703537,
0.5248769521713257,
0.037260591983795166,
-0.2298266738653183,
-0.26254701614379883,
0.6391535401344299,
-0.08477037400007248,
-0.16474002599716187,
-0.3059542179107666,
-0.6800729632377625,
0.26316359639167786,
-0.40624839067459106,
0.3445083796... | |
if (sslPolicyErrors == SslPolicyErrors.None)
return true;
Console.WriteLine("Certificate error: {0}", sslPolicyErrors);
// Do not allow this client to communicate with unauthenticated servers.
return false;
}
}
public static class Extensions
{ | [
-0.08509494364261627,
-0.028401421383023262,
0.7818936705589294,
-0.23246368765830994,
0.27075284719467163,
0.08982835710048676,
0.5534681677818298,
-0.25533565878868103,
-0.15731890499591827,
-0.450234055519104,
-0.3988437354564667,
0.38440266251564026,
-0.3840177655220032,
0.376814395189... | |
public static byte[] ToByteArray(this string input)
{
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(input);
}
public static string ToBase64String(this byte[] input)
{
return Convert.ToBase64String(input);
}
}
}
```
... | [
-0.0025133341550827026,
-0.22924865782260895,
0.06598875671625137,
-0.2040976881980896,
0.19836300611495972,
0.11742554605007172,
0.46743831038475037,
0.07449416816234589,
-0.13965484499931335,
-0.45051634311676025,
-0.4609990417957306,
0.6741437315940857,
-0.6767171025276184,
0.2978829145... | |
is happening when I run this code is the error shown in the following image.

SOLUTION:
---------
OK. I worked on it all last night and I made some progress. I used Fiddler to construct the POST message to see any discrepancies between what I had a... | [
0.2707335352897644,
0.007453127298504114,
0.43297138810157776,
-0.07356082648038864,
-0.0135473208501935,
-0.24816226959228516,
1.0251877307891846,
0.15522116422653198,
-0.28914809226989746,
-0.4621683955192566,
0.16673122346401215,
0.6251251697540283,
0.09488499164581299,
0.13230693340301... | |
you.
---
```
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Net.Security;
using System.Web;
using System.Web.Handlers;
using System.IO;
using System.Security.Cryptography;
using System... | [
-0.08493205904960632,
-0.04518930986523628,
0.49262407422065735,
-0.015462726354598999,
0.2851881980895996,
0.07544901221990585,
0.28513193130493164,
-0.27132564783096313,
-0.03257331997156143,
-0.5906779170036316,
-0.5756067037582397,
0.7658519148826599,
-0.46280306577682495,
0.2651013135... | |
Console.WriteLine("SEND - \r\n\r\n");
SendTcpPost();
}
/// <summary>
/// Send a BLAST to all users in your ZEEP account.
/// </summary>
public static void BlastTcpPost()
{
SendSMS( | [
-0.30195319652557373,
-0.21861188113689423,
0.4893803000450134,
-0.11336235702037811,
-0.009547148831188679,
-0.23785081505775452,
0.39747485518455505,
-0.013939066790044308,
0.0009712632745504379,
-0.5852368474006653,
-0.42732715606689453,
0.31824299693107605,
-0.3712610602378845,
0.06196... | |
"https://api.zeepmobile.com/messaging/2008-07-14/blast_message", // URL for Send_Message
"You are on blast", // Message to send | [
0.0961046889424324,
-0.04040457308292389,
0.14011284708976746,
-0.08265931159257889,
-0.3474982678890228,
-0.29089370369911194,
0.20543234050273895,
-0.0777425765991211,
-0.2926067113876343,
-0.19565260410308838,
-0.37909984588623047,
0.1911681592464447,
-0.09009023010730743,
0.07137989997... | |
string.Empty // No UserId to send.
);
} | [
-0.49633896350860596,
-0.29322564601898193,
0.14062337577342987,
-0.4221445620059967,
0.14979486167430878,
-0.029670091345906258,
0.5478485822677612,
0.14357560873031616,
0.12306316196918488,
-0.36522167921066284,
-0.20407859981060028,
0.5008187294006348,
-0.5047339797019958,
0.36133441329... | |
/// <summary>
/// Send a single message to a user in your ZEEP account.
/// </summary>
public static void SendTcpPost()
{
// Note:- 22 I use for the UserId is just a user I have signed up. Yours may be different and you
// might want to pass that | [
0.396367609500885,
-0.5021486878395081,
0.23714448511600494,
-0.031135201454162598,
-0.06754021346569061,
-0.14629033207893372,
0.44735464453697205,
0.006085204891860485,
-0.13562798500061035,
-0.4680480659008026,
-0.039412084966897964,
0.21126583218574524,
-0.24781139194965363,
0.13138343... | |
in as a parameter.
SendSMS(
"https://api.zeepmobile.com/messaging/2008-07-14/send_message", // URL for Send_Message
"You are a user...good job!", // Message | [
0.07466057687997818,
-0.13596658408641815,
0.3582361042499542,
-0.31001439690589905,
0.062325309962034225,
-0.09869237244129181,
0.5224239826202393,
0.03379741311073303,
-0.2613956928253174,
-0.26815617084503174,
-0.01531322579830885,
0.2876916229724884,
0.12422692775726318,
0.144521072506... | |
to send
"22" // User Id in your system. | [
0.5797173976898193,
-0.017588041722774506,
0.18052621185779572,
0.3085080087184906,
-0.10703703761100769,
0.09880485385656357,
0.15886881947517395,
0.2686045467853546,
-0.3965757191181183,
-0.3652663230895996,
-0.09948372840881348,
0.04068945348262787,
-0.13168315589427948,
-0.039711434394... | |
);
}
/// <summary>
/// Uses a TCPClient and SSLStream to perform a POST.
/// </summary>
/// <param name="requestUrl">URL that the POST must be directed to.</param>
/// <param name="body">Message that is to be sent.</param>
/// <param name="user">UserId in your Z... | [
0.21256420016288757,
-0.27886295318603516,
0.6971682906150818,
0.08466369658708572,
-0.032208893448114395,
-0.037077467888593674,
0.48801010847091675,
-0.5943541526794434,
-0.3495786488056183,
-0.4039323031902313,
-0.41595497727394104,
0.1439574509859085,
-0.2804690897464752,
0.34119829535... | |
to a User.
/// Otherwise, just send a string.Empty.</param>
/// <returns>Response from the server. (although it will write the response to console)</returns>
public static string SendSMS(string requestUrl, string body, string user)
{
string parameters = "";
strin... | [
-0.25040364265441895,
-0.33041393756866455,
0.7227404117584229,
0.021409345790743828,
-0.2089022696018219,
0.30685827136039734,
0.21004843711853027,
-0.3982517421245575,
-0.06206703558564186,
-0.46323877573013306,
-0.4317653477191925,
0.3402145504951477,
-0.38058388233184814,
0.38816267251... | |
string responseData = "";
// FORMAT must be Sun, 06 Nov 1994 08:49:37 GMT
string http_date = DateTime.UtcNow.ToString("r");
// Clean the text to send
body = HttpUtility.UrlEncode(body, System.Text.Encoding.UTF8);
if (user.Length > 0) parameters += "user_id=... | [
-0.16719603538513184,
-0.28233927488327026,
0.9870206713676453,
-0.2922128736972809,
-0.4971145689487457,
0.393150269985199,
0.45613351464271545,
-0.5144462585449219,
-0.2217463105916977,
-0.33272692561149597,
-0.27483636140823364,
0.3477632999420166,
-0.1373615711927414,
0.219606444239616... | |
if (body.Length > 0) parameters += "body=" + body;
// String that will be converted into a signature.
string canonicalString = API_KEY + http_date + parameters;
//------------START HASH COMPUTATION---------------------
// Compute the Base64 HMACSHA1 value
HM... | [
-0.00429985485970974,
0.1164783388376236,
0.7359439730644226,
-0.30550768971443176,
0.23188692331314087,
-0.08487680554389954,
0.3506492078304291,
-0.5034840703010559,
-0.19596733152866364,
-0.3007931113243103,
-0.02610209584236145,
0.24103404581546783,
-0.1326369196176529,
0.0011918726377... | |
new HMACSHA1(SECRET_ACCESS_KEY.ToByteArray());
// Compute the hash of the input file.
byte[] hashValue = hmacsha1.ComputeHash(canonicalString.ToByteArray());
String b64Mac = hashValue.ToBase64String();
String authentication = String.Format("Zeep {0}:{1}", API_KEY, b64Ma... | [
-0.035085733979940414,
-0.03193748742341995,
0.7406743764877319,
-0.21284770965576172,
0.055384743958711624,
0.16093365848064423,
0.5806321501731873,
-0.5089312195777893,
-0.22216203808784485,
-0.5052316188812256,
-0.1119033470749855,
0.4859545826911926,
-0.388738751411438,
0.2680673003196... | |
b64Mac);
System.Uri uri = new Uri(requestUrl);
System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient(uri.Host, uri.Port);
string requestMethod = "POST " + uri.LocalPath + " HTTP/1.1\r\n";
// Set Headers for the POST message
requestHeaders +=... | [
-0.14124415814876556,
-0.2281561642885208,
0.5362679362297058,
-0.01581425964832306,
0.2025897204875946,
0.06257400661706924,
0.3336442708969116,
-0.1930420994758606,
-0.31018322706222534,
-0.5350518226623535,
-0.32519254088401794,
0.2903589606285095,
-0.3967664837837219,
0.599833607673645... | |
+= "Authorization: " + auth + "\r\n";
requestHeaders += "Date: " + DateTime.UtcNow.ToString("r") + "\r\n";
requestHeaders += "Content-Type: application/x-www-form-urlencoded\r\n";
requestHeaders += "Content-Length: " + parameters.ToByteArray().Length + "\r\n";
requestHead... | [
-0.0609915554523468,
-0.306967556476593,
0.46528160572052,
0.17309384047985077,
0.027706852182745934,
0.0916292741894722,
0.45921260118484497,
-0.1138593852519989,
-0.26731759309768677,
-0.48351091146469116,
-0.46463844180107117,
0.3040120601654053,
-0.25908705592155457,
0.4599397182464599... | |
Byte[] data = System.Text.Encoding.UTF8.GetBytes(requestMethod + requestHeaders + parameters + "\r\n");
// Send the message to the connected TcpServer.
NetworkStream stream = client.GetStream();
// SSL Authentication is used because the Server requires https.
System.Net.... | [
-0.19914348423480988,
-0.16273455321788788,
0.7117933034896851,
-0.05404619872570038,
0.0038989942986518145,
0.17002518475055695,
0.36766213178634644,
-0.2723498046398163,
-0.45560556650161743,
-0.4971070885658264,
-0.3754604458808899,
0.2532591223716736,
-0.2681305408477783,
0.23662038147... | |
stream,
false,
new System.Net.Security.RemoteCertificateValidationCallback(ValidateServerCertificate));
sslStream.AuthenticateAsClient(uri.Host);
// Send the data over the SSL stream.
sslStream.Write(data, 0, data.Length);
sslStream.Flush(... | [
0.07453043758869171,
-0.3058546185493469,
0.7031470537185669,
0.13026933372020721,
0.0107917170971632,
-0.10623777657747269,
0.6870375871658325,
-0.08564134687185287,
-0.06034277379512787,
-0.6642704606056213,
-0.4284079670906067,
0.2812556028366089,
-0.23624259233474731,
0.546276569366455... | |
// Receive the TcpServer.response.
for (int i = 0; i < 100; i++)
{
if (stream.DataAvailable)
{
break; | [
0.2185046225786209,
-0.47651374340057373,
0.6974174380302429,
-0.02048933133482933,
0.21996721625328064,
-0.06577219069004059,
0.5310404300689697,
-0.34292057156562805,
0.07693339139223099,
-0.2076042741537094,
-0.29110872745513916,
0.4370900094509125,
-0.33418235182762146,
0.2327972650527... | |
}
System.Threading.Thread.Sleep(100);
}
Byte[] bytes = new byte[1024];
System.Text.StringBuilder sb = new System.Text.StringBuilder();
while (stream.DataAvailable)
{ | [
-0.20548853278160095,
-0.22250483930110931,
0.3592677712440491,
-0.22310730814933777,
0.38164255023002625,
0.18909958004951477,
0.39400923252105713,
-0.23776328563690186,
-0.5216821432113647,
-0.701478123664856,
-0.2907273471355438,
0.21039164066314697,
-0.36016732454299927,
0.438930451869... | |
int count = sslStream.Read(bytes, 0, 1024);
if (count == 0)
{
break;
} | [
-0.03256666660308838,
-0.3873350918292999,
0.22227627038955688,
-0.25255146622657776,
0.11518679559230804,
-0.13072118163108826,
0.40830621123313904,
-0.16580140590667725,
-0.4973737597465515,
-0.2769657075405121,
-0.3016352951526642,
0.13383585214614868,
-0.33405888080596924,
0.0579913146... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.