text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
variations for other kinds of aggregation too.
```
public class Counter<T> : IEnumerable<T>
{
public int Count { get; private set; }
public Counter(IEnumerable<T> source)
{
mSource = source;
Count = 0;
}
public IEnumerator<T> GetEnumerator()
{
foreach (var T in mSource... | [
0.5310378074645996,
-0.46161365509033203,
0.43056392669677734,
-0.17084628343582153,
-0.17493049800395966,
0.1756962239742279,
0.27291011810302734,
-0.36566200852394104,
-0.2918531894683838,
-0.5232467651367188,
-0.27652639150619507,
0.42010557651519775,
-0.5102181434631348,
0.487112343311... | |
yield return T;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
foreach (var T in mSource)
{
Count++;
yield return T;
}
}
private IEnumerable<T> mSource;
}
```
You could create three | [
0.023409780114889145,
-0.31097346544265747,
0.2839341163635254,
-0.28556743264198303,
-0.04781656712293625,
0.12499146908521652,
0.2899269759654999,
-0.5368764400482178,
0.09116371721029282,
-0.672735333442688,
-0.2781694829463959,
0.734278678894043,
-0.5486404895782471,
-0.046761490404605... | |
instances of `Counter`:
1. One to wrap `GetAllFiles()` counting the total number of files;
2. One to wrap `GetMatches()` counting the number of matching files; and
3. One to wrap `GetMatchingLines()` counting the number of matching lines.
The key with this approach is that you're not layering multiple responsibilitie... | [
0.31907787919044495,
-0.4393402934074402,
0.49193552136421204,
0.028301136568188667,
-0.24842454493045807,
0.3167893886566162,
0.239766925573349,
-0.7275416254997253,
-0.24766524136066437,
-0.6794312000274658,
0.016345929354429245,
0.4344320595264435,
-0.44999998807907104,
-0.1103842258453... | |
Counter<string>(GetMatchingLines( contents ));
foreach( var lineText in linesFound )
Console.WriteLine( "Found: " + lineText );
string message
= String.Format(
"Found {0} matches in {1} matching files. Scanned {2} files",
linesFound.Count,
matchingFiles.Count,
files.Count);
C... | [
0.17769348621368408,
-0.2558460533618927,
0.5704243779182434,
-0.3590289056301117,
0.01400101836770773,
0.12882933020591736,
0.47515612840652466,
-0.7221922278404236,
-0.12751321494579315,
-0.5973713397979736,
-0.27594688534736633,
0.47193747758865356,
-0.35973501205444336,
0.3826633393764... | |
I find myself often needing to use Integer.TryParse to test if a value is an integer. However, when you use TryParse, you have to pass a reference variable to the function, so I find myself always needing to create a blank integer to pass in. Usually it looks something like:
```
Dim tempInt as Integer
If Integer.TryPa... | [
0.23504403233528137,
0.18424509465694427,
0.24451185762882233,
-0.0050055780448019505,
-0.34506553411483765,
0.11818312108516693,
0.3491060435771942,
-0.24773606657981873,
-0.14624924957752228,
-0.36246782541275024,
0.020114561542868614,
0.475406289100647,
-0.3517886698246002,
0.1941382437... | |
get a true / false response?
No need to declare the integer.
```
If Integer.TryParse(intToCheck, 0) Then
```
or
```
If Integer.TryParse(intToCheck, Nothing) Then
```
---
If you have .Net 3.5 ability you can create an extension method for strings.
```
Public Module MyExtensions
<System.Runtime.CompilerServi... | [
0.016899939626455307,
-0.1190415471792221,
0.4632042348384857,
-0.005793779157102108,
0.18302680552005768,
0.26513564586639404,
0.530709981918335,
-0.3376024067401886,
-0.14986804127693176,
-0.39520904421806335,
-0.20272551476955414,
0.7170776724815369,
-0.305388867855072,
0.26721823215484... | |
End If
End Function
End Module
```
And then call like:
```
If value.IsInteger() Then
```
---
Sorry, getting carried away I know, but also you can add this to the MyExtensions class above in .Net 3.5 and not worry unless you need validations.
```
<System.Runtime.CompilerServices.Extension()> _
Public Functio... | [
-0.21204078197479248,
-0.03528479114174843,
0.5503726005554199,
-0.2433851957321167,
-0.07483270764350891,
-0.2486754059791565,
0.3025933504104614,
-0.2735241949558258,
-0.03072177805006504,
-0.28476688265800476,
-0.20382238924503326,
0.5139829516410828,
-0.25181013345718384,
0.53494119644... | |
Refer to this post compile a Xcode project in command line
[Building Qt Xcode Projects From the Command Line](https://stackoverflow.com/questions/377992/building-xcode-projects-from-the-command-line)
the QMAKESPEC variable was unable to set to macx-g++.
I was doing like this in terminal `QMAKESPEC=macx-g++` but this ... | [
0.24665583670139313,
0.2776477038860321,
0.20021258294582367,
-0.17674905061721802,
-0.1018056869506836,
-0.20875881612300873,
0.375011146068573,
-0.22311867773532867,
-0.0481497161090374,
-0.6193622946739197,
-0.006710045039653778,
0.602674663066864,
-0.46116912364959717,
0.23723584413528... | |
I am the lead developer on a commercial Windows app (c#). A new requirement is to track customers who abuse the license.
For example: Let's say a customer purchases a 10 user license agreement, i.e. 10 simultaneous users at any given time.
I need to be able to report, looking back at history, all the times that custo... | [
0.5726510286331177,
0.11777257174253464,
0.33020490407943726,
-0.04129011556506157,
0.15909144282341003,
-0.19760040938854218,
-0.07232210040092468,
-0.12442684918642044,
-0.11081280559301376,
-0.4102891981601715,
-0.14425791800022125,
0.4473901689052582,
0.013763167895376682,
0.1720002591... | |
user logs out...columns might include:
LogId, UserId, LoginDateTime, LogoutDateTime
...and then I would have a history of every time a user logs in/out of the app...
but I'm not sure if this table design will lend to efficient calculations for reporting...whether I use SQL or c# to perform the calculations does not ... | [
0.11277320235967636,
0.13818852603435516,
0.6382918357849121,
0.016708897426724434,
0.14540788531303406,
0.019926773384213448,
0.17998413741588593,
-0.005041635595262051,
-0.44575726985931396,
-0.7765854001045227,
0.15373922884464264,
0.44538891315460205,
-0.11732100695371628,
0.1347239911... | |
from using the app...the requirement is to display a warning message to the user but to allow him to continue working...
Think about starting and ending sessions as events that need to be recorded. You create a single table to record these events.
So, a session that starts and ends will have two entries in the table -... | [
0.5645188689231873,
0.2461317479610443,
0.3471345007419586,
0.21382008492946625,
0.24450118839740753,
-0.18401342630386353,
0.22054293751716614,
-0.2212100774049759,
-0.5324966907501221,
-0.43155238032341003,
-0.25901034474372864,
0.5351676344871521,
-0.35371628403663635,
-0.04137213528156... | |
the record that is incremented from the previous record's session count value when a session start event occurs and decremented when a session end event occurs.
The "session count" column now gives us a piece-wise continuous function over time of the number of concurrent sessions.
Example data:
```
SessionId Ev... | [
0.008689962327480316,
0.09379790723323822,
0.22989381849765778,
-0.07609931379556656,
0.13708531856536865,
-0.21152044832706451,
0.2884159982204437,
-0.07844599336385727,
-0.43623146414756775,
-0.7023833990097046,
-0.02840733714401722,
0.5709002614021301,
-0.18832702934741974,
0.3650546967... | |
1
2. 2 Login ................ 2
3. 3 Login ................ 3
4. 1 Logout | [
-0.03625082969665527,
0.3305903375148773,
0.5699661374092102,
-0.005525912623852491,
-0.07539334893226624,
0.2573959529399872,
0.21062089502811432,
-0.27595189213752747,
-0.30141159892082214,
-0.765565037727356,
-0.31554120779037476,
0.3388859033584595,
-0.3450976014137268,
-0.023851405829... | |
................ 2
5. 4 Login ................ 3
6. 4 Logout ................ 2
7. | [
-0.11623572558164597,
0.41370904445648193,
0.5730007886886597,
0.22245201468467712,
0.09994710236787796,
0.5180928707122803,
0.20034269988536835,
-0.22639049589633942,
-0.28812944889068604,
-0.7937870621681213,
-0.5787704586982727,
0.15364472568035126,
-0.3702661395072937,
0.08551794290542... | |
2 Logout ................ 1
8. 3 Logout ................ 0
9. 5 Login | [
-0.190498948097229,
0.3452361524105072,
0.49946433305740356,
0.11159486323595047,
0.20349229872226715,
0.2999466061592102,
0.1997516006231308,
-0.049737755209207535,
-0.4116269648075104,
-0.7028616070747375,
-0.23100697994232178,
0.18318843841552734,
-0.32313746213912964,
-0.13020014762878... | |
................ 1
10. 6 Login ................ 2
```
Things to worry about:
1. You must make sure you pair begin/end events, so in the event of any failure, session end events must still be generated.
2. Do you need the table to be tamper proof? If so, I have a tec... | [
0.3174572288990021,
0.21873648464679718,
0.2647407650947571,
0.10318034887313843,
0.33062613010406494,
-0.4373810589313507,
0.566262423992157,
-0.3502771854400635,
-0.46334555745124817,
-0.45884227752685547,
-0.25496524572372437,
0.7677300572395325,
-0.5820889472961426,
-0.0606246031820774... | |
please note that where I put "your session data here", I really meant "your session event data here". Information such as a time stamp would go in here. Another table should be used to track session information common to both events, such as the identity of the user that owns the session (use the same SessionId key for... | [
0.24137505888938904,
-0.014344141818583012,
0.20548073947429657,
0.25116413831710815,
0.27026280760765076,
-0.3909560441970825,
0.3040917217731476,
0.042199745774269104,
-0.446805864572525,
-0.5258999466896057,
-0.04201387241482735,
0.6632313132286072,
0.020925354212522507,
0.1394107490777... | |
What is the "critical section" of a thread (in Python)?
> A thread enters the critical section
> by calling the acquire() method, which
> can either be blocking or
> non-blocking. A thread exits the
> critical section, by calling the
> release() method.
- [Understanding Threading in Python, Linux Gazette](http:/... | [
0.15626099705696106,
-0.17647594213485718,
0.4368644058704376,
0.15585623681545258,
0.13932013511657715,
-0.14442123472690582,
0.034568820148706436,
0.0022460727486759424,
-0.21386446058750153,
-0.34773823618888855,
-0.4438343048095703,
0.04036160558462143,
-0.6423524618148804,
0.463159859... | |
an incoming message to all the clients). If more than one thread tries to spool a message at once, you'll get BfrIToS mANtwD PIoEmesCEsaSges intertwined, which is obviously no good at all.
A lock is something that can be used to synchronize access to a critical section (or resources in general). In our chat server exa... | [
0.0994350016117096,
-0.22374379634857178,
0.47989708185195923,
0.38741976022720337,
0.24945898354053497,
-0.061283212155103683,
0.22144797444343567,
0.044196516275405884,
-0.33556410670280457,
-0.5157170295715332,
-0.17053645849227905,
0.06511647999286652,
-0.44960811734199524,
0.420398443... | |
thread can go in the room (locking it). "Aquiring" the lock just means "I get the room." | [
0.31895187497138977,
-0.3207513391971588,
0.5470036268234253,
0.028165282681584358,
0.16940520703792572,
-0.0040665846318006516,
0.27667561173439026,
0.059212826192379,
-0.5106658339500427,
0.09026992321014404,
-0.11343910545110703,
-0.040164023637771606,
-0.017687620595097542,
0.140135481... | |
What does this do, and why should one include the `if` statement?
```py
if __name__ == "__main__":
print("Hello, World!")
```
---
If you are trying to close a question where someone should be using this idiom and isn't, consider closing as a duplicate of [Why is Python running my module when I import it, and ho... | [
-0.12401129305362701,
0.1617724448442459,
0.3111986219882965,
-0.07895585149526596,
0.17181429266929626,
-0.17222031950950623,
0.21110086143016815,
0.08592495322227478,
-0.4044056832790375,
-0.1236644759774208,
-0.2659344971179962,
0.3909934461116791,
-0.4054420292377472,
0.274356633424758... | |
start running?](https://stackoverflow.com/questions/17257631).
Short Answer
============
It's boilerplate code that protects users from accidentally invoking the script when they didn't intend to. Here are some common problems when the guard is omitted from a script:
* If you import the guardless script in another sc... | [
0.3315478265285492,
-0.17060227692127228,
0.12878166139125824,
-0.1876085102558136,
0.0673164576292038,
-0.2921465337276459,
0.5925427079200745,
-0.13465046882629395,
-0.2327914535999298,
-0.5576081275939941,
-0.18006764352321625,
0.6983519792556763,
-0.3859749436378479,
0.1633759140968322... | |
script, with the same problems outlined in the previous bullet.
Long Answer
===========
To better understand why and how this matters, we need to take a step back to understand how Python initializes scripts and how this interacts with its module import mechanism.
Whenever the Python interpreter reads a source file,... | [
0.2681973874568939,
-0.04651714861392975,
-0.1557478904724121,
-0.004770782310515642,
-0.16007457673549652,
-0.19716876745224,
0.14397159218788147,
-0.15277434885501862,
0.07265657186508179,
-0.6046443581581116,
0.19059987366199493,
0.6376040577888489,
-0.2754955589771271,
-0.1927146464586... | |
explore how imports and scripts work. Suppose the following is in a file called `foo.py`.
```
# Suppose this is foo.py.
print("before import")
import math
print("before function_a")
def function_a():
print("Function A")
print("before function_b")
def function_b():
print("Function B {}".format(math.sqrt(100)... | [
0.251358300447464,
0.05252453684806824,
0.11917179822921753,
-0.28094470500946045,
0.0038387218955904245,
-0.1088322177529335,
0.08436363190412521,
-0.35765716433525085,
-0.06503190100193024,
-0.5453066229820251,
-0.4266712963581085,
0.8583618998527527,
-0.46515244245529175,
-0.24452018737... | |
string `"__main__"` to the `__name__` variable, i.e.
```
# It's as if the interpreter inserts this at the top
# of your module when run as the main program.
__name__ = "__main__"
```
**When Your Module Is Imported By Another**
On the other hand, suppose some other module is the main program and it imports your mod... | [
0.029993543401360512,
0.3002295196056366,
0.23402468860149384,
-0.32598677277565,
0.0033714694436639547,
-0.19374074041843414,
0.27854645252227783,
0.02532828412950039,
-0.15897133946418762,
0.053028278052806854,
-0.46084141731262207,
0.5647664666175842,
-0.6497414708137512,
-0.12519192695... | |
module, it will assign the name `"foo"` from the import statement to the `__name__` variable, i.e.
```
# It's as if the interpreter inserts this at the top
# of your module when it's imported from another module.
__name__ = "foo"
```
Executing the Module's Code
---------------------------
After the special variable... | [
0.14208506047725677,
0.17065420746803284,
0.4671180844306946,
-0.3359057903289795,
0.05866536870598793,
-0.18805138766765594,
0.0882210060954094,
-0.44655144214630127,
-0.2539654076099396,
-0.2260088175535202,
-0.27531588077545166,
0.8108749389648438,
-0.5570846199989319,
-0.2980937063694,... | |
variable called `math`. This is equivalent to replacing `import math` with the following (note that `__import__` is a low-level function in Python that takes a string and triggers the actual import):
```
# Find and load a module given its string name, "math",
# then assign it to a local variable called math.
math = __... | [
-0.03372230380773544,
-0.21697628498077393,
0.261082261800766,
-0.2635934352874756,
-0.27011892199516296,
0.036980241537094116,
0.06146232411265373,
-0.23123270273208618,
-0.09697135537862778,
-0.05519890785217285,
-0.39449355006217957,
0.7513353824615479,
-0.5497403144836426,
-0.088670462... | |
`function_b`.
7. It prints the string `"before __name__ guard"`.
**Only When Your Module Is the Main Program**
8. If your module is the main program, then it will see that `__name__` was indeed set to `"__main__"` and it calls the two functions, printing the strings `"Function A"` and `"Function B 10.0"`.
**Only Whe... | [
-0.059437017887830734,
-0.027665341272950172,
0.5891120433807373,
-0.4853884279727936,
-0.023651987314224243,
-0.04190370440483093,
0.12015781551599503,
-0.21710892021656036,
-0.41811054944992065,
-0.3646370470523834,
-0.41354766488075256,
0.7740432620048523,
-0.5641613006591797,
-0.025427... | |
be printed in the two cases:
```none
# What gets printed if foo is the main program
before import
before function_a
before function_b
before __name__ guard
Function A
Function B 10.0
after __name__ guard
```
```none
# What gets printed if foo is imported as a regular module
before import
before function_a
before fun... | [
0.32095107436180115,
0.3294624090194702,
0.34054771065711975,
-0.21131999790668488,
-0.13639657199382782,
-0.23313109576702118,
-0.12260228395462036,
-0.2300158441066742,
-0.48616063594818115,
-0.40313056111335754,
-0.32648250460624695,
0.5120054483413696,
-0.575141966342926,
-0.2958121895... | |
script mode where it runs some unit tests or a demo.
* Your module is only used as a main program, but it has some unit tests, and the testing framework works by importing `.py` files like your script and running special test functions. You don't want it to try running the script just because it's importing the module.... | [
0.36415350437164307,
-0.3591004014015198,
-0.02572435699403286,
0.177073135972023,
-0.16881299018859863,
-0.5241989493370056,
0.3903168737888336,
-0.08660436421632767,
-0.051342085003852844,
-0.41356223821640015,
-0.13978001475334167,
0.7960918545722961,
-0.1434529721736908,
-0.44848999381... | |
the script is a side effect of importing the script's module.
Food for Thought
----------------
* Question: Can I have multiple `__name__` checking blocks? Answer: it's strange to do so, but the language won't stop you.
* Suppose the following is in `foo2.py`. What happens if you say `python foo2.py` on the command-l... | [
-0.10646399855613708,
0.1250346302986145,
0.07670503109693527,
-0.3293828070163727,
-0.000571830605622381,
0.06693901866674423,
0.5356825590133667,
-0.09900017827749252,
-0.1315930336713791,
-0.3924007713794708,
-0.20796175301074982,
0.5669180154800415,
-0.44199153780937195,
-0.25766330957... | |
function_a()
print("m2")
print("t2")
```
* Now, figure out what will happen if you remove the `__name__` check in `foo3.py`:
```py
# Suppose this is foo3.py.
import os, sys; sys.path.insert(0, os.path.dirname(__file__)) # needed for some interpreters
def function_a():
print("a1")
from foo3 import functi... | [
-0.36349108815193176,
-0.02031688578426838,
0.35911333560943604,
-0.6066141724586487,
0.1833379566669464,
0.007523017935454845,
0.478076308965683,
-0.4525128901004791,
-0.10888354480266571,
-0.39265763759613037,
-0.5004976987838745,
0.8097195029258728,
-0.5463833808898926,
-0.2622317373752... | |
I would like to write a program that will find bus stop times and update my personal webpage accordingly.
If I were to do this manually I would
1. Visit www.calgarytransit.com
2. Enter a stop number. ie) 9510
3. Click the button "next bus"
The results may look like the following:
> 10:16p Route 154
>
> 10:46p ... | [
0.43800708651542664,
0.38407814502716064,
0.3876524269580841,
-0.1088838130235672,
-0.12084373086690903,
0.10311761498451233,
0.7315046787261963,
0.11025381088256836,
0.10804061591625214,
-0.8373672962188721,
0.387208491563797,
0.2512784004211426,
0.12754221260547638,
-0.1998128741979599,
... | |
some topics/libraries I could look into?
[Beautiful Soup](http://www.crummy.com/software/BeautifulSoup/documentation.html#Quick%20Start) is a Python library designed for parsing web pages. Between it and [urllib2](http://docs.python.org/library/urllib2.html) ([urllib.request](http://docs.python.org/py3k/library/urllib.... | [
0.35657358169555664,
-0.16527554392814636,
0.2721986174583435,
0.1549699902534485,
-0.14869938790798187,
0.0074380128644406796,
-0.04308387637138367,
0.26368919014930725,
-0.4431982934474945,
-0.5309925079345703,
-0.02713099680840969,
-0.03349722549319267,
-0.2130230814218521,
-0.180774167... | |
Having setup C++ app originally using MS specific keyboard journaling hook (WH\_JOURNALRECORD) we find that it does not work on Vista unless run as administrator with uiAccess enabled. [MSDN Question - Journaling hooks on Vista?](http://social.msdn.microsoft.com/forums/en-US/windowssecurity/thread/3dc0a67e-c2f0-4e70-89... | [
0.2541576325893402,
0.016888804733753204,
0.3929843604564667,
0.0737188309431076,
-0.009655797854065895,
-0.3721645176410675,
0.20130543410778046,
-0.15710438787937164,
-0.13883598148822784,
-0.2790219485759735,
-0.05834013596177101,
0.6813052296638489,
-0.3102833926677704,
-0.292388886213... | |
usage when you hit a letter.
Another advantage was that you could set the focus to an area outside of the application, say another applications window, and record the action as the user interacted.
Asides from making the keyboard capture part of the existing app a separate executable which runs as administrator with u... | [
0.18426965177059174,
-0.26783686876296997,
0.37761572003364563,
0.10476703196763992,
-0.11817485094070435,
0.003849972505122423,
0.31963464617729187,
-0.11167933791875839,
-0.6291419267654419,
-0.591081440448761,
0.09403162449598312,
0.3887590169906616,
-0.15018875896930695,
-0.21409943699... | |
for hacking purposes. Soooooo.....
Is there a way to make journaling work, for this user, and their apps, running at the same level (or lower) and capture keystrokes? having it popup the vista security are you sure dialog would be allright, but the process cannot be marked with uiAccess (otherwise it won't interact pr... | [
0.07825756072998047,
0.16794295608997345,
0.7165310382843018,
0.23449023067951202,
0.25908374786376953,
-0.5774261951446533,
0.34557992219924927,
-0.15985579788684845,
-0.23464658856391907,
-0.6624138951301575,
-0.2691791355609894,
0.7588116526603699,
-0.3770713806152344,
0.132902503013610... | |
information and translating it into usable sequences - ie don't record multiple ctrl presses when heeld down to press ctrl+key. | [
0.06794477999210358,
-0.14073732495307922,
0.521438717842102,
0.25622478127479553,
0.34377604722976685,
-0.23430967330932617,
0.26404574513435364,
-0.18382249772548676,
0.055813636630773544,
-0.7088157534599304,
-0.0984644964337349,
0.5832965970039368,
-0.06855723261833191,
-0.288682490587... | |
Windows has the "system tray" that houses the clock and alway-running services like MSN, Steam, etc.
I'd like to develop a wxPython tray application but I'm wondering how well this will port to other platforms. What is the tray equivalent on each platform, and how much manual work would be required to support Windows,... | [
0.2662951946258545,
0.09477104991674423,
0.4061110317707062,
0.16107319295406342,
-0.22784391045570374,
-0.058729615062475204,
-0.08079851418733597,
0.24938254058361053,
-0.2788160443305969,
-0.8349399566650391,
-0.09759000688791275,
0.40289899706840515,
-0.08653305470943451,
0.31799745559... | |
at wxTaskBarIcon (<http://docs.wxwidgets.org/stable/wx_wxtaskbaricon.html#wxtaskbaricon>). | [
0.18289682269096375,
-0.1476466953754425,
0.07448964565992355,
-0.00810898095369339,
0.3726293444633484,
-0.20587852597236633,
0.14605309069156647,
0.1744890958070755,
-0.24653862416744232,
-0.33564308285713196,
-0.7086740136146545,
0.3110519051551819,
-0.17894956469535828,
0.3916707038879... | |
I need help in designing my PHP classes where I need to extend from multiple classes.
I have a general class, Pagination.php that does all sort of pagination and sorting. All other classes will use this for pagination.
To make my life easier, I made a class generator that generates a class from MySQL table. All the p... | [
0.2290249466896057,
0.2440817505121231,
0.18345218896865845,
0.2095460742712021,
-0.31705179810523987,
0.10364187508821487,
0.056290533393621445,
-0.19080030918121338,
-0.05025486648082733,
-0.67731112241745,
0.2960887849330902,
0.1816835254430771,
-0.12760645151138306,
0.2654646039009094,... | |
another class that extends Staff\_Base.php. (So that whenever a new field is added, I can simply regenerate Staff\_Base class and overwrite in Staff\_Base.php).
So I have class Staff.php that extends Staff\_Base.php.
The problem is, Staff.php also needs to extend another class, Pagination.php.
(The current workaroun... | [
0.03738892823457718,
-0.07764104753732681,
0.31557023525238037,
0.267779141664505,
-0.17686201632022858,
-0.04291173815727234,
0.1392204612493515,
-0.0705549567937851,
-0.13348868489265442,
-0.7447916865348816,
0.2778327167034149,
0.4581029415130615,
-0.19818812608718872,
0.151773303747177... | |
classes than Pagination.php.
Thanks!
I would recommend changing your `Staff_Base.php` generator to make that class extend Pagination by default. That way `Staff` extends `Staff_Base`, and `Staff_Base` extends `Pagination`. I think that's probably the cleanest (and most object-oriented) way of getting the results you w... | [
0.2655193507671356,
-0.31072336435317993,
-0.12095417082309723,
0.3513847887516022,
-0.2030925452709198,
-0.25637632608413696,
0.06348534673452377,
0.10608243197202682,
-0.11850777268409729,
-0.5888824462890625,
0.06969727575778961,
0.3537715971469879,
-0.05422167852520943,
0.0483011752367... | |
I believe i can learn thing or two if i can see the implementation files (.m files). Is there any way the i can view NSString.m or NSNumber.m files? and others? If i try to find these files using spotlight, i get nothing.
No, most (all?) of the Cocoa library implementations are only distributed in a compiled binary for... | [
0.5080891251564026,
0.26361900568008423,
-0.10123664140701294,
0.12387020140886307,
-0.07411389797925949,
-0.27972888946533203,
0.3106159567832947,
0.2510921359062195,
-0.34703710675239563,
-0.7176709771156311,
-0.12188708037137985,
0.6274636387825012,
-0.2070147544145584,
0.15647181868553... | |
but at least for the core classes, it will be virtually identical. | [
0.44504836201667786,
0.011391322128474712,
0.052131831645965576,
0.16067716479301453,
0.018367275595664978,
-0.021529223769903183,
0.10696181654930115,
0.39524734020233154,
-0.12299133837223053,
-0.7435343861579895,
0.080891452729702,
0.1871616393327713,
0.3358302414417267,
0.1314592063426... | |
I trying to build and compile my `xcodeproj` in command line and it is working now.
So it is also possible to launch the `xcodeproject` from terminal instead from the Xcode?
If you want to run an app from the command line, use
```
open /path/to/appname.app
```
"Build and Go" is really just equivalent to
```
xco... | [
0.40641963481903076,
0.36682257056236267,
0.45924416184425354,
-0.09094809740781784,
0.09120871871709824,
0.16440929472446442,
0.2200089693069458,
0.05472993850708008,
0.020674951374530792,
-0.7749077081680298,
-0.1555735170841217,
0.6357625126838684,
-0.5461284518241882,
-0.04522333666682... | |
I get the following error:
```
Unhandled Exception: System.IO.IOException: The parameter is incorrect.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.__Error.WinIOError()
at System.Console.set_OutputEncoding(Encoding value)
at (my program)
```
when I run the following line of... | [
-0.19789113104343414,
0.38044703006744385,
0.2963261902332306,
-0.1211424171924591,
0.06604825705289841,
0.13118158280849457,
0.4945659637451172,
0.06293633580207825,
-0.019535159692168236,
-0.7714149951934814,
-0.2654666006565094,
0.5051462650299072,
-0.17701007425785065,
0.11285301297903... | |
UTF-16 (as far as I know), but the program throws the same exception there.
The following code works which shows that the Console object can have its output redirected and support Encoding.Unicode:
```
FileStream testStream = File.Create("test.txt");
TextWriter writer = new StreamWriter(testStream, Encoding.Unicode)... | [
-0.005744199268519878,
0.11310701817274094,
0.5996866822242737,
-0.3965923488140106,
0.01785716786980629,
0.09063520282506943,
0.40364986658096313,
-0.17606735229492188,
0.15687869489192963,
-0.8529319763183594,
-0.17758873105049133,
0.45328158140182495,
-0.46342265605926514,
0.11022695899... | |
When importing numbers from a csv file, I need to convert them to floats with unit.
Currently I do this with an inline function:
```
data |> List.map float |> List.map (fun n -> n * 1.0<m>)
```
But I'm wondering if there is a more elegant way to do this - or do I have to create my own 'units' module with conversion... | [
0.29427915811538696,
0.11399547010660172,
0.2797868847846985,
0.005842083599418402,
-0.2803077697753906,
0.21442851424217224,
0.0419769361615181,
-0.5692921280860901,
-0.35633769631385803,
-0.6131460666656494,
-0.046601250767707825,
0.24368280172348022,
-0.009780433028936386,
0.12060918658... | |
this, which works ok:
```
[<Measure>]
type km =
static member lift (v:float) = v * 1.0<km>
data |> List.map float |> List.map km.lift
```
or, following the question in [this answer](https://stackoverflow.com/questions/419521/f-units-of-measure-lifting-values-to-floatsomething#424111)
```
data |> List.map (flo... | [
-0.17363904416561127,
0.023610776290297508,
0.8095730543136597,
0.03585666045546532,
-0.24326856434345245,
-0.011889839544892311,
-0.018090659752488136,
-0.8671069741249084,
-0.5276902914047241,
-0.3769204914569855,
-0.0057500209659338,
0.289437472820282,
0.13587616384029388,
0.00519380904... | |
The last I used was [weka](http://www.cs.waikato.ac.nz/ml/weka/)
. The last I heard java was coming up with an API (JDM) for it. Can anyone share their experiences with the tools. I am mostly interested in using the tools for classification/clustering (weka does a decent job here) and the tool should have good API supp... | [
0.20319914817810059,
0.10129915922880173,
-0.16617311537265778,
-0.20523172616958618,
-0.41732949018478394,
-0.1767188310623169,
0.11963953077793121,
0.02446768805384636,
-0.43094128370285034,
-0.5099918842315674,
0.27067485451698303,
0.13573716580867767,
-0.12048124521970749,
-0.153174772... | |
Does anyone know of a Reporting Engine for WPF? Most of the ones I could find are still for WinForms.
I'm happy enough using a WinForms one in WPF with a WinForms host so long as the tool has a UserControl that can be embedded in a window.
Also, I'm not using a database and all my data is in XML so the Reporting Engi... | [
0.5015116333961487,
0.06655511260032654,
0.4223979413509369,
0.16139554977416992,
-0.48402291536331177,
-0.40197324752807617,
0.08769594132900238,
-0.06468664854764938,
-0.21157637238502502,
-0.5585142970085144,
0.3017396926879883,
0.435346394777298,
-0.058622896671295166,
0.10586818307638... | |
seems to be a hole in the marketplace. | [
0.4174090027809143,
0.35133853554725647,
0.02248055674135685,
-0.2291218638420105,
0.23938311636447906,
-0.06542155891656876,
0.24534180760383606,
0.4697851538658142,
-0.26973438262939453,
-0.707955539226532,
-0.06174816936254501,
-0.10922255367040634,
0.07578952610492706,
0.13185836374759... | |
The basic idea behind a Cancel button is to enable closing your window with an Escape Keypress.
> You can set the IsCancel property on
> the Cancel button to true, causing the
> Cancel button to automatically close
> the dialog without handling the Click
> event.
Source: Programming WPF (Griffith, Sells)
So this... | [
0.16845294833183289,
-0.02273307926952839,
0.5248557925224304,
-0.2499188482761383,
0.19781151413917542,
-0.005006368272006512,
0.18111975491046906,
-0.36605122685432434,
0.08656217902898788,
-0.48583802580833435,
-0.2956187129020691,
0.7141063809394836,
-0.5913195013999939,
0.082972094416... | |
on whether the Window is a normal window or a Dialog? Does IsCancel work as advertised only if ShowDialog has been called?
* Is an explicit Click handler required for the button (with IsCancel set to true) to close a window on an Escape press?
Yes, it only works on dialogs as a normal window has no concept of "cancelli... | [
0.06984905153512955,
-0.2703605890274048,
0.49638673663139343,
-0.09975922107696533,
0.07710457593202591,
-0.08404770493507385,
0.18162167072296143,
-0.04404689371585846,
0.04673418402671814,
-0.2996404767036438,
-0.17291463911533356,
0.7328340411186218,
-0.5629603266716003,
0.076479278504... | |
InitializeComponent();
this.PreviewKeyDown += new KeyEventHandler(CloseOnEscape);
}
private void CloseOnEscape(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
Close();
}
``` | [
-0.24860624969005585,
-0.2393883615732193,
0.38218408823013306,
-0.38473495841026306,
0.42377379536628723,
-0.02571440115571022,
0.5405769944190979,
-0.296146422624588,
0.10776335000991821,
-0.6416513323783875,
-0.5563057661056519,
0.43767252564430237,
-0.35185250639915466,
0.3260326981544... | |
Do you consider this a code smell?
```
foreach((array)$foo as $bar)
{
$bar->doStuff();
}
```
Should i use that instead?
```
if (isset($foo) && is_array($foo))
{
foreach($foo as $bar)
{
$bar->doStuff();
}
}
```
Any other good practices to cover not set variables and assert an array?
They're... | [
0.7565034627914429,
0.5002609491348267,
-0.031308550387620926,
-0.5724340081214905,
-0.052658941596746445,
-0.352644145488739,
0.4106452465057373,
-0.3636608421802521,
0.19605425000190735,
-0.4035990238189697,
0.006812494248151779,
0.57317715883255,
-0.6215171813964844,
0.2923678457736969,... | |
even been defined in the code above. You need to go back up through the code and find out exactly what's going on with `$foo`.
If it was my code, $foo would probably be always defined either as an array, or else false to indicate the array isn't needed:
```
if(do_we_need_an_array())
$foo = function_returning_an_arr... | [
0.31864693760871887,
0.1967860758304596,
0.49836602807044983,
-0.43466058373451233,
0.13542293012142181,
-0.05514684319496155,
0.30155202746391296,
-0.23815315961837769,
-0.27900242805480957,
-0.18443801999092102,
-0.06652526557445526,
0.752909779548645,
-0.41228440403938293,
0.07756619155... | |
* Do you use source code analyzers? If so, which ones and for which language development?
* Do you find them helpful in solving potential bugs in your code? Or are most of their warnings trivial?
* After prolonged use, do you find your code quality to be higher than before?
I use a few static analysis tools in Java. [F... | [
0.16403236985206604,
0.1607082188129425,
0.04712377116084099,
0.031228933483362198,
-0.07820168882608414,
-0.28027987480163574,
0.5067595839500427,
0.1376771330833435,
-0.3484010696411133,
-0.5981670022010803,
-0.18424542248249054,
0.6752581596374512,
-0.06886114925146103,
-0.4455090165138... | |
more niggly bugs, but requires a lot more configuration. You'll find that PMDs defaults are often over the top. There are too many rules that are probably beneficial on a tiny scale but ultimately don't help other programmers maintain your code. Some of the PMD rules often smack of premature optimisation.
Probably mor... | [
0.4725864827632904,
-0.005399422720074654,
0.271518737077713,
0.3406340181827545,
0.11584831029176712,
-0.43279093503952026,
0.13547074794769287,
0.0716518834233284,
-0.4788660407066345,
-0.516336977481842,
-0.20765113830566406,
0.4883159101009369,
-0.2216368168592453,
0.12659968435764313,... | |
also handy, making sure your coders conform to some coding style standard. it has a bit of overlap with PMD but is generally much more usable.
Finally, [Cobertura](http://cobertura.sourceforge.net/) is a great test coverage suite. Very handy for finding out where the unit tests are lacking, and where you should be pri... | [
0.4279806613922119,
0.1967042237520218,
-0.23099569976329803,
0.21761730313301086,
0.14371968805789948,
-0.3857695758342743,
0.008252274245023727,
-0.07068166881799698,
-0.33964934945106506,
-0.39676764607429504,
0.12620384991168976,
0.6558369994163513,
0.11892049759626389,
-0.151452288031... | |
within Eclipse and as part of an automated build suite. | [
0.413540244102478,
0.057438164949417114,
-0.03704877570271492,
-0.10196249932050705,
-0.09431161731481552,
-0.0703185573220253,
-0.1369912028312683,
-0.12267947942018509,
0.14175087213516235,
-0.557371973991394,
-0.11834260076284409,
0.2596205472946167,
-0.12954159080982208,
-0.23258298635... | |
I set up a website and I created a folder names (docs) in the website as Virtual Directory with some documents.
Therefore the URL is xxxxxxyyyyzzzz.com/docs
The problem is that when i try to access xxxxxxyyyyzzzz.com/docs/1.doc, Authentication is required. Can you tell me how to remove this and leave any user access... | [
0.3024374842643738,
0.31973108649253845,
0.23863428831100464,
0.16635273396968842,
-0.05596139281988144,
-0.5244101285934448,
0.24669630825519562,
0.10650382936000824,
-0.42379820346832275,
-0.603009819984436,
-0.14306771755218506,
0.3919021785259247,
-0.1879950612783432,
0.270600795745849... | |
I'm new to TDD and xUnit so I want to test my method that looks something like:
```
List<T> DeleteElements<T>(this List<T> a, List<T> b);
```
Is there any Assert method that I can use ? I think something like this would be nice
```
List<int> values = new List<int>() { 1, 2, 3 };
List<int> expected = new List<int>(... | [
0.2895220220088959,
0.07023599743843079,
0.6571027636528015,
-0.018859628587961197,
-0.22523696720600128,
-0.1028233990073204,
0.28230467438697815,
-0.3313005268573761,
0.243119478225708,
-0.6374221444129944,
0.10916254669427872,
0.6800882816314697,
0.22083646059036255,
0.23532778024673462... | |
collections so you just need to do
```
Assert.Equal(expected, actual); // Order is important
```
You can see other available collection assertions in [CollectionAsserts.cs](https://github.com/xunit/assert.xunit/blob/master/CollectionAsserts.cs)
For **NUnit** library collection comparison methods are
```
Collection... | [
0.25706279277801514,
-0.021872268989682198,
0.3272036015987396,
0.36366748809814453,
-0.17180687189102173,
0.1564692109823227,
-0.04068531468510628,
-0.4633294343948364,
-0.4859687387943268,
-0.45156997442245483,
-0.38964155316352844,
0.28696146607398987,
0.005260452628135681,
0.1042708531... | |
Can anyone find a constant in the .NET framework that defines the number of days in a week (7)?
```
DateTime.DaysInAWeek // Something like this???
```
Of course I can define my own, but I'd rather not if it's somewhere in there already.
Update:
-------
I am looking for this because I need to allow the user to sele... | [
0.457109659910202,
-0.1931571513414383,
0.5677897930145264,
0.06013473868370056,
0.057751111686229706,
0.01803477853536606,
0.08841300010681152,
0.3088138997554779,
-0.6108632683753967,
-0.4798312485218048,
-0.1123383492231369,
0.29474472999572754,
-0.26906177401542664,
0.43520793318748474... | |
Seemingly simple, but I cannot find anything relevant on the web.
What is the correct HTML code for an apostrophe? Is it `’`?
If you are looking for straight apostrophe `'` (U+00027), it is
`'` or `'` (latest is HTLM 5 only)
If you are looking for the curly apostrophe `’` (U+02019), then yes, it is
`... | [
0.10056725889444351,
0.37634599208831787,
0.5317015647888184,
0.27681124210357666,
-0.4203502833843231,
0.5086702704429626,
0.27522557973861694,
0.007737297099083662,
-0.36595821380615234,
-0.4986322224140167,
-0.26662659645080566,
0.13943660259246826,
-0.4534114897251129,
-0.5373269319534... | |
My boss announced yesterday a new commit policies for checkins into the repository. This policies are valid for commits into head/trunk and branches.
A commit message must have the following items:
* Reason (Bug ID,Project ID, or non functional change)
* Name of the reviewer
After the commit we also have to create... | [
0.5005159974098206,
0.16176261007785797,
0.017766451463103294,
0.28670230507850647,
0.07350719720125198,
-0.1575772613286972,
0.3017865717411041,
0.3113980293273926,
-0.5621981024742126,
-0.4758565425872803,
0.16541941463947296,
0.15056388080120087,
0.009021461009979248,
0.2423593252897262... | |
idea to change the productive-branch only due to a Bug Report, but commits into the development branches should be less restrictive.
**Commit early and commit often.**
We actually use /trunk as development and tags to branch different releases. Only structural intrusive changes go in /branches.
We actively use tags f... | [
0.6160212159156799,
-0.28591248393058777,
0.07144440710544586,
0.21406392753124237,
0.21447190642356873,
-0.19186556339263916,
0.10449010133743286,
0.009396573528647423,
-0.43975961208343506,
-0.4518931806087494,
0.08274811506271362,
0.382411390542984,
-0.0974259227514267,
-0.0527018122375... | |
which case you could also look it up in the bug tracking software and close it there, which to me is about the same effort.
Not to say i dont like any svn integration:
- We use more goodness of automated nant scripts to make releases which branches them in /tags
- svn props actually store our version numbers :p.
- hoo... | [
0.41803455352783203,
0.010311149060726166,
0.20343126356601715,
0.13451215624809265,
-0.09400815516710281,
-0.18860380351543427,
0.11104685813188553,
0.06327006965875626,
-0.17849823832511902,
-0.2997688055038452,
-0.006840412970632315,
0.5503222942352295,
0.08088365942239761,
-0.197904467... | |
The Yahoo Javascript library (YUI), JQuery and less so Google maps all allow you to reference their files using the following format:
```
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
```
This does a request for the script from their servers, w... | [
0.5045396089553833,
0.19186288118362427,
0.22715438902378082,
-0.023848138749599457,
-0.32367268204689026,
-0.3544575870037079,
0.02642371691763401,
0.1313665807247162,
-0.13969890773296356,
-0.5423684120178223,
-0.07430964708328247,
0.240287646651268,
0.07624568045139313,
-0.2567873895168... | |
host only YUI on yui.yahooapis.com; Google hosts YUI and many other libraries on its CDN. I can tell you from the Yahoo side that we don't monitor site usage of YUI from our CDN. We do track general growth of yui.yahooapis.com usage, but we don't track which sites are generating traffic. You're right to suggest that we... | [
0.5170096755027771,
-0.020225727930665016,
0.3667964041233063,
0.478910356760025,
-0.5742653608322144,
-0.31602907180786133,
-0.055261410772800446,
0.5646216869354248,
-0.2704736888408661,
-0.4753161668777466,
-0.19258999824523926,
0.5119271874427795,
-0.11689702421426773,
0.13181023299694... | |
don't regard CDN traffic for library usage to be a reliable measurement of anything. Most YUI usage, even at Yahoo, doesn't use yui.yahooapis.com or Google's equivalent, and I'm sure the same is true for other libraries. And even when a site is using YUI from our servers, we wouldn't have comprehensive traffic data of ... | [
0.49701249599456787,
-0.07936950027942657,
0.1816965639591217,
0.3856726884841919,
-0.6279394626617432,
-0.4703001081943512,
0.04720226675271988,
0.35447603464126587,
-0.20381373167037964,
-0.4618915915489197,
-0.1972409039735794,
0.3968941867351532,
-0.09785370528697968,
0.032664686441421... | |
big win for most implementers, with little downside.
-Eric | [
0.3273436725139618,
0.013979656621813774,
-0.021133696660399437,
0.3671267032623291,
-0.3630942106246948,
0.024467183277010918,
0.3457389771938324,
-0.2711392939090729,
-0.2130027711391449,
-0.28614503145217896,
0.2381131500005722,
0.23423027992248535,
0.2652774453163147,
-0.38096761703491... | |
In a lot of my PHP projects, I end up with classes that have non-public functions that I don't intend to extend.
Is it best to declare these as protected, or private?
I can see arguments both ways - making them private is a far more conservative approach, but it can be argued that they could be made protected later i... | [
0.313873827457428,
0.18449127674102783,
-0.1848962903022766,
0.15205886960029602,
-0.13639502227306366,
-0.2430085390806198,
0.4676838219165802,
0.10912645608186722,
-0.24873456358909607,
-0.12778782844543457,
0.17462438344955444,
0.46368810534477234,
-0.2668085992336273,
-0.04270526766777... | |
instinct is to keep them private, until you need them to be otherwise.
It has been argued (sadly I've misplaced the link) that making methods private is antisocial, in much the same way as making them 'final', in that it's fairly dictatorial about how people may use your code.
I'm not convinced, however, and agree th... | [
0.6156119704246521,
0.08003919571638107,
-0.22348570823669434,
0.24198080599308014,
-0.016039393842220306,
-0.5977470874786377,
0.49647149443626404,
0.0882391408085823,
-0.10094773024320602,
-0.2203477919101715,
-0.2525009512901306,
0.7185457348823547,
-0.15855959057807922,
0.1210485994815... | |
be seen as providing flex-points. | [
0.3015921413898468,
-0.27504003047943115,
0.03553006425499916,
-0.17434075474739075,
-0.1777639240026474,
0.2266152799129486,
0.022508755326271057,
-0.12239327281713486,
-0.5323187112808228,
-0.39374396204948425,
-0.11439887434244156,
0.09975871443748474,
0.2143930047750473,
-0.28224849700... | |
How to get the text of selected item from a drop down box element in html forms? (using python)
How can I store the value to a variable, when I select one item from the drop down box using mouse? (ie. without using a submit button)
This is for a application which I am doing in app engine which only supports Python.
Yo... | [
0.30287209153175354,
-0.1003674566745758,
0.4690716862678528,
0.13179674744606018,
-0.12193933874368668,
0.04701390862464905,
0.1537207067012787,
-0.3846178352832794,
-0.11376434564590454,
-0.6777681112289429,
-0.30014175176620483,
0.45085716247558594,
-0.2394525408744812,
-0.1730370670557... | |
has the opportunity to send an answer. The answer is a document usually written in [HTML](http://www.w3.org/html/). Some parts of this document can be dynamic, i.e. generated by the python code. Other parts of the document can be static. The browser then renders the document on the user window.
After that, the only s... | [
0.2070033997297287,
-0.26027828454971313,
0.4362190067768097,
0.3966693580150604,
-0.05102715641260147,
-0.029513442888855934,
0.14636610448360443,
0.12706175446510315,
-0.1798725426197052,
-0.5610311627388,
-0.5776557326316833,
0.21233873069286346,
-0.11235962808132172,
-0.045088998973369... | |
making browser send another
request to this new url.
* User clicks on `submit` button, making
browser submit the form as a request
to the address configured in the
form's `action` attribute.
* Some code in the actual page, usually written in [ECMAscript](http://www.ecmascript.org/) (also known as *javascript*), makes a... | [
0.35668352246284485,
-0.1900326907634735,
0.6695501208305359,
0.14479893445968628,
-0.30601468682289124,
-0.2858563959598541,
0.2343699187040329,
-0.24603687226772308,
-0.21119438111782074,
-0.6867921352386475,
-0.2724013030529022,
0.32284724712371826,
-0.1479829102754593,
-0.2540220916271... | |
drop down do a submit:
```
<select name='myfield' onchange='this.form.submit()'>
<option .... >
...
</select>
</form>
```
That way, when the user changes the value on the dropdown, the form will be submited as if the user clicked on submit. Python code on the server will run. The browser will load the answer.
Anoth... | [
0.3582548499107361,
-0.12222427129745483,
0.503570020198822,
0.07188235223293304,
-0.2319444864988327,
-0.10646283626556396,
-0.032667431980371475,
-0.30745992064476013,
-0.11611329764127731,
-0.33809641003608704,
-0.27187031507492065,
0.26904213428497314,
-0.3212352693080902,
-0.036254290... | |
page. This technique is called [AJAX](http://en.wikipedia.org/wiki/Ajax_(programming)).
If you plan to write lots of javascript code, I strongly suggest using a javascript library at least to ease the pain of dealing with many browser versions. [jQuery](http://jquery.com/ "The Write Less, Do More, Javascript Library")... | [
0.4592609405517578,
0.0897509902715683,
0.20809072256088257,
0.12052081525325775,
-0.4543621242046356,
-0.42180323600769043,
0.1976930946111679,
0.3283555805683136,
-0.34494104981422424,
-1.0058344602584839,
-0.1350017786026001,
0.5571398138999939,
-0.022006917744874954,
-0.117844499647617... | |
For example, here on stack overflow the URL <https://stackoverflow.com/questions/tagged/javascript+php> will give you all questions tagged with javascript and php.
The system I have allows tags with spaces in them, so the approach used here would not be a good fit for me.
What character would you use to separate the ... | [
0.20468464493751526,
-0.12290946394205093,
0.3584408462047577,
0.3060981333255768,
-0.23603206872940063,
-0.020137393847107887,
-0.07467499375343323,
-0.2530719041824341,
-0.3392355442047119,
-0.5051277279853821,
0.058975547552108765,
0.2805803418159485,
-0.08203169703483582,
-0.1534412652... | |
Aparently, encoding japanese emails is somewhat challenging, which I am slowly discovering myself. In case there are any experts (even those with limited experience will do), can I please have some guidelines as to how to do it, how to test it and how to verify it?
Bear in mind that I've never set foot anywhere near J... | [
0.3253295421600342,
0.3605937957763672,
0.09461262822151184,
0.16787175834178925,
0.034853581339120865,
-0.02971036545932293,
0.17907749116420746,
0.19035282731056213,
-0.12820813059806824,
-0.41525498032569885,
-0.31558653712272644,
0.03752777352929115,
-0.3568969964981079,
-0.23323179781... | |
transfer encoding should be set to Base64 for plain text and 7Bit for Html
- Email subject should be encoded separately to start with "=?ISO-2022-JP?B?" (don't know what this is supposed to mean). I've tried encoding the subject with
```
"=?ISO-2022-JP?B?" + Convert.ToBase64String(Encoding.Unicode.GetBytes(subject... | [
-0.06974109262228012,
-0.096840038895607,
0.6759151220321655,
0.1997297704219818,
-0.20541594922542572,
0.10442349314689636,
-0.03287509083747864,
-0.26020580530166626,
0.010861234739422798,
-0.8417847156524658,
-0.09331191331148148,
0.4361532926559448,
-0.22400502860546112,
-0.14774484932... | |
encoding. Now, Outlook gives something that resembles the correct subject:
`=?iso-2022-jp?B?6 Japanese test に各々の視点で語ってもらった。 6相当の防水?=`
However, the exact same email in Outlook Express gives subject like this:
`=?iso-2022-jp?B?6 Japanese test 縺ォ蜷・・・隕也せ縺ァ隱槭▲縺ヲ繧ゅi縺」縺溘・ 6逶ク蠖薙・髦イ豌エ?=`
Furthermore, when viewed in the ... | [
0.14150722324848175,
0.1650305986404419,
0.296669602394104,
0.167384535074234,
-0.26715177297592163,
0.24957677721977234,
0.3021366596221924,
0.08300624042749405,
0.02077845297753811,
-0.9025358557701111,
0.017175132408738136,
0.35545793175697327,
-0.2900465726852417,
0.1294243335723877,
... | |
send hundreds of emails daily to Japanese customers so I can share with you what's worked for us.
* First of all, do not use Shift-JIS. I personally receive tons of Japanese emails and almost never are they encoded using Shift-JIS. I think an old (circa Win 98?) version of Outlook Express encoded outgoing mail using S... | [
0.5968117713928223,
-0.03451499342918396,
0.25659888982772827,
0.3305525779724121,
-0.4285605549812317,
-0.041188403964042664,
0.14922407269477844,
0.2627653479576111,
-0.22768092155456543,
-0.5872729420661926,
-0.08201617002487183,
0.3742907643318176,
-0.1521504819393158,
-0.0893157348036... | |
cases, *but* it will not work on Yahoo Japan mail, and as you can imagine, many Japanese users use Yahoo Japan mail.
* You can use UTF-8 in the body of the email, but it is recommended that you base64 encode the UTF-8 encoded Japanese text and put that in the body instead of raw UTF-8 text. However, in practice, I beli... | [
0.29116296768188477,
0.0646887719631195,
0.027589814737439156,
0.227354496717453,
-0.2875958979129791,
-0.0712938979268074,
0.2895089089870453,
0.08979149162769318,
0.06947344541549683,
-0.6781951785087585,
-0.1645282357931137,
0.40599095821380615,
-0.13670562207698822,
-0.0654521957039833... | |
is the trickiest because I believe they use EUC for the encoding of their web pages, and so you need to follow the correct standards for your emails or they won't work (ISO-2022-JP is the standard for sending Japanese emails).
* Also, your subject line should not exceed 75 characters per line. That is, 75 characters *a... | [
0.20834140479564667,
-0.0033137439750134945,
0.40187084674835205,
0.1357274204492569,
0.08484021574258804,
0.209669291973114,
0.6086902022361755,
-0.2936813235282898,
-0.18740583956241608,
-0.5871829986572266,
-0.4782801568508148,
0.2580472528934479,
-0.15397493541240692,
-0.20030587911605... | |
get truncated (depending on the email reader, and also the content of your subject text). According to RFC 2047:
"An 'encoded-word' may not be more than 75 characters long, including 'charset', 'encoding', 'encoded-text', and delimiters. If it is desirable to encode more text than will fit in an 'encoded-word' of 75 c... | [
-0.04518939182162285,
0.002356793964281678,
0.48894375562667847,
0.1000094786286354,
-0.17629380524158478,
0.12849140167236328,
0.2795574367046356,
-0.24661913514137268,
-0.2334470897912979,
-0.5503901243209839,
-0.4128529131412506,
0.13677100837230682,
-0.10446714609861374,
0.058224357664... | |
to the subject
$subject = "=?iso-2022-jp?B?" . $subject . "?=";
// Now, $subject can be placed as-is into the raw mail header.
```
* See RFC 2047 for a complete description of how to encode your email header. | [
0.5877595543861389,
0.030481692403554916,
0.430465966463089,
0.11613648384809494,
-0.12437570095062256,
-0.3415534198284149,
0.11303476244211197,
0.011370830237865448,
-0.3228171765804291,
-0.6862853765487671,
-0.45968306064605713,
0.1842382699251175,
-0.2566356658935547,
0.200537726283073... | |
My application heavily uses the UIImage object to change images on a single UIImageView based on user input and the previous image which was set. I use [UIImage imageNamed:] to create my UIImage objects.
I guess this is not the best way to use UIImage coz my memory usage keeps increasing with time and never drops. (Go... | [
0.12789730727672577,
0.1600135862827301,
0.4474985897541046,
0.10356546193361282,
-0.2646386921405792,
0.2878361642360687,
0.28550347685813904,
0.05499452352523804,
-0.24011936783790588,
-1.0251604318618774,
0.09712465852499008,
0.6119509935379028,
-0.28395557403564453,
0.1968708038330078,... | |
loading into memory. This is great if you want to reuse the same set of images over and over again, but if you are constantly showing different (or large) images, then you should use:
```
NSString *fileLocation = [[NSBundle mainBundle] pathForResource:fileName ofType:extension];
NSData *imageData = [NSData dataWithCon... | [
-0.37327349185943604,
-0.23608580231666565,
0.3506368398666382,
0.10112125426530838,
0.10206987708806992,
0.058775950223207474,
0.005356295499950647,
-0.11067598313093185,
-0.4818231165409088,
-0.9801725745201111,
-0.18846352398395538,
0.5920957922935486,
-0.29998278617858887,
-0.062756925... | |
I need to bind the column Header text of a DataGrid to a Resource string in a XAML file. Does anybody know if this is possible ?
The column Header definition looks like this but I would like to replace the "MyHeaderText" with text from a resource file:-
```
<data:DataGridTextColumn Header="MyHeaderText" Binding="{Bin... | [
0.09514191746711731,
0.1291235387325287,
0.6612548828125,
0.14094063639640808,
0.06843879073858261,
-0.3426709473133087,
-0.02253514900803566,
-0.04737422242760658,
-0.18521317839622498,
-0.7213305234909058,
-0.019300324842333794,
0.44901835918426514,
-0.2021394670009613,
0.283733159303665... | |
your UserControl's Resources section:
```
<sys:String x:Key="MyHeader">My Header Text</sys:String>
```
Then you can do basically what Sorskoot said and you shouldn't receive an error:
```
<data:DataGridTextColumn Header="{StaticResource MyHeader}" Binding="{Binding SomeData}" IsReadOnly="True" />
``` | [
0.05682665854692459,
0.11769530922174454,
0.5592154264450073,
0.1702543944120407,
0.21523462235927582,
-0.39185985922813416,
0.3643752634525299,
0.04024132713675499,
-0.13135725259780884,
-0.598319411277771,
-0.08765009790658951,
0.6169124841690063,
-0.23512043058872223,
-0.072135984897613... | |
I am trying to get a description in a XUL application to wrap, even if it contains long lines.
For example, if I save the following as a .xul file and open it in Firefox, it looks fine and wraps appropriately:
```
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window
id="... | [
0.5809189081192017,
0.14658686518669128,
0.6647270917892456,
-0.2435714453458786,
-0.1916668713092804,
0.11824649572372437,
0.35598015785217285,
-0.43154680728912354,
-0.11086537688970566,
-0.7717309594154358,
-0.2412637323141098,
0.2500652074813843,
-0.2819695472717285,
0.1391004323959350... | |
black; padding: 2px;">test test test test test test test test test test test test test test test test test test test test test</description>
</vbox>
</window>
```
However, if I remove the spaces in the big line, it doesn't get wrapped and I just get a scroll bar to see the line:
```
<?xml version="1.0"?>
<?xml-st... | [
0.33881014585494995,
0.026734985411167145,
0.309140682220459,
-0.017632562667131424,
-0.04691558703780174,
0.1046983152627945,
0.24051031470298767,
-0.48237526416778564,
-0.10411421209573746,
-0.6543251872062683,
-0.1896568238735199,
0.5299980044364929,
-0.06298995018005371,
0.101949639618... | |
padding: 2px;">test</description>
<description style="border: 1px solid black; padding: 2px;">testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest</description>
</vbox>
</window>
```
Is there any way I can use CSS or anything else to force the long line to be wrapped when it reac... | [
0.036388203501701355,
-0.2871866822242737,
0.629558801651001,
-0.1775655895471573,
-0.36024680733680725,
0.04249875992536545,
0.20925337076187134,
-0.4232209324836731,
-0.19539819657802582,
-0.575783908367157,
-0.18046869337558746,
0.25634321570396423,
-0.5044269561767578,
-0.0920850560069... | |
way (Google was my friend) of doing it. Some suggest using a small script that adds `<br />` in the middle of the word. Use *word-wrap:break-word* and hope that users will eventually upgrade. | [
0.47160398960113525,
0.03448177129030228,
0.15969784557819366,
-0.08265990018844604,
-0.19465500116348267,
-0.1176990196108818,
0.5121957659721375,
0.4897121489048004,
-0.31268808245658875,
-0.6559063792228699,
0.05636390298604965,
0.3250178396701813,
0.16325846314430237,
-0.17055813968181... | |
For a POST method, the W3 specs say:
> If a resource has been created on the origin server, the response
> SHOULD be 201 (Created) and contain an entity which describes the
> status of the request and refers to the new resource, and a Location
> header (see Section 10.4).
<http://www.ietf.org/internet-drafts/draft... | [
0.13419635593891144,
-0.34952378273010254,
0.4776862859725952,
-0.16241659224033356,
-0.1888567954301834,
0.17628085613250732,
0.26780298352241516,
-0.28647440671920776,
-0.18068835139274597,
-0.40542006492614746,
-0.3915509879589081,
0.06090916320681572,
-0.35842353105545044,
0.2975080311... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.