text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I don't know why my code doesn't work.
```
$("#example").find('LI A').hasClass("sth").each(function(){alert($(this))});
```
Firebug says:
> $("#example").find('LI A').hasClass("sth").each is not a function
The problem in this code is `each`, because if I delete it, it giving me no errors.
I need to pass founded ... | [
0.08145392686128616,
0.10914281010627747,
0.37721747159957886,
-0.359512060880661,
-0.0655302032828331,
0.023511191830039024,
0.17755331099033356,
-0.5270195007324219,
-0.21183164417743683,
-0.7122526168823242,
-0.20031684637069702,
0.7333521246910095,
-0.5223512649536133,
0.06058340892195... | |
I have the following code which almost works:
**AES.java**
```
import java.io.UnsupportedEncodingException;
import java.security.AlgorithmParameters;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.s... | [
-0.010846514254808426,
0.21587173640727997,
0.47518786787986755,
0.026317013427615166,
0.09075439721345901,
0.21138550341129303,
0.8006875514984131,
-0.6880167126655579,
0.1651345193386078,
-0.7747995257377625,
0.015253112651407719,
0.43479862809181213,
-0.5171025991439819,
0.0942756384611... | |
= "AES";
private static final String SECRET_KEY_ALGORITHM = "PBKDF2WithHmacSHA1";
private static final String TRANSFORMATION = "AES/CBC/PKCS5Padding";
private final Cipher m_enc_cipher;
private final Cipher m_dec_cipher;
private final byte[] m_iv;
public AES(f... | [
-0.43656429648399353,
0.05319831892848015,
0.43744248151779175,
-0.213526651263237,
0.01856648549437523,
0.5316788554191589,
0.7083660364151001,
-0.5308513045310974,
-0.037513650953769684,
-0.5626587271690369,
-0.4956603944301605,
0.21447041630744934,
-0.061674751341342926,
0.4070941209793... | |
throws NoSuchAlgorithmException, InvalidKeySpecException,
NoSuchPaddingException, InvalidKeyException,
InvalidParameterSpecException, IllegalBlockSizeException,
BadPaddingException, UnsupportedEncodingException,
InvalidAlgorithmParameterException {
// Derive the ... | [
-0.13337962329387665,
0.11984393745660782,
0.21331191062927246,
-0.03757593408226967,
0.02087991312146187,
0.3150717616081238,
0.7549129128456116,
-0.286249041557312,
0.039215799421072006,
-0.4982440769672394,
-0.06577977538108826,
0.23645943403244019,
-0.23996604979038239,
0.4818277657032... | |
final KeySpec spec = new PBEKeySpec(password, salt, ITERATIONS,
KEY_LENGTH);
final SecretKey tmp = factory.generateSecret(spec);
final SecretKey secret = new SecretKeySpec(tmp.getEncoded(), ALGORITHM);
// Build encryptor and get IV
final Cipher enc_cipher = Cipher.getIns... | [
-0.43102768063545227,
-0.29562851786613464,
0.9072882533073425,
0.17344413697719574,
-0.12827958166599274,
0.4409763813018799,
0.47177937626838684,
-0.6092306971549988,
-0.24530601501464844,
-0.4087827503681183,
-0.4647229015827179,
0.30108147859573364,
-0.015681566670536995,
0.30903115868... | |
= enc_cipher.getParameters();
final byte[] iv = params.getParameterSpec(IvParameterSpec.class)
.getIV();
// Build decryptor
final Cipher dec_cipher = Cipher.getInstance(TRANSFORMATION);
dec_cipher.init(Cipher.DECRYPT_MODE, secret, new IvParameterSpec(iv));
this.... | [
-0.24206063151359558,
-0.18535369634628296,
0.8592034578323364,
0.06642414629459381,
-0.16641955077648163,
0.31941837072372437,
0.5967914462089539,
-0.7211999893188477,
-0.36956992745399475,
-0.5460307002067566,
-0.45749881863594055,
0.2351674884557724,
-0.16847582161426544,
0.411151230335... | |
public AES(final byte[] iv) throws NoSuchAlgorithmException,
InvalidKeySpecException, NoSuchPaddingException,
InvalidKeyException, InvalidParameterSpecException,
IllegalBlockSizeException, BadPaddingException,
UnsupportedEncodingException, InvalidAlgorithmParameterExcepti... | [
-0.3946516811847687,
0.04429198428988457,
0.5102722644805908,
0.06088657304644585,
-0.05272877588868141,
0.5201489925384521,
0.42953863739967346,
-0.5756201148033142,
-0.10587117075920105,
-0.5183447003364563,
-0.1357659250497818,
0.3361999988555908,
-0.30657774209976196,
0.259547859430313... | |
SecretKey secret = keygen.generateKey();
// Build encryptor
final Cipher enc_cipher = Cipher.getInstance(TRANSFORMATION);
enc_cipher.init(Cipher.ENCRYPT_MODE, secret, aps);
// Build decryptor
final Cipher dec_cipher = Cipher.getInstance(TRANSFORMATION);
dec_cipher.init(... | [
-0.43282386660575867,
-0.1558564454317093,
0.217294842004776,
0.07620727270841599,
0.010132547467947006,
0.31101155281066895,
0.665159285068512,
-0.37654662132263184,
-0.03906824067234993,
-0.3879421055316925,
-0.6697636246681213,
0.30658119916915894,
-0.17155271768569946,
0.32344311475753... | |
}
public byte[] get_iv() {
return this.m_iv;
}
public byte[] encrypt(final byte[] data) throws NoSuchAlgorithmException,
InvalidKeySpecException, NoSuchPaddingException,
InvalidKeyException, InvalidParameterSpecException,
IllegalBlockSizeException, BadPaddingExc... | [
-0.22415286302566528,
0.011672316119074821,
0.3332964777946472,
-0.0893065333366394,
0.22458140552043915,
0.18340133130550385,
0.47006839513778687,
-0.2895224988460541,
-0.42496687173843384,
-0.4478759765625,
-0.5521047115325928,
0.4010549783706665,
-0.32492324709892273,
0.2316801697015762... | |
public byte[] decrypt(final byte[] data) throws IllegalBlockSizeException,
BadPaddingException {
return this.m_dec_cipher.doFinal(data);
}
}
```
**AESTest.java**
```
import java.io.UnsupportedEncodingException;
import java.security.InvalidAlgorithmParameterException;
import java.security.Inva... | [
0.07614419609308243,
0.25373575091362,
0.02916857972741127,
-0.005007193423807621,
-0.09090156853199005,
0.38967326283454895,
0.6256049275398254,
-0.611772894859314,
-0.009005625732243061,
-0.27587801218032837,
-0.3159455955028534,
0.39098060131073,
-0.5490812063217163,
0.12007320672273636... | |
UnsupportedEncodingException,
InvalidAlgorithmParameterException {
final char[] password = "my_password".toCharArray();
final byte[] salt = new byte[] { 22, 11 };
final byte[] original_data = "Hello, World!".getBytes("UTF-8");
final AES aesA = new AES(password, salt);
... | [
-0.2909666895866394,
0.019626803696155548,
0.35915160179138184,
-0.15135012567043304,
0.3101055324077606,
0.2404509335756302,
0.6057215929031372,
-0.17944009602069855,
-0.11810464411973953,
-0.514811635017395,
-0.6626904606819153,
0.2549411356449127,
-0.455274373292923,
0.5191014409065247,... | |
.printBase64Binary(encrypted_data));
final AES aesB = new AES(aesA.get_iv());
final byte[] decrypted_data_B = aesB.decrypt(encrypted_data);
System.out.println("Decrypted B:");
System.out.println(javax.xml.bind.DatatypeConverter
.printBase64Binary(decrypted_data_B));
... | [
-0.18290004134178162,
0.18916849792003632,
0.3649779260158539,
-0.44372984766960144,
-0.06535723060369492,
0.006538660265505314,
0.6240573525428772,
-0.5078425407409668,
0.00639723427593708,
-0.4805595576763153,
-0.24281272292137146,
0.6267293095588684,
-0.3662375509738922,
0.2161130905151... | |
purpose is to be able to send an encrypted data block and later get it back.
The term "later" could refer to a day/week/year.
Then, using the same password I want to decrypt it.
**Because "later" might be a month I'll need to create a new `AES` object.**
Now, this new `AES` object must be able to decrypt the da... | [
0.20135091245174408,
-0.005376996472477913,
0.29539379477500916,
0.13061554729938507,
0.08954567462205887,
0.2505721151828766,
0.5744969248771667,
-0.09486990422010422,
-0.24785283207893372,
-0.8915954232215881,
0.2542031407356262,
0.390014111995697,
-0.07935439050197601,
0.155850186944007... | |
so it won't match with the one created in the first constructor. I don't really get your intention in having two different constructors, where in each you create an AES instance fit for encryption as well as another one for decryption? It might make sense to rethink that design and use just one single instance only, de... | [
0.38141655921936035,
0.17413492500782013,
-0.06002577394247055,
0.5630182027816772,
0.005955630447715521,
-0.23785263299942017,
0.009156608022749424,
-0.5436798334121704,
-0.2396848350763321,
-0.25432974100112915,
0.18622738122940063,
0.5487850308418274,
-0.4166146218776703,
0.364759564399... | |
unique IVs for every encrypted message, otherwise there's attacks that are possible against the CBC mode you are using.
So here's how I would recommend you do it:
**Encryption:**
Basically the first constructor, leaving out the second instance for decryption. Retrieve the IV that was created.
**Decryption:**
Again... | [
0.2179764211177826,
0.09830670058727264,
0.29489681124687195,
0.10675264894962311,
-0.3615725040435791,
-0.16538897156715393,
0.2843833863735199,
-0.45272231101989746,
-0.4071178734302521,
-0.6285614371299744,
0.02237570285797119,
0.5431029200553894,
-0.21623064577579498,
0.289275825023651... | |
I have this code:
```
l = lambda { a }
def some_function
a = 1
end
```
I just want to access `a` by the lambda and a special scope which has defined `a` already somewhere like inside `some_function` in the example, or just soon later in the same scope as:
```
l = lambda { a }
a = 1
l.call
```
Then I fo... | [
0.2059960812330246,
0.32506299018859863,
0.33484748005867004,
-0.43467575311660767,
-0.15684004127979279,
-0.14161375164985657,
0.28850895166397095,
-0.21820372343063354,
-0.18014420568943024,
-0.38032570481300354,
0.05699167028069496,
0.5819480419158936,
-0.41966870427131653,
0.1231609359... | |
call
end
```
But this also failed, it is strange that I can't explain why.
I know the one of the solution is using `eval`, in which I could special a binding and executing some code in text, but I really do not want to use as so.
And, I know it is able to use a global variable or instance variable. However, actual... | [
-0.04571926221251488,
0.08236010372638702,
0.4860421121120453,
-0.022214287891983986,
-0.008482069708406925,
-0.40611281991004944,
0.2736267149448395,
-0.1933777928352356,
0.04718707129359245,
-0.14464342594146729,
-0.2926890552043915,
0.6899920105934143,
-0.5369263887405396,
0.26774504780... | |
that referred to the `Proc`'s context. While the function only provided a way to access its binding but cannot change it, except using `Binding#eval`. It evaluate text also, which is exactly what I don't like to do.
Now the question is, do I have a better (or more elegant) way to implement this? Or using `eval` is alr... | [
0.1416136473417282,
0.21328841149806976,
0.2509672939777374,
-0.06839292496442795,
-0.2628137171268463,
0.11330153048038483,
0.28829774260520935,
-0.022663762792944908,
-0.3197888135910034,
-0.35120975971221924,
-0.08432777225971222,
0.5109155178070068,
-0.338565856218338,
-0.1219956427812... | |
purpose is to matching the regular expressions and execute the Procs under my special scope, where the Proce will involved some local variables that should be defined later. And then I met the problem above.
Actually I suppose it is not same completely to [that question](https://stackoverflow.com/questions/9245947/i... | [
0.096710704267025,
0.08448708057403564,
0.42633578181266785,
-0.0852457657456398,
0.008971917442977428,
-0.11693867295980453,
0.5461031198501587,
-0.3107044994831085,
-0.2551189064979553,
-0.3637149930000305,
-0.1656554937362671,
0.5453450679779053,
-0.5190592408180237,
-0.1970847249031067... | |
like this:
```
irb(main):001:0* lambda { foo }.call_with_vars(:foo => 3)
=> 3
irb(main):002:0> lambda { |a| foo + a }.call_with_vars({:foo => 3}, 1)
=> 4
```
This is not a very general solution, though. It would be better if we could give it `Binding` instance instead of a Hash and do the following:
```
l = lambda ... | [
-0.21402697265148163,
0.027123814448714256,
0.5637512803077698,
-0.4757811725139618,
-0.1659727841615677,
-0.12623809278011322,
0.45908427238464355,
-0.5312770009040833,
-0.2713431715965271,
-0.5483332276344299,
-0.020855985581874847,
0.5193603038787842,
-0.637795627117157,
0.1850095242261... | |
begin
method = eval("method(%s)" % m.inspect, bind)
rescue NameError
else
return method.call(*args)
end
begin
value = eval(m.to_s, bind)
return value
rescue NameError
end
end
raise NoMethodError
end
def push_binding(bind)
@bindings.pus... | [
-0.18464408814907074,
-0.016453173011541367,
0.774323582649231,
-0.3094159662723541,
0.027147997170686722,
0.2374378740787506,
0.5798921585083008,
-0.8996275663375854,
-0.04383392259478569,
-0.19503122568130493,
-0.2657274007797241,
0.36308950185775757,
-0.2693137526512146,
0.1110839247703... | |
bind
end
def push_instance(obj)
@bindings.push obj.instance_eval { binding }
end
def push_hash(vars)
push_instance Struct.new(*vars.keys).new(*vars.values)
end
def run_proc(p, *args)
instance_exec(*args, &p)
end
end
class Proc
def call_with_binding(bind, *args)
LookupStack.new([bind]... | [
-0.2503548264503479,
-0.038440071046352386,
0.8958717584609985,
-0.5534422397613525,
-0.09475813806056976,
-0.006664401851594448,
0.24864643812179565,
-0.6654923558235168,
-0.1596374213695526,
-0.42542487382888794,
-0.18717119097709656,
0.4108262360095978,
-0.7249118685722351,
0.0826031193... | |
var + a }
local = 1
def func(x) x end
class Foo < Struct.new(:add)
def some_method(x) x + add end
end
stack = LookupStack.new
stack.push_binding(binding)
stack.push_instance(Foo.new(2))
stack.push_hash(:var => 4)
p stack.run_proc(l, 5)
```
This prints 15, as expected :)
**UPDATE:** Code is now also available [... | [
0.042309440672397614,
-0.09734886884689331,
0.5751451849937439,
-0.42022180557250977,
-0.10632326453924179,
0.0077425893396139145,
0.39083924889564514,
-0.3934042453765869,
-0.18846380710601807,
-0.43955904245376587,
-0.20811612904071808,
0.4078120291233063,
-0.5093393325805664,
0.09271284... | |
I want to create a semi-transparent JPanel. I've done it by simply using RGBA value of color constructor but problem is when i m using event handling is not woking properly. My requirement is a semi transparent Jpanel when mouse enters it border of this panel became visible and if mouse exit the border shoud not visibl... | [
0.31970837712287903,
-0.06869354099035263,
0.38293296098709106,
-0.1855129599571228,
-0.19433541595935822,
-0.02214321866631508,
0.3509584069252014,
-0.3910084068775177,
0.13887108862400055,
-0.9060801267623901,
-0.08395987749099731,
0.47187891602516174,
-0.4952995777130127,
0.143468454480... | |
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MDCW frame = new MDCW(); | [
0.3688042163848877,
-0.42975419759750366,
0.37140002846717834,
-0.28787311911582947,
0.4593212902545929,
-0.04372480884194374,
0.48144617676734924,
-0.10520128905773163,
-0.2513365149497986,
-0.363132506608963,
-0.5103946328163147,
0.5262691974639893,
-0.374713271856308,
0.4545425176620483... | |
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/** | [
0.4698692858219147,
-0.3781242370605469,
0.261575847864151,
-0.10105878859758377,
0.1833510845899582,
-0.15420018136501312,
0.3252343237400055,
-0.7263615131378174,
-0.31374698877334595,
-0.4675277769565582,
-0.2246066927909851,
0.5728673338890076,
-0.5610756874084473,
-0.10464583337306976... | |
* Create the frame.
*/
public MDCW() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 1013, 551);
contentPane = new JPanel();
contentPane.setBackground(new Color(0, 139, 139));
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPan... | [
0.2220170795917511,
-0.29793545603752136,
0.7117099165916443,
-0.045077845454216,
-0.029135731980204582,
0.3924422860145569,
0.307562917470932,
-0.39965519309043884,
-0.16260023415088654,
-0.6382927298545837,
-0.4345778226852417,
0.2476874738931656,
-0.28427654504776,
0.29703617095947266,
... | |
panel.setBackground(new Color(0, 0, 0,50));
panel.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
panel.setBorder(new LineBorder(new Color(255, 255, 255), 5));
}
@Override | [
-0.19578462839126587,
-0.5854856371879578,
0.6496107578277588,
-0.08804646134376526,
0.3542962372303009,
0.25048965215682983,
0.1425083726644516,
-0.2736082971096039,
-0.14989885687828064,
-0.6480457186698914,
-0.34621521830558777,
0.7981657385826111,
-0.33980411291122437,
0.04899303242564... | |
public void mouseExited(MouseEvent e) {
panel.setBorder(null);
}
});
panel.setBounds(360, 155, 215, 215);
contentPane.add(panel);
final JPanel panel_1 = new JPanel();
panel_1.setBackground(new Color(0, 0, 0)); | [
-0.07530594617128372,
-0.49741455912590027,
0.6268483996391296,
-0.09736020863056183,
0.0606200136244297,
0.15796862542629242,
0.1504286229610443,
-0.251787394285202,
-0.1048375740647316,
-0.5615819692611694,
-0.5497901439666748,
0.49661436676979065,
-0.5043596625328064,
0.0619044192135334... | |
panel_1.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
panel_1.setBorder(new LineBorder(new Color(255, 255, 255), 5));
}
@Override
public void mouseExited(MouseEvent e) { | [
-0.015467444434762001,
-0.5720278024673462,
0.6202592849731445,
-0.14984199404716492,
0.12354085594415665,
0.16604812443256378,
0.2710021436214447,
-0.2959216237068176,
-0.0979161486029625,
-0.6812056303024292,
-0.3743050992488861,
0.8344795107841492,
-0.5319016575813293,
-0.10646172612905... | |
panel_1.setBorder(null);
}
});
panel_1.setBounds(84, 155, 215, 215);
contentPane.add(panel_1);
}
}
```
JPanel does not support semi-transparent backgrounds. There are two steps needed to take care of this problem:
* First, to have any correctly-functioning transparency at a... | [
0.2216673195362091,
-0.05630938336253166,
0.4483952820301056,
0.004537522792816162,
-0.14112550020217896,
-0.07265621423721313,
0.32975441217422485,
-0.15653982758522034,
-0.2664477229118347,
-0.6331347227096558,
-0.4424441158771515,
0.4748702347278595,
-0.41269925236701965,
-0.21026198565... | |
what is underneath its bounds.
* However, when `opaque` is `false`, the panel also does not draw its background at all (!) so you will have to draw a background in paintComponent.
Here is a drop-in replacement class which will take care of both of these steps.
```
private class TransparentPanel extends JPanel {
{... | [
0.37308651208877563,
-0.434377521276474,
0.5051631331443787,
-0.0831572487950325,
-0.09809452295303345,
0.20287463068962097,
-0.0771903470158577,
-0.29515814781188965,
-0.1811296045780182,
-0.5761517882347107,
-0.12429957091808319,
0.6124513149261475,
-0.49439364671707153,
-0.1556520611047... | |
g.fillRect(r.x, r.y, r.width, r.height);
super.paintComponent(g);
}
}
```
I’ve checked that it works in your program if I change the first panel creation to:
```
final JPanel panel = new TransparentPanel();
``` | [
0.003283173544332385,
-0.09113052487373352,
0.7583779096603394,
-0.3406275510787964,
-0.2616316080093384,
0.2821056544780731,
0.12232435494661331,
-0.046267472207546234,
-0.28394392132759094,
-0.921186625957489,
-0.36720865964889526,
0.6358131766319275,
-0.29022887349128723,
-0.07466826587... | |
I have problem getting newer version of [jscrollpane](http://jscrollpane.kelvinluck.com/) to work with jQuery UI tabs.
I get only one tab (first one) working, but no others; i tried fix explained here with previous version, placing additional `<div>` controlled by tabs (and inside are divs controlled by jScrollPane) , ... | [
-0.044039249420166016,
-0.11525964736938477,
0.6744159460067749,
0.05494469404220581,
0.06577206403017044,
-0.03231941536068916,
0.11044811457395554,
-0.18222230672836304,
-0.25969964265823364,
-0.4984074831008911,
0.22875145077705383,
0.6264961361885071,
-0.1062220111489296,
-0.1151137724... | |
of the box, and i still had problems implementing the solution, i added a click listener to tabs links, and when clicked, added jscrollpane to content div, like this
```
jQuery("#tabs ul li a").click(function () {
clickednum = "#tabs-" + jQuery(this).parent().attr("id");
jQuery(clickednum + " .skroler").jScrollPane();... | [
0.07691187411546707,
-0.039197396486997604,
0.9183644652366638,
-0.2339559942483902,
-0.14967598021030426,
-0.09670623391866684,
0.2785488963127136,
-0.22777719795703888,
-0.18881218135356903,
-0.47750431299209595,
-0.070713572204113,
0.6093686819076538,
-0.3407062292098999,
0.097733244299... | |
tabs by **li** id attribute (which i was in need to generate from PHP. for other reasons)
This is specific implementation - from working example, probably it could be done simpler in other environment.
Ah, and of course, at the start of the story, you need to initialize jScrollPane to first opened tab like
```
jQuer... | [
0.028712792322039604,
-0.03186733275651932,
0.5723735094070435,
0.07313985377550125,
-0.2823812961578369,
-0.228748619556427,
0.14055708050727844,
0.3347136080265045,
-0.3074513375759125,
-0.3435681462287903,
-0.2692766785621643,
0.2912694215774536,
-0.19262993335723877,
0.0739881247282028... | |
How do I pass an EF expression as a method parameter?
To illustrate my question I have created a pseudo code example:
The first example is my method today. The example utilizes EF and a Fancy Retry Logic.
What I need to do is to encapsulate the Fancy Retry Logic so that it becomes more generic and does not duplicate.... | [
0.34818437695503235,
0.14108040928840637,
0.32767072319984436,
0.031027590855956078,
-0.36070603132247925,
-0.1607540100812912,
0.12827818095684052,
-0.4878905117511749,
-0.0513489693403244,
-0.5848868489265442,
0.0965409055352211,
0.20627877116203308,
-0.4021691679954529,
0.14039467275142... | |
benefit from the strongly typed objects.
First Example:
```
public static User GetUser(String userEmail)
{
using (MyEntities dataModel = new MyEntities ())
{
var query = FancyRetryLogic(() =>
{
(dataModel.Users.FirstOrDefault<User>(x => x.UserEmail == userEmail)));
});
... | [
0.42664679884910583,
-0.18317261338233948,
0.5664491653442383,
-0.059949249029159546,
0.06487570703029633,
0.12813100218772888,
0.18550796806812286,
-0.46767857670783997,
-0.20910213887691498,
-0.8885726928710938,
-0.2851276993751526,
0.7079299688339233,
-0.2710833251476288,
0.060623262077... | |
{
var query = FancyRetryLogic(() =>
{
return dataModel.expression
});
}
}
public User GetUser(String userEmail)
{
return RetryHelper<User>(<User>.FirstOrDefault<User>(x => x.UserEmail == userEmail))
}
```
Maybe something like this?
```
... | [
0.7931512594223022,
-0.4754101037979126,
0.7984803915023804,
0.06048327311873436,
0.10973729938268661,
0.05376699939370155,
0.3291966915130615,
-0.20079170167446136,
-0.19483999907970428,
-0.7821779847145081,
-0.2173970639705658,
0.6366317868232727,
-0.4940163493156433,
0.15205785632133484... | |
TValue>(Func<ObjectSet<T>, TValue> func)
where T : class
{
using (MyEntities dataModel = new MyEntities())
{
var entitySet = dataModel.CreateObjectSet<T>();
return FancyRetryLogic(() =>
{
return func(entitySet);
});
}
}
public User GetUse... | [
0.6816889643669128,
-0.6621503829956055,
0.9523478150367737,
0.043009404093027115,
0.01291994284838438,
0.321428507566452,
0.2480623424053192,
-0.12847401201725006,
-0.30083993077278137,
-0.7760449647903442,
-0.3081190884113312,
0.5239448547363281,
-0.507095217704773,
0.058909423649311066,... | |
userEmail)
{
return RetryHelper<User, User>(u => u.FirstOrDefault(x => x.UserEmail == userEmail));
}
``` | [
-0.3035338819026947,
0.10319659858942032,
0.6213067173957825,
-0.37687447667121887,
0.3106468617916107,
-0.01623057946562767,
0.6576882004737854,
-0.5500498414039612,
0.078671395778656,
-0.7268587946891785,
-0.5176969170570374,
0.7574976086616516,
-0.35768476128578186,
0.22840972244739532,... | |
Is it possible to set timer for user's input? Wait 10 seconds - do next operation and etc.
I mean for example
```
//wait several seconds{
String s = new BufferedReader(new InputStreamReader(System.in)).readLine();
//wait server seconds}
//next operation and etc.
```
Not right out of the box, no. Normally the Read... | [
0.15245039761066437,
-0.1560189425945282,
0.6274757981300354,
-0.008068626746535301,
0.22167690098285675,
-0.184378519654274,
0.4167249798774719,
0.0636540949344635,
-0.3433692753314972,
-0.6678617000579834,
-0.0029736964497715235,
0.5805490016937256,
-0.2041710913181305,
0.236764505505561... | |
trying to read the input.
Essentially, the reading thread will have to poll the Reader's ready() method, rather than getting locked in read() when there's nothing to read. If you wrap this polling and waiting operation in a java.util.concurrent.Future, then you call the Future's get() method with a timeout.
This arti... | [
0.10993791371583939,
-0.24377819895744324,
0.060671769082546234,
0.05243012681603432,
-0.06636406481266022,
0.11470899730920792,
0.15862615406513214,
-0.24957069754600525,
-0.27961936593055725,
-0.537140965461731,
-0.28695663809776306,
0.2665884494781494,
-0.34551793336868286,
-0.114788822... | |
I just had my server upgraded from Centos 4.9 to Centos 6.2
The following line is getting logged to my **/etc/httpd/logs/error\_log** (no timestamp, but it gets logged at least every few seconds) :
```
sendmail: Not running with correct effective GID. Is sendmail binary setgid mailtrap?
```
Any idea what it might ... | [
0.20945097506046295,
-0.09648845344781876,
0.6448875665664673,
-0.0006025052862241864,
-0.20014585554599762,
0.037448376417160034,
0.8483848571777344,
-0.0401487872004509,
-0.5575281381607056,
-0.8575018644332886,
-0.12609192728996277,
0.6286740303039551,
-0.43515750765800476,
-0.081966258... | |
correct effective GID. Is sendmail binary setgid mailtrap?
root@vps1 [/]# /usr/lib/sendmail restart
sendmail: Not running with correct effective GID. Is sendmail binary setgid mailtrap?
sendmail: Not running with correct effective GID. Is sendmail binary setgid mailtrap?
```
It's perfectly natural to share an objec... | [
-0.09082163125276566,
0.11702702939510345,
0.44019654393196106,
0.07717882841825485,
-0.13259930908679962,
-0.06263596564531326,
0.3311924934387207,
-0.4913957118988037,
-0.14246773719787598,
-0.6792065501213074,
-0.20404423773288727,
0.7351053953170776,
-0.12207603454589844,
0.03947864845... | |
set or overwrite values...
```
self.query.bodyFat = [NSNumber numberWithFloat:0.5];
``` | [
0.08449152112007141,
-0.06535813212394714,
0.384453684091568,
-0.04964521527290344,
0.21592086553573608,
-0.08425459265708923,
0.5219476819038391,
-0.260188490152359,
-0.10347960144281387,
-0.44173917174339294,
-0.12189946323633194,
0.5639848113059998,
-0.22065268456935883,
0.0156281776726... | |
I keep getting this error when I try to build my project which uses reachability (the error only came up after I tried to implement reachability):

I read some other posts on the internet but nothing seemed to work. I added SystemConfiguration.framewo... | [
0.18903577327728271,
-0.039344076067209244,
0.7577977180480957,
-0.04294830560684204,
0.05404447764158249,
-0.2951337993144989,
0.40758779644966125,
-0.18807539343833923,
-0.35157302021980286,
-0.9605895280838013,
0.0019863329362124205,
0.44760724902153015,
-0.2384367287158966,
0.187684878... | |
else {
NSLog(@"Connection Failed");
}
}
-(BOOL)reachable {
Reachability *r = [Reachability reachabilityWithHostName:@"apple.com"];
NetworkStatus internetStatus = [r currentReachabilityStatus];
if(internetStatus == NotReachable) {
return NO;
}
return YES;
}
```
So if you could h... | [
-0.19459012150764465,
-0.06455647200345993,
0.5606339573860168,
-0.021809304133057594,
0.4143734276294708,
-0.17323514819145203,
0.33565443754196167,
0.08374086767435074,
-0.28313666582107544,
-0.7036033868789673,
-0.23361597955226898,
0.4504649341106415,
-0.13023896515369415,
0.0539779476... | |
see it, choose the menu View > Navigators > Show Project Navigator.
2. Show the file inspector on the right side of the Xcode window. View > Utilities > Show File Inspector.
3. In the Target Membership section, check the checkbox next to your target. | [
0.37066930532455444,
-0.1851811408996582,
0.48753681778907776,
-0.07107631117105484,
0.055060867220163345,
-0.3575453758239746,
-0.00694256043061614,
-0.011045324616134167,
0.2919853627681732,
-0.7403769493103027,
-0.011318481527268887,
0.5229916572570801,
-0.2924083173274994,
-0.204212725... | |
I want to set up my own online compiler. I want to use Ideone Api for this. But its api is available in WSDL format. I tried very hard but could find any tutorial on how to extract data from WSDL. Please tell some way to use Ideone api.
Maybe a late answer but still may be useful for others. Here a simple example in PH... | [
0.3567202091217041,
-0.03023838996887207,
0.008507147431373596,
0.15408955514431,
-0.4622485339641571,
0.057408567517995834,
0.25578969717025757,
0.02770105004310608,
0.024680007249116898,
-0.8803358674049377,
0.37244245409965515,
0.5975580811500549,
-0.08419683575630188,
-0.11445010453462... | |
<http://rendon.x10.mx/files/ide1example/>
And here is the code: <http://rendon.x10.mx/files/ide1example.tar.gz>
**NOTE:** You need provide your own user and password in ideone.php.
```
$params = array(
'user' => $user, // your user
'pass' => $pass, // your pass
'sourceCode' => $... | [
-0.07560048252344131,
0.2431064397096634,
0.3888457119464874,
0.1238858699798584,
-0.0218241848051548,
0.13905762135982513,
0.14686903357505798,
-0.5881652235984802,
-0.4273441433906555,
-0.4011012613773346,
-0.4742308259010315,
0.1960490494966507,
-0.1355186104774475,
-0.04843059927225113... | |
'run' => $run,
'private' => $private
);
```
For more info about the functions consult the API document: <http://ideone.com/files/ideone-api.pdf> | [
0.24684666097164154,
-0.2635306119918823,
0.16198888421058655,
-0.09635934233665466,
0.0560588464140892,
0.27085891366004944,
0.16171224415302277,
-0.20305241644382477,
-0.08404418081045151,
-0.22638925909996033,
-0.24556687474250793,
0.8137558698654175,
-0.49792367219924927,
0.01925840787... | |
URL: **example.com/search:#searchWord**
Since the `#` is not send to the server, it is changed to `%23`.
In the search page I want to display
**Results for: #searchWord**
But what I get is `%23searchWord`. I tried `htmlspecialchars()`, but nothing happens.
To achieve your goal use [urldecode](http://php.net/manual/... | [
0.23342247307300568,
0.013614051043987274,
0.7199929356575012,
-0.0824594646692276,
-0.4232155978679657,
0.04709808900952339,
0.4479234218597412,
0.2581607699394226,
-0.15568828582763672,
-0.7806349992752075,
-0.07688100636005402,
0.2674076557159424,
-0.01112366933375597,
0.475849986076355... | |
I'm trying to compose seq-m and error-m to do list comprehensions on things that can return errors. My output has unexpected types, though other than that it does actually seem to be sensible. i've exploded my code below, but here is a [working gist](https://github.com/dustingetz/sandbox/blob/master/etc/monads/loan.py)... | [
0.05679949373006821,
0.21471552550792694,
0.2623429596424103,
-0.10384189337491989,
0.07871859520673752,
-0.007618169765919447,
0.01606297306716442,
-0.42151007056236267,
-0.18414628505706787,
-0.45967191457748413,
-0.07371943444013596,
0.48430579900741577,
-0.22761401534080505,
0.07087025... | |
bind(get_qualified_amount(balance), lambda qualified_amount:
unit(qualified_amount))))))
return m_qualified_amounts
names = ["Irek", "John", "Alex", "Fred"]
for name, loans in zip(names, map(get_loan, names)):
print "%s: %s" % (name, loans)
```
output
```
Irek: [None, 'Insufficient funds... | [
-0.03564218059182167,
0.09674554318189621,
0.9233710765838623,
-0.025049684569239616,
0.2038305699825287,
0.10852600634098053,
0.17914728820323944,
-0.7419349551200867,
-0.3386169970035553,
-0.45398038625717163,
-0.33280521631240845,
0.3652813136577606,
-0.1515076607465744,
0.2543019354343... | |
None]
Fred: (None, 'No bank associated with name Fred')
```
i expect to see lists of tuples - the list is the result of the list comprehension, and each item in the final list should be a value in error-monad (`value, error` tuple). Its exactly as if one-too-many levels of nesting were removed by `seq_bind`.
here is... | [
-0.12277354300022125,
0.10327517241239548,
0.22738182544708252,
-0.25505536794662476,
-0.2080610990524292,
-0.04400580748915672,
0.41961154341697693,
-0.6799291372299194,
-0.4012244641780853,
-0.41656237840652466,
-0.4885924458503723,
0.7600735425949097,
-0.40502145886421204,
0.12129727751... | |
isinstance(mval, tuple)
error = get_error(mval)
if error: return mval
else: return mf(get_value(mval))
def flatten(listOfLists):
"Flatten one level of nesting"
return [x for sublist in listOfLists for x in sublist]
# sequence monad
def seq_unit(x): return [x]
def seq_bind(mval, mf):
assert... | [
-0.2038642317056656,
-0.3589709997177124,
0.48395150899887085,
-0.15752238035202026,
0.1310468167066574,
0.06136283278465271,
0.15074443817138672,
-0.5475901365280151,
-0.3229728937149048,
-0.716223955154419,
-0.3116856813430786,
0.6936590671539307,
-0.188884437084198,
0.0476624071598053,
... | |
elif name == "John": return success(["PNC Bank"])
elif name == "Alex": return success(["TD Bank"])
else: return error("No bank associated with name %s" % name)
def get_accounts(bank, name):
if name == "Irek" and bank == "Bank of America": return success([1, 2])
elif name == "Irek" and bank == "Wells ... | [
0.24549679458141327,
0.40341731905937195,
0.040237314999103546,
-0.11200520396232605,
0.12743322551250458,
0.3221394121646881,
0.3857223093509674,
-0.314899206161499,
-0.19780148565769196,
-0.5709699988365173,
-0.2687784433364868,
0.8105556964874268,
-0.1747155487537384,
-0.105526633560657... | |
name == "Alex" and bank == "TD Bank": return success([7, 8])
else: return error("No account associated with (%s, %s)" % (bank, name))
def get_balance(bank, account):
if bank == "Wells Fargo":
return error("Unable to get balance due to technical issue for %s: %s" % (bank, account))
else:
ret... | [
0.1350415199995041,
-0.23114055395126343,
0.6377235054969788,
0.2118716835975647,
0.5243135690689087,
0.2328997254371643,
0.20500628650188446,
-0.13959503173828125,
-0.6058047413825989,
-0.3626773953437805,
-0.2315816432237625,
0.7063838839530945,
0.04081300273537636,
0.02087482251226902,
... | |
else:
return error("Insufficient funds for loan, current balance is %s" % balance)
```
also looking for ways to improve the code. tagged haskell and clojure because this is idiomatic in these languages, the python community isn't interested in this.
Combining monads by stacking like this is, in Haskell, using... | [
0.33254337310791016,
-0.3193959593772888,
-0.08060693740844727,
-0.09698457270860672,
-0.29538682103157043,
0.1130315288901329,
0.09567828476428986,
-0.33191612362861633,
-0.10444621741771698,
-0.506054699420929,
0.07833533734083176,
0.5942569971084595,
-0.6482890844345093,
0.0486458614468... | |
there are two ways:
1. `(ErrorT e) List a` which looks like `[ (x,None), (y,None), (None, err) ]`
2. `ListT (ErrorT e) a` which looks like `[x,y,z], None` or `None, [x,y,z]`
You wanted a list of pairs, so I expect you want the first form. But your simple test does not agree with this. Your `unit` does not return a li... | [
-0.015010838396847248,
0.04426826164126396,
-0.017323805019259453,
-0.1195731833577156,
-0.4785304367542267,
0.2749898433685303,
0.46114981174468994,
-0.5109160542488098,
0.052413955330848694,
-0.5799028873443604,
-0.37236616015434265,
0.616168737411499,
-0.3358151316642761,
-0.20525331795... | |
this code might do what you want:
```
def flatten(listOfLists):
"Flatten one level of nesting"
assert isinstance(listOfLists, list)
if len(listOfLists) > 0:
assert isinstance(listOfLists[0], list)
return [x for sublist in listOfLists for x in sublist]
# sequence monad
def seq_unit(x): return [... | [
-0.1474785953760147,
-0.2838735580444336,
0.3290287256240845,
-0.25028347969055176,
-0.18202805519104004,
0.13952253758907318,
0.24260154366493225,
-0.711235761642456,
-0.1114315539598465,
-0.8158166408538818,
-0.29761695861816406,
0.7324786186218262,
-0.14423847198486328,
-0.0850552767515... | |
return (x,None)
def errorT_list_unit(x): return seq_unit(error_unit(x))
def error_bind(mval, mf):
assert isinstance(mval, tuple)
error = get_error(mval)
if error:
return error_throwError(error)
else:
return mf(get_value(mval))
# Cannot have multi-line lambda
def errorT_list_bind_helpe... | [
-0.24795305728912354,
-0.20750804245471954,
0.5669770240783691,
-0.2505297362804413,
-0.4764421880245209,
0.35087281465530396,
0.31633779406547546,
-0.7105283141136169,
-0.19374044239521027,
-0.31153005361557007,
-0.39455446600914,
0.8061327934265137,
-0.3585977852344513,
-0.05604784935712... | |
mf))
# combined monad !! (ErrorT e) List a
unit = errorT_list_unit
bind = errorT_list_bind
throwError = errorT_list_throwError
# hard coded "lift :: List a -> (ErrorT e) List a"
def lift(mval):
assert isinstance(mval, list)
# return [ (val,None) for val in mval ]
# return [ errorT_list_unit(val) for val i... | [
0.10217506438493729,
-0.1837131828069687,
0.6525659561157227,
-0.16257953643798828,
-0.1977742463350296,
0.21239252388477325,
0.21416230499744415,
-0.7121587991714478,
-0.5039824843406677,
-0.26577624678611755,
-0.35380691289901733,
0.8255353569984436,
-0.2222573608160019,
0.03157674893736... | |
else: return throwError("No bank associated with name %s" % name)
def get_accounts(bank, name):
if name == "Irek" and bank == "Bank of America": return lift([1, 2])
elif name == "Irek" and bank == "Wells Fargo": return unit(3)
elif name == "John" and bank == "PNC Bank": return unit(4)
elif name == "J... | [
0.2502451241016388,
0.35797250270843506,
0.2828725278377533,
-0.03841712325811386,
0.19663479924201965,
0.48806798458099365,
0.16241730749607086,
-0.3589925765991211,
-0.21648408472537994,
-0.264708548784256,
-0.14293316006660461,
0.5689902305603027,
-0.14617206156253815,
0.113662727177143... | |
%s)" % (bank, name))
def get_balance(bank, account):
if bank == "Wells Fargo":
return throwError("Unable to get balance due to technical issue for %s: %s" % (bank, account))
else:
return unit(account * 35000) #right around 200,000 depending on acct number
def get_qualified_amount(balance):
... | [
0.1580989807844162,
-0.2448074221611023,
0.5141624808311462,
0.07052485644817352,
0.4668620228767395,
0.12940527498722076,
0.040637556463479996,
-0.19890747964382172,
-0.3582463562488556,
-0.2845922112464905,
-0.19838069379329681,
0.47556179761886597,
0.02483363077044487,
0.242459297180175... | |
logic
def get_loan(name):
m_qualified_amounts = (
bind(get_banks(name), lambda bank:
bind(get_accounts(bank, name), lambda account:
bind(get_balance(bank, account), lambda balance:
bind(get_qualified_amount(balance), lambda qualified_amount:
unit(qual... | [
-0.2241186648607254,
-0.26131123304367065,
0.2913884222507477,
0.14591006934642792,
-0.13510800898075104,
-0.030154962092638016,
0.34498366713523865,
-0.6213425397872925,
-0.26823991537094116,
0.10820376873016357,
-0.1274309605360031,
0.8787698149681091,
0.0031252519693225622,
0.0791225582... | |
["Irek", "John", "Alex", "Fred"]
for name, loans in zip(names, map(get_loan, names)):
print "%s: %s" % (name, loans)
```
Output is
```
Irek: [(None, 'Insufficient funds for loan, current balance is 35000'), (None, 'Insufficient funds for loan, current balance is 70000'), (None, 'Unable to get balance due to tec... | [
0.06115109473466873,
0.2272617071866989,
0.32864460349082947,
0.12784922122955322,
0.41891059279441833,
0.6025936603546143,
-0.06316493451595306,
-0.08252926170825958,
-0.5315023064613342,
-0.35189592838287354,
-0.09892652928829193,
0.25883981585502625,
-0.23129044473171234,
0.185009136795... | |
I have a UIWebView that loads and external product configuration web service UI that is basically a bunch of dependent Drop Down lists.
The problem is the Drop Downs are basically enhanced text input's so when the user taps them to display the options the UIKeyboard keeps popping up and own after they make their selec... | [
0.20548665523529053,
-0.0872294008731842,
0.626042366027832,
-0.25777575373649597,
-0.05773530527949333,
-0.23752690851688385,
0.323244571685791,
-0.14432205259799957,
-0.08053809404373169,
-0.9650513529777527,
-0.11430413275957108,
0.49409493803977966,
-0.27445176243782043,
0.269427210092... | |
notification and can filter it if only for your WebView object. | [
0.2671545147895813,
-0.13835400342941284,
0.26899948716163635,
0.07820813357830048,
-0.22862295806407928,
-0.32478412985801697,
0.3703141212463379,
0.2769809067249298,
-0.37069272994995117,
-0.7727018594741821,
-0.2655588984489441,
-0.012759016826748848,
-0.26393139362335205,
0.09725568443... | |
I'm lost. How might I pass a loop variable to an AJAX .done() call?
```
for (var i in obj) {
$.ajax(/script/).done(function(data){ console.log(data); });
}
```
Obviously, if I were to do `console.log(i+' '+data)` *i* would return the very last key in the object `obj` on every single iteration. Documentation fails... | [
0.1024332046508789,
0.0660860538482666,
0.15053768455982208,
0.08606741577386856,
0.296339750289917,
0.04903002083301544,
0.4286203980445862,
0.14771749079227448,
-0.08128688484430313,
-0.4287368059158325,
0.08210094273090363,
0.4301221966743469,
-0.1636619120836258,
0.5584968328475952,
... | |
$.ajax(/script/).done(function(data){ console.log(data); });
})(i);
}
``` | [
0.09297247231006622,
0.02382952906191349,
0.23652900755405426,
-0.11828333884477615,
0.1681777834892273,
-0.25164127349853516,
0.3014127016067505,
0.011197415180504322,
0.11933521181344986,
-0.6618256568908691,
-0.30950453877449036,
0.7823765873908997,
-0.26084527373313904,
-0.020628599449... | |
Does anyone has experience with the rather new `std::async`? We are currently implementing a parallel file parser, which reads a file chunk and passes this chunk to an async function.
Using Clang (v3.0) this way works really fine with the default `std::async` policies (implementation dependent). On a two core machine,... | [
0.31322652101516724,
0.04665973782539368,
0.2404949963092804,
0.10365094244480133,
0.06831034272909164,
-0.3341548442840576,
0.23115701973438263,
0.1368211805820465,
-0.5882719159126282,
-0.34289783239364624,
0.006963740102946758,
0.754997730255127,
-0.38952556252479553,
0.1834298074245453... | |
current of GCC's c++11 threading capabilities? Or might this be an error in our implementation?
Short code:
```
while (readNewChunk()) {
Chunk &chunk = fileReader_.getChunk(); //reading the file
ChunkLoader *chunkLoader = new ChunkLoader();
auto ftr = std::async(std::launch::async, &ChunkLoader::createDic... | [
0.22156192362308502,
-0.23882348835468292,
0.5351554751396179,
-0.30133023858070374,
0.03005554899573326,
-0.37988388538360596,
0.15445107221603394,
-0.3203739821910858,
-0.39451152086257935,
-0.23737561702728271,
-0.693459689617157,
0.7077551484107971,
-0.46657654643058777,
0.031554684042... | |
Let's say I want to design a REST store used to manage a list.
A list entry would look something like this:
```xml
<listentry>
<position>0</position> <!-- position in the list -->
<data>interesting information</data> <!-- entry data -->
</listentry>
```
I would design the resource like this:
... | [
0.04080776497721672,
0.07445856183767319,
0.033658817410469055,
0.015235952101647854,
0.06366630643606186,
0.04742123931646347,
-0.06419786810874939,
-0.1741875857114792,
-0.032465860247612,
-0.7582136392593384,
-0.11832115054130554,
0.5821470618247986,
-0.05463279038667679,
0.165767118334... | |
/list/first // update first list entry
PUT /list/last // update last list entry
PUT /list/{position} // update entry at {position}
POST /list/last // inserts a new list entry at last position
POST /list/first // inserts a new list entry at first position
POST /list/{position} // inse... | [
-0.3770257234573364,
0.0326390415430069,
0.5219452381134033,
-0.12130284309387207,
-0.05623489245772362,
0.5086247324943542,
-0.012752559036016464,
-0.40610557794570923,
-0.40634676814079285,
-0.7852209210395813,
-0.6445033550262451,
0.13745242357254028,
-0.2509288489818573,
0.045851636677... | |
// entries down the list starting from the entry that
// was at {position} before the insertion.
```
is this a legal REST resource? If not is there a way to design a rest resource so that it can manage a list?
**EDIT**
Thank you for the input it definetly helped.
I agree with nategood and d... | [
0.20383454859256744,
0.32477638125419617,
-0.02878689579665661,
0.09144732356071472,
0.1498149186372757,
-0.19202551245689392,
-0.00899116788059473,
-0.0232425257563591,
-0.03855028748512268,
-0.547222912311554,
-0.19438806176185608,
0.47470852732658386,
-0.08947280049324036,
-0.0247437003... | |
also my [question](https://stackoverflow.com/questions/9380833/is-creating-rest-subresources-to-get-the-last-or-first-element-of-a-list-bad-pra "post") on this). Of course I could do without those magic identifiers as suggested by Saintedlama, but this would rob me of the possibillity to use them in the post requests I... | [
0.1889057755470276,
0.04159535467624664,
0.2853054106235504,
0.1076594814658165,
0.014687406830489635,
0.04476350545883179,
0.1158975139260292,
-0.16879431903362274,
-0.2997905910015106,
-0.5208031535148621,
-0.045249368995428085,
0.2496926337480545,
-0.26856011152267456,
0.086426198482513... | |
// {position2} and move all entries
// down the list starting from the | [
-0.39193639159202576,
0.1799650341272354,
0.36316224932670593,
-0.268068790435791,
0.15104688704013824,
0.23567244410514832,
-0.10510584712028503,
0.02724912203848362,
-0.1378273218870163,
-0.5581203699111938,
-0.22181436419487,
0.010095570236444473,
0.025928569957613945,
0.136744752526283... | |
// entry that was at {position2}
//possible uses
POST /list/first/swap/last // swap first with last element
POST /list/42/swap/2 // swap element 42 with element 2
POST /list/first/move/42 | [
-0.3904171884059906,
-0.1038985550403595,
0.19210249185562134,
-0.07177261263132095,
0.20478539168834686,
0.6316789388656616,
-0.025049692019820213,
-0.4727455675601959,
-0.015604349784553051,
-0.7765719890594482,
-0.152507945895195,
0.23048561811447144,
-0.022302614524960518,
-0.319565385... | |
// move first element to position 42
// you get the idea ...
```
What do you think?
Your resource design is perfectly OK for my REST understanding. You could improve your design by taking away the *first* and *last* magic index functionality by introducing a simple rule: If no position is provided the last item is up... | [
-0.07396979629993439,
-0.019299305975437164,
0.4274298846721649,
-0.1339026391506195,
0.26480036973953247,
-0.09304970502853394,
0.006682318169623613,
-0.41261327266693115,
-0.1852661818265915,
-0.7620654106140137,
-0.29315462708473206,
0.4538998007774353,
-0.19440710544586182,
0.083721630... | |
above.
As stated by @miku your items could be a resource of their own. If you plan a more generic resource list design where you need different resource types managed in one list (for example a list could manage tasks, meetings, appointments) the list items could be again references (using a resource url) to the item ... | [
0.26454344391822815,
-0.21961630880832672,
0.2507397532463074,
0.22661496698856354,
-0.07510956376791,
0.10126476734876633,
-0.05337034538388252,
-0.07597598433494568,
-0.369279146194458,
-0.638556718826294,
0.06257935613393784,
0.2374766618013382,
-0.307622492313385,
0.4395122826099396,
... | |
/list/positions/swap/0/2 // swap the position of two elements
POST /list/positions/move/1/0 // move the element at 1 to 0
```
This positions resource could return a (HTTP) status if the operation succeeded or not, a handle to the "operation" resource (via location header) where you could check the status of the... | [
0.13396672904491425,
-0.23988710343837738,
0.23455467820167542,
0.035587724298238754,
0.221199631690979,
0.32801806926727295,
-0.19794324040412903,
-0.4662850797176361,
-0.2754267454147339,
-0.5561963319778442,
-0.03575466200709343,
0.1698601394891739,
-0.2385077178478241,
0.21736082434654... | |
bank accounts as resource. | [
0.07001712173223495,
0.24595995247364044,
-0.1946248710155487,
0.1579897701740265,
0.044040497392416,
0.44013306498527527,
-0.4138213098049164,
0.3328547179698944,
-0.4319321811199188,
-0.46482062339782715,
-0.21889957785606384,
0.5249550342559814,
0.2368062138557434,
0.1788060963153839,
... | |
I am reading some json output... just some integers. The first NSLog outputs things perfectly. In this case there are 3 elements. I don’t understand how to access a specific element I guess.
```
NSMutableArray *json = (NSMutableArray*)[NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
... | [
-0.1474686563014984,
-0.12408050894737244,
0.25596338510513306,
-0.141355499625206,
-0.1590583771467209,
0.00572202680632472,
0.6422855854034424,
-0.29715901613235474,
-0.2706523537635803,
-0.697909414768219,
-0.24256302416324615,
0.47240743041038513,
-0.4963953495025635,
-0.14436036348342... | |
So I'm writing a differential calculator program in python 2.4 (I know it's out of date, it's a school assignment and our sysadmin doesn't believe in updating anything) that accepts a user input in prefix notation (i.e. input = [+ - \* x^2 2x 3x^2 x], equivalent to x^2 + 2x - 3x^2 \* x) and calculates the differential.... | [
-0.15389682352542877,
0.19884468615055084,
0.21276965737342834,
-0.16766898334026337,
-0.24745209515094757,
0.28356266021728516,
0.1568802297115326,
-0.23704306781291962,
0.03716647997498512,
-0.4755207598209381,
0.2717691957950592,
0.5091158151626587,
-0.2959302067756653,
0.00702967355027... | |
documentation on how to read user input in python 2.4. My question is: How do I read in user input in python 2.4, and how do I put that input into a queue? Here is what I am trying:
```
1 formula = input("Enter Formula:")
2
3 operatorQueue=[]
4
5 int i = len(formula)
6
7 for x in formula:
8 if formula[x] == '*'... | [
-0.06294269859790802,
-0.015482960268855095,
0.32847899198532104,
0.006386426277458668,
0.13520731031894684,
0.056409649550914764,
0.21437375247478485,
-0.09896310418844223,
-0.018845999613404274,
-0.6821787357330322,
0.06467235088348389,
0.9747970700263977,
-0.26056742668151855,
-0.514574... | |
appreciated
```
public void doGet(ServletRequest request, ServletResponse response)
```
That should have been HttpServletRequest and HttpServletResponse, just like in doPost.
Always use @Override, that would have told you about this error. | [
0.2856726050376892,
0.10939241945743561,
0.10487674176692963,
0.007157709449529648,
-0.23699219524860382,
-0.224683940410614,
0.5278346538543701,
0.027148770168423653,
-0.00301236636005342,
-0.6584743857383728,
-0.13879092037677765,
0.44131895899772644,
-0.29431986808776855,
-0.14829811453... | |
This one list object is biting me in the butt..
Any time I try to add an element to it, it produces this:
```
Caused by: java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:148)
at java.util.AbstractList.add(AbstractList.java:108)
```
The line producing the error ... | [
-0.04656190797686577,
0.004677836317569017,
0.5696672201156616,
-0.13897983729839325,
0.22282300889492035,
-0.13007178902626038,
0.2604149281978607,
-0.339958131313324,
-0.4829224944114685,
-0.3294835686683655,
-0.08065479248762131,
0.7946066856384277,
-0.5633717179298401,
-0.0523719191551... | |
I am working on a piece of coursework and part of this involves me having to have a working scoreboard in my game, however, I need a way to sort my list of the Score object by score.score. As my Score object contains the players name and also the level they reached.
I am not very experienced in programming and have be... | [
0.11858703941106796,
-0.0023573553189635277,
0.325319766998291,
0.18219755589962006,
0.04742640256881714,
-0.16651567816734314,
0.008602636866271496,
0.206663578748703,
-0.18634313344955444,
-0.424294114112854,
0.49920305609703064,
0.04031188413500786,
0.2572260797023773,
0.145150139927864... | |
to understand for me :(
I'm pulling my hair out here, any help would be great!
In pseudo all I need is:
```
List<Score> scores;
// Load in scores
scores.Sort(//sort by score.actualScore)
```
So that I can add to and remove from the list in the correct places when a new score is added.
```
var ordered = scores.Orde... | [
0.3906635642051697,
0.006159224547445774,
0.5405997633934021,
0.1449451446533203,
0.32115787267684937,
0.15299789607524872,
0.1539129763841629,
-0.27580299973487854,
-0.22517554461956024,
-0.14027772843837738,
0.04116963967680931,
0.562353253364563,
-0.3048061728477478,
0.00001978079308173... | |
I am unable to get **any** dependency from github using rebar.
`rebar.config` file:
```
{sub_dirs, ["rel"]}.
{deps_dir, ["deps"]}.
{erl_opts, [debug_info]}.
{deps, [
{thrift_erl, "0.5.0", {git, "git://github.com/xslogic/thrift_erl", "HEAD"}},
{eleveldb, "1.0.1", {git, "git://github.com/xslogic/eleveldb", "HEAD"}... | [
-0.05865764245390892,
0.23064307868480682,
0.7392181158065796,
-0.045133866369724274,
0.3466108739376068,
0.16399818658828735,
0.329336017370224,
-0.16131171584129333,
0.18945661187171936,
-0.6916282773017883,
-0.4702450931072235,
0.6543983221054077,
-0.1496676653623581,
0.1419100612401962... | |
"HEAD"})
Dependency not available: eleveldb-1.0.1 ({git,
"git://github.com/xslogic/eleveldb", | [
-0.18684139847755432,
0.09001343697309494,
0.693486213684082,
0.050236962735652924,
0.07661118358373642,
-0.12739881873130798,
0.23661155998706818,
-0.022313563153147697,
0.06553198397159576,
-0.4953863024711609,
-0.4360904395580292,
0.5000779628753662,
-0.3961956799030304,
0.2233926951885... | |
"HEAD"})
```
It keeps looking for `DEP_NAME` with a **dash** at the end and can't seem to find it.
How to fix this?
I think that you should use `rebar get-deps` command firstly.
If rebar compile command is error, try `rebar delete-deps`, `rebar clean`.
If still error, switch to the related deps directly, compile th... | [
0.09344029426574707,
0.011397486552596092,
0.41362813115119934,
-0.08870390802621841,
-0.09262222051620483,
-0.024766594171524048,
0.2529512345790863,
-0.09631497412919998,
-0.3112320899963379,
-0.7180947065353394,
-0.17442210018634796,
0.6177812218666077,
-0.2706148028373718,
0.1369100362... | |
I am finding it hard to understand the process of Naive Bayes, and I was wondering if someone could explain it with a simple step by step process in English. I understand it takes comparisons by times occurred as a probability, but I have no idea how the training data is related to the actual dataset.
Please give me a... | [
0.09930572658777237,
0.3153473138809204,
-0.8410411477088928,
0.04567201808094978,
-0.37258392572402954,
0.5883399248123169,
0.14685535430908203,
-0.2180977463722229,
-0.4176969826221466,
-0.40875181555747986,
-0.072196364402771,
0.5253674387931824,
0.12482710927724838,
0.01837065629661083... | |
of the Naive Bayes classifier & part two being the confusion surrounding Training set.
In general all of Machine Learning Algorithms need to be trained for supervised learning tasks like classification, prediction etc. or for unsupervised learning tasks like clustering.
During the training step, the algorithms are t... | [
0.11825147271156311,
-0.13205990195274353,
-0.5168945789337158,
0.1916307806968689,
-0.021158907562494278,
0.1579965204000473,
0.3039788603782654,
-0.27076786756515503,
-0.11206035315990448,
-0.8078916668891907,
-0.1880459040403366,
0.6391935348510742,
-0.3128354251384735,
0.00205892487429... | |
SVM, Bayesian etc. are based upon.
So in a general Machine Learning project basically you have to divide your input set to a Development Set (Training Set + Dev-Test Set) & a Test Set (or Evaluation set). Remember your basic objective would be that your system learns and classifies new inputs which they have never see... | [
0.304189532995224,
-0.08439452946186066,
-0.41296499967575073,
0.5322112441062927,
-0.19278597831726074,
0.1174386739730835,
0.14306677877902985,
-0.31378981471061707,
0.04639424383640289,
-0.6529534459114075,
-0.2802036702632904,
0.5866804718971252,
-0.10386539995670319,
0.111691333353519... | |
a model that simply memorized its input, without learning how to generalize to new examples, would receive misleadingly high scores.
In general, for an example, 70% of our data can be used as training set cases. Also remember to partition the original set into the training and test sets *randomly*.
Now I come to your... | [
0.1538533866405487,
-0.10480326414108276,
-0.22995305061340332,
0.2822830080986023,
-0.13887707889080048,
0.284518837928772,
0.040852684527635574,
-0.3467114269733429,
-0.30849504470825195,
-0.5533270239830017,
-0.24388103187084198,
0.5480027794837952,
-0.20157191157341003,
0.2369389235973... | |
they belong, based on the currently existing objects.
Since there are twice as many `GREEN` objects as `RED`, it is reasonable to believe that a new case (which hasn't been observed yet) is twice as likely to have membership `GREEN` rather than `RED`. In the Bayesian analysis, this belief is known as the prior probabi... | [
-0.00499560683965683,
0.23946860432624817,
-0.07760101556777954,
0.1944855898618698,
-0.15283027291297913,
-0.0012455813121050596,
0.3848103880882263,
-0.32666340470314026,
-0.6050246953964233,
-0.5345640778541565,
-0.4883264899253845,
0.1193428635597229,
-0.127291738986969,
0.399719238281... | |
of RED objects / total number of objects`
Since there is a total of `60` objects, `40` of which are `GREEN` and 20 `RED`, our prior probabilities for class membership are:
**Prior Probability for `GREEN`**: `40 / 60`
**Prior Probability for `RED`**: `20 / 60`
Having formulated our prior probability, we are now read... | [
-0.3271561563014984,
0.08814235776662827,
0.15647728741168976,
0.04843989759683609,
-0.07062936574220657,
0.47022441029548645,
0.08318749815225601,
-0.209244966506958,
-0.3655500113964081,
-0.7339704036712646,
-0.5623900294303894,
0.25250864028930664,
-0.20767974853515625,
0.39217004179954... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.