text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I am trying to build a sample application which will show a proof of concept for synchronizing the time with an RFC 868 compliant time server.
So far, using the Java Socket API, I am able to connect and query the server and do get the response from the server, but it is not in human readable format.
The response I ge... | [
0.3878786861896515,
0.21435858309268951,
0.2168688029050827,
-0.15859355032444,
-0.2018314003944397,
0.28375527262687683,
0.3123708665370941,
-0.3463783264160156,
-0.12403824180364609,
-0.4993778169155121,
-0.079371377825737,
0.3014463186264038,
-0.48495930433273315,
0.2239769995212555,
... | |
mine, I'd like to know if there is any other recommended approach which I should take to achieve this.
Thanks in advance.
This should do what you need...
```
public class Airport
{
public int ID { get; set; }
public string Name { get; set; }
public virtual ICollection<Route> DepartureRoutes { get; set; }
... | [
0.11177420616149902,
0.07399620115756989,
0.7082898020744324,
0.16794919967651367,
0.5585887432098389,
-0.01677205041050911,
-0.10999258607625961,
0.15444010496139526,
-0.09908225387334824,
-0.9472825527191162,
-0.3871626853942871,
0.49771296977996826,
-0.16638816893100739,
0.3083858191967... | |
set; }
public Airport DepartureAirport { get; set; }
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Route>()
.HasKey(i => new { i.DepartureAirportID, i.DestinationAirportID});
modelBuilder.Entity<Route>()
.HasRequired(i => i.DepartureAirport)
... | [
0.013424417935311794,
-0.3048219382762909,
0.9806902408599854,
-0.15277500450611115,
0.4507438838481903,
0.0012902881717309356,
0.17746210098266602,
-0.35274091362953186,
-0.06807059049606323,
-0.9242144823074341,
-0.6102550625801086,
0.5153279900550842,
-0.36235103011131287,
0.26710826158... | |
.HasForeignKey(i => i.DestinationAirportID)
.WillCascadeOnDelete(false);
}
```
...this creates tables like...
```
CREATE TABLE [Airports] (
[ID] [int] NOT NULL IDENTITY,
[Name] [nvarchar](4000),
CONSTRAINT [PK_Airports] PRIMARY KEY ([ID])
)
CREATE TABLE [Routes] (
[DepartureAirportID] [int] N... | [
-0.3543075621128082,
0.0986827164888382,
0.8507953882217407,
0.32347214221954346,
0.3124829828739166,
0.010588941164314747,
-0.19043417274951935,
-0.3521016240119934,
-0.41366684436798096,
-0.9091214537620544,
-0.26065683364868164,
0.1405487209558487,
-0.4825209379196167,
0.262116521596908... | |
you can use it like so...
```
using (var db = new MyDbContext())
{
foreach (var routeid in Enumerable.Range(1, 100))
{
var departure = new Airport { Name = "departure" + routeid };
db.Airports.Add(departure);
var destination = new Airport { Name = "destination" + routeid };
db.... | [
-0.015878470614552498,
-0.2266453057527542,
0.7536630630493164,
-0.22309647500514984,
0.21234607696533203,
-0.0448455847799778,
0.05804196000099182,
-0.3487221300601959,
0.05048121511936188,
-0.8296884894371033,
-0.27514326572418213,
0.3309715688228607,
-0.3624812066555023,
0.2555247545242... | |
db.Routes.Add(route);
}
int recordsAffected = db.SaveChanges();
foreach (var route in db.Routes)
{
Console.WriteLine("{0}, {1}, {2}, {3}", route.DepartureAirportID, route.DestinationAirportID, route.DepartureAirport.Name, route.DestinationAirport.Name);
}
}
```
...hope this helps.
Note: ... | [
-0.023962588980793953,
-0.005790363531559706,
0.5358870029449463,
-0.13729992508888245,
0.064083032310009,
0.09150213748216629,
0.5147823095321655,
-0.3240843713283539,
0.17585156857967377,
-1.0636905431747437,
0.13239775598049164,
0.45093363523483276,
-0.13227497041225433,
0.4084307849407... | |
All, I am new to Windows 7 Phone. My situation is that I have a main page which contains a `ScrollViewer` which in turn houses a `StackPanel`. I want to populate this `StackPanel` with multiple sub-`StackPanel`s (at runtime) which are to hold an Image Thumb nail a hyperlink and some basic information about the image.
... | [
0.1552479863166809,
0.2717278301715851,
0.8435722589492798,
-0.017696993425488472,
0.25795289874076843,
-0.2593139708042145,
0.23768934607505798,
0.13891629874706268,
-0.06702584028244019,
-0.5988407135009766,
-0.022542543709278107,
1.0285085439682007,
-0.22795967757701874,
-0.017121847718... | |
best practice for updating a page's control (like that outlined above) from another page.
Obviously there are a number of ways to pass data between pages
```
PhoneApplicationService.Current.State["yourparam"] = param
NavigationService.Navigate(new Uri("/view/Page.xaml", UriKind.Relative));
```
then in other page si... | [
-0.1788170039653778,
-0.10293904691934586,
0.7591313719749451,
0.23828621208667755,
-0.2051326036453247,
-0.0299230944365263,
0.34473085403442383,
-0.4683992862701416,
-0.29602038860321045,
-0.6105547547340393,
-0.05426729470491409,
0.4141269028186798,
-0.31135284900665283,
-0.319796383380... | |
is not what I am asking.
If I understand your question correctly, you are trying to update a control which is on for example MainPage.xaml from another page for example Page2.xaml.
As far as I know there is no way to reach a pages controls from another page, and that seems unnecessary for the cases that I can think o... | [
0.19208063185214996,
-0.24810491502285004,
0.5672651529312134,
0.42208176851272583,
0.08063142001628876,
-0.1455594003200531,
0.28943610191345215,
0.09916991740465164,
-0.31293967366218567,
-0.5480733513832092,
-0.20685800909996033,
0.2626269459724426,
-0.42229506373405457,
-0.037175714969... | |
onnavigatedto event (or viewmodel constructor if you are using the MVVM pattern), update your control based on the passed parameter.
If your update is based on data then the best practice is to bind an observable collection or an object that extends the INotifyPropertyChanged (basically any object that can signal tha... | [
0.19972744584083557,
-0.6692115664482117,
0.7524383664131165,
0.2889854311943054,
0.11407685279846191,
-0.11923722922801971,
0.12248516082763672,
-0.06772005558013916,
-0.3416953980922699,
-0.691818118095398,
-0.11866894364356995,
0.5026252269744873,
-0.5040198564529419,
0.0861861407756805... | |
can make the page that you are showing in the popup a usercontrol, and reach to the parent's controls by this.Parent.
I can be more helpful if you give more specifics about your app's flow. | [
0.4668493866920471,
-0.13256436586380005,
0.3832763433456421,
0.37745949625968933,
-0.07038404792547226,
-0.24194833636283875,
0.17224560678005219,
0.3256939649581909,
-0.114482082426548,
-1.0343738794326782,
-0.015602311119437218,
0.32588332891464233,
0.11328302323818207,
0.16279137134552... | |
I want to use a single font named "Algerian" across my whole website. So, I need to change all HTML tags and I don't want to write different code for different tags like:
```
button{font-family:Algerian;}
div{font-family:Algerian;}
```
The method written below is also highly discouraged:
```
div,button,span,strong... | [
0.30821385979652405,
0.446992963552475,
0.19163045287132263,
-0.2103651612997055,
-0.12468846142292023,
-0.18820133805274963,
0.43078407645225525,
-0.19606316089630127,
-0.10049493610858917,
-0.6928033232688904,
-0.14793816208839417,
0.571608304977417,
-0.6366487741470337,
0.15712270140647... | |
I worked on MDM in Android, and used the API's to lock, wipe etc when I receive a C2DM push message from the server.
When I was trying to explore more on the iOS part of it, I was a bit confused. I got a feeling that, we don't need to code a agent for the MDM to work on iPhone.
So is it completely managed from the s... | [
0.05378279834985733,
-0.0840979591012001,
0.3085276782512665,
-0.11069142818450928,
-0.00421363627538085,
0.03335059434175491,
0.46712544560432434,
0.04170239344239235,
-0.2870950698852539,
-0.4909071624279022,
0.023043440654873848,
0.54252690076828,
-0.5246029496192932,
-0.175163909792900... | |
to look at profile management as sent out from Mac OS X Lion Server (they added this into this OS version) or a third-party solution (MobileIron, Tarmac, etc). There is some good background, slightly dated information here too: [How to configure/install MDM server for iPhone and iPad](https://stackoverflow.com/question... | [
0.02518349513411522,
-0.1855199933052063,
0.5017080903053284,
-0.15640844404697418,
-0.08492472022771835,
-0.08279480040073395,
0.4674225151538849,
-0.2078205645084381,
-0.2935023307800293,
-0.7102850675582886,
-0.11551305651664734,
0.5389379858970642,
-0.3693069815635681,
-0.3889764547348... | |
Is it possible an usual code to damage call stack in c/c++?
I don't mean a kind of hack or something, just an oversight mistake or something, but not random, such that damages it every time.
Someone told me that an ex colleague managed but I don't think it is possible.
Does someone have such an experience?
You can use ... | [
0.4150627553462982,
0.18923301994800568,
0.3173352777957916,
0.15087375044822693,
-0.04098328948020935,
-0.4216810166835785,
0.39248380064964294,
-0.5448377132415771,
-0.37098750472068787,
-0.14925703406333923,
-0.07149515300989151,
0.6813372373580933,
-0.2203684151172638,
-0.1043176203966... | |
if the browser doesn't support MP4 files -->
<source src="http://media.w3.org/2010/07/bunny/04-Death_Becomes_Fur.oga"
type='audio/ogg; codecs=vorbis'>
<!-- The next line will only be executed if the browser doesn't support the <audio> tag-->
<p>Your user agent does not support the HTML5 Audio element.</p>
<... | [
0.14337095618247986,
0.07054732739925385,
0.2940210700035095,
0.12995311617851257,
-0.15281186997890472,
-0.5091290473937988,
0.4925326406955719,
-0.1561061143875122,
-0.34416377544403076,
-0.2849002182483673,
-0.33724066615104675,
0.6799725890159607,
-0.3432447016239166,
0.224837198853492... | |
As mentioned in another answer's comment, you are using XHTML 1.0 Transitional. You might be able to get `<audio>` to work with some hack.
---
**UPDATE 2:** I just remembered another way to do play audio. This **will** work in XHTML!!! This is fully standards-compliant.
You use this **JavaScript**:
```
var aud = do... | [
0.1451530009508133,
-0.19382362067699432,
0.8006899356842041,
0.06857358664274216,
-0.1000988632440567,
-0.34480994939804077,
0.25477612018585205,
-0.49503782391548157,
-0.20429036021232605,
-0.7948206067085266,
-0.297123521566391,
0.7338210940361023,
-0.3638002574443817,
-0.22368513047695... | |
```
$result=mysql_query("SELECT * FROM $name WHERE date='$date'");
```
How to check whether anything selected or not.
i have tried these but of no use :
`if($result == NULL ){}` , `if(!$result){}`
Help !
You can use
```
mysql_num_rows ($result);
```
to get the number of rows returned
```
if(!$result)
```
Wi... | [
0.057896025478839874,
0.22677181661128998,
0.2722802758216858,
-0.018833190202713013,
0.10439134389162064,
-0.026109598577022552,
0.36588388681411743,
-0.19812160730361938,
-0.34082168340682983,
-0.4236897826194763,
-0.16277579963207245,
0.503711462020874,
-0.16544927656650543,
0.239083722... | |
I'm trying to check if an object can cast to a certain type using `IsAssignableFrom`. However I'm not getting the expected results... **Am i missing something here?**
```
//Works (= casts object)
(SomeDerivedType)factory.GetDerivedObject();
//Fails (= returns false)
typeof(SomeDerivedType).IsAssignableFrom(factory.G... | [
0.3590232729911804,
0.26015785336494446,
0.1767330914735794,
-0.2214394211769104,
0.03348811715841293,
-0.0965593233704567,
0.5062627196311951,
-0.38602760434150696,
-0.08893299102783203,
-0.5823689699172974,
0.06678427010774612,
0.581836998462677,
-0.2087181955575943,
0.17868760228157043,... | |
class D : B {}
```
then
```
typeof(B).IsAssignableFrom(typeof(D)) // true
typeof(D).IsAssignableFrom(typeof(B)) // false
```
I think you are trying the 2nd form, it's not totally clear.
The simplest answer might be to test:
```
(factory.GetDerivedObject() as SomeDerivedType) != null
```
---
After the ... | [
0.06080179288983345,
-0.010662553831934929,
0.012302607297897339,
-0.11736199259757996,
0.1521752029657364,
-0.22850832343101501,
0.1657707691192627,
-0.11608625203371048,
0.003620690433308482,
-0.3589439392089844,
-0.3127523362636566,
0.5388296246528625,
-0.3936329185962677,
0.17305175960... | |
I have seen in some source code (by other developers) something like this:
```
#import "SomeClass+SomeOtherClass.h"
```
What is the `+` for? What does this mean?
I believe your problem is that you are using a [SQL Server reserved word ("Size")](http://msdn.microsoft.com/en-us/library/aa238507%28v=sql.80%29.aspx) an... | [
0.19135746359825134,
0.24748754501342773,
0.3474079370498657,
-0.0996692031621933,
-0.017400270327925682,
-0.018900083377957344,
0.1967642456293106,
0.041899167001247406,
-0.23493175208568573,
-0.3668988347053528,
-0.08609741926193237,
0.36880016326904297,
-0.3925771713256836,
0.0883384943... | |
any product is very poor database design and will continue to cause you problems and/or extra work. Better to fix it sooner than later. | [
0.4248616099357605,
0.33877068758010864,
0.14417286217212677,
0.4198835492134094,
0.1624385118484497,
-0.2929060161113739,
0.13311819732189178,
0.6649560332298279,
0.04277661070227623,
-0.4840049147605896,
-0.12672710418701172,
0.25174736976623535,
-0.15171484649181366,
0.19772133231163025... | |
I use the devise's authenticate\_user! method in a controller. This is working fine when the auth\_token provided in the request is the correct one but if the authentication fails, I end up with:
```
curl -XGET 'http://localhost:3000/my_obj?auth_token=wrongtoken'
<html><body>You are being <a href="http://localhost:30... | [
-0.17200982570648193,
-0.15668745338916779,
0.5720112323760986,
-0.021649548783898354,
-0.20587222278118134,
-0.03919997811317444,
0.3354613780975342,
-0.37969428300857544,
-0.20779003202915192,
-0.8221251964569092,
0.011146214790642262,
0.4593982696533203,
-0.20014594495296478,
0.14272776... | |
:user_needed, :if => { request.format == :json }
def user_needed
unless current_user
render :json => {'error' => 'authentication error'}, :status => 401
end
end
end
```
An other way, can be cleaner is to define your own FailureApp ( <https://github.com/plataformatec/devise/blob/master/lib/devise/fa... | [
0.08055742084980011,
0.16906295716762543,
0.6871466636657715,
-0.17115247249603271,
-0.07158561050891876,
0.239081472158432,
0.5525923371315002,
-0.4390711486339569,
0.08221051096916199,
-0.5236696600914001,
-0.02112390287220478,
0.6380967497825623,
-0.32926657795906067,
0.370964914560318,... | |
'application/json'
self.response_body = "{'error' : 'authentication error'}"
end
end
```
In your Devise config file add :
```
config.warden do |manager|
manager.failure_app = MyFailureApp
end
``` | [
-0.04415462538599968,
0.20610494911670685,
0.6929143667221069,
-0.11170036345720291,
0.5650654435157776,
-0.19616666436195374,
0.5732381939888,
-0.43452441692352295,
0.09481579810380936,
-0.5449952483177185,
-0.3473127782344818,
0.4712288975715637,
-0.35911619663238525,
0.14662382006645203... | |
I use my first query to get the id and name of the user like this:
```
select id,name from temp_card where sex='$sex' and city='$city' order by name ASC
```
Then I have a second query that uses the results from the first, and gets more data from another table:
```
select images from temp_card_images where temp_card... | [
0.5715469717979431,
0.0023636764381080866,
0.573229968547821,
0.23361511528491974,
-0.2677931487560272,
0.0007978443754836917,
-0.03546373173594475,
-0.30499547719955444,
-0.26971739530563354,
-0.7440270781517029,
0.03998321667313576,
0.3941425383090973,
-0.6511145830154419,
0.199067443609... | |
INNER JOIN temp_card_images tci ON tc.id=tci.temp_card_id
WHERE sex='$sex'
AND city='$city'
GROUP BY tc.id
ORDER BY name ASC
``` | [
0.14886756241321564,
0.015370548702776432,
0.6873538494110107,
0.18124546110630035,
-0.1041637435555458,
0.12727674841880798,
0.08249745517969131,
-0.17549310624599457,
-0.09108584374189377,
-0.6341475248336792,
-0.11913842707872391,
0.30418503284454346,
-0.25411587953567505,
0.06114232912... | |
After the first launch of my app i want to show the user a little tutorial, to explain the functionality of my app.
So i need to set a transpalent UIImageView with some arrow and labels, where the main UI(more specificly,tableviewcontroller in navigationviewcontroller in a tabbarcontroler) is stil visible behind the t... | [
-0.11562643945217133,
-0.3914591670036316,
0.9239529967308044,
0.2675454318523407,
-0.16409440338611603,
0.2453022599220276,
0.02982207015156746,
-0.12017743289470673,
-0.19317065179347992,
-0.7303604483604431,
0.25810983777046204,
0.35629960894584656,
-0.17153149843215942,
0.0857377648353... | |
roe in table,pushes the buttons.
```
-(void)nextTap:(UIGestureRecognizer*)nextTap
{
//Show another image
}
-(void)showTutorial
{
NSLog(@"Show tutorial");
UIImageView *tutorialImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"BG"]];
[self.navigationController.tabBarController.view addSu... | [
0.12652938067913055,
-0.032217711210250854,
0.9995489120483398,
-0.33703693747520447,
0.2361050397157669,
-0.011387930251657963,
0.4725973308086395,
-0.5551724433898926,
-0.31957942247390747,
-0.4891149401664734,
-0.12944667041301727,
1.1358537673950195,
-0.014012687839567661,
-0.354265034... | |
I'm having an issue at design time with all my forms and custom controls within Visual Studios 2008. Up until the previous check in, all of the controls were rendering as expected. The only main difference between the current version and the previous working version was that a Property on the control `UIText` was renam... | [
0.18925708532333374,
0.12407196313142776,
0.8119384050369263,
-0.18152792751789093,
-0.2051807940006256,
0.09778936952352524,
0.26966679096221924,
-0.18221543729305267,
0.034568727016448975,
-0.7825471758842468,
0.028887039050459862,
0.56983882188797,
-0.2858927547931671,
0.247492790222167... | |
with the name of the control (however they all render correctly at run time):

I've tried creating a brand new form in my project, creating a brand new custom control with just a label on it, and I've still got exactly the same problem:
.
UPDATE - Issue traced, can't explain it
---------------------------------------
I *fixed* the issue. Well, fixed isn't really the right word for it. I located the issue by removing all of the user controls 1 at... | [
0.23839686810970306,
0.05041394382715225,
0.5793433785438538,
0.20837897062301636,
-0.013565273024141788,
0.06548304110765457,
0.042032159864902496,
0.15993435680866241,
-0.4820065200328827,
-0.496066153049469,
0.21823233366012573,
0.28219884634017944,
-0.3768254220485687,
0.16216953098773... | |
- References iVirtualDocket.CodeLibrary
iVirtualDocket.UIControls
-References iVirtualDocket.CodeLibrary
```
The signature has a property called `SignatureData`, which was doing this:
```
public byte[] SignatureData
{
get
{
if (_signature == null)
{
return null;
}
... | [
0.24873220920562744,
0.18456529080867767,
0.5425435304641724,
0.135625958442688,
0.18852390348911285,
-0.2947031557559967,
0.3324970602989197,
-0.17577771842479706,
-0.2807052731513977,
-0.5160506367683411,
-0.05064694210886955,
0.3182593584060669,
-0.24083556234836578,
0.23367026448249817... | |
return iVirtualDocket.CodeLibrary.Conversions.ImageToByteArray(
_signature, ImageFormat.Png);
}
}
}
```
ImageToByteArray looks like the following:
```
public static byte[] ImageToByteArray(Image imageToConvert,
ImageFormat formatOfImage)
{
byte[] ret;
using (MemoryStream m... | [
-0.0076577067375183105,
-0.1990710198879242,
0.9887430667877197,
-0.3667033016681671,
0.1474490910768509,
0.19796788692474365,
0.21205271780490875,
-0.26071780920028687,
-0.34741610288619995,
-0.7376847267150879,
-0.2707546055316925,
0.7353251576423645,
-0.4148922562599182,
0.1710012853145... | |
the `UIControls` project, then everything works fine. However, as soon as I put the method back into the `CodeLibrary` project and call it there, all my forms stop rendering UserControls.
So doing the following fixes the problem, but I'd really like to know why:
```
public byte[] SignatureData
{
get
{
... | [
0.16070039570331573,
0.013448893092572689,
0.6705055832862854,
-0.13857606053352356,
0.04931491240859032,
-0.31348535418510437,
0.544177234172821,
0.01952299289405346,
-0.33880481123924255,
-0.7612696290016174,
-0.0468100942671299,
0.5374740958213806,
-0.31950271129608154,
0.20745706558227... | |
else
{
// Need to call this code directly here instead of through
// the CodeLibrary conversions, otherwise all user controls stop
// rendering in design mode
byte[] ret;
using (MemoryStream ms = new MemoryStream()) | [
-0.11660685390233994,
0.009620459750294685,
0.6164449453353882,
-0.24042180180549622,
0.40923985838890076,
0.24532490968704224,
0.5283520817756653,
-0.20662499964237213,
-0.07337097823619843,
-0.8080695271492004,
-0.23968379199504852,
0.6853581666946411,
-0.22433756291866302,
0.08024633675... | |
{
_signature.Save(ms, ImageFormat.Png);
ret = ms.ToArray();
}
return ret;
}
}
}
```
*(What's even more bizarre is that I don't even use this property yet.)*
We have an application that had | [
0.31315070390701294,
-0.23103150725364685,
0.65614914894104,
-0.07206317782402039,
0.214880108833313,
-0.15711237490177155,
0.3885059952735901,
0.007922697812318802,
-0.5054990649223328,
-0.7278143763542175,
-0.01776840351521969,
0.4108337461948395,
-0.17863395810127258,
0.3026466369628906... | |
similar non-design-time display problems. By doing some research (and I don't remember exactly where we found it), we ended up creating a file
DesignTimeAttributes.xmta
Its type is that of "Design-Time Attribute File"
and in it, we just had to declare each of the control classes we had defined and qualified it as "D... | [
0.11463365703821182,
-0.0955340713262558,
0.48638463020324707,
0.16862326860427856,
0.19694963097572327,
-0.11489337682723999,
0.06322726607322693,
-0.14934995770454407,
0.05510362237691879,
-0.6259464025497437,
-0.06592213362455368,
0.4734583795070648,
-0.27647876739501953,
0.007706224452... | |
encoding="utf-16"?>
<Classes xmlns="http://schemas.microsoft.com/VisualStudio/2004/03/SmartDevices/XMTA.xsd">
<Class Name="MyNamespace.MyControl">
<DesktopCompatible>true</DesktopCompatible>
</Class>
<Class Name="MyNamespace.MyOtherControl">
<DesktopCompatible>true</DesktopCompatible>
</Class>
<Clas... | [
-0.10154613107442856,
-0.08896750211715698,
0.7490774393081665,
0.17104293406009674,
0.09799044579267502,
0.06886261701583862,
-0.08743725717067719,
-0.27836477756500244,
-0.20165349543094635,
-0.7717176675796509,
-0.06410574167966843,
0.4846334457397461,
-0.2858738601207733,
0.00023380843... | |
System.ComponentModel.LicenseUsageMode.Designtime;
}
public static bool IsRunTime()
{
return System.ComponentModel.LicenseManager.UsageMode ==
System.ComponentModel.LicenseUsageMode.Runtime;
}
```
and call them respectively in the constructors... | [
0.005808927584439516,
-0.3437533974647522,
0.5315884351730347,
-0.020175660029053688,
0.11938617378473282,
-0.034256335347890854,
0.23276206851005554,
-0.32593801617622375,
-0.11513446271419525,
-0.3674742579460144,
-0.4638347923755646,
0.7545197010040283,
-0.5240315794944763,
0.3168711066... | |
The following code outputs **`1970-01-01`** which is wrong.
```
<?php
$dob='17 Jan 1900';
$datetime = strtotime($dob);
$dob = date("Y-m-d", $datetime);
echo $dob;
?>
```
However it works fine with **`$dob = '17 Jan 2000';`**
If your PHP version allow it consider Using [DateTime](http://www.php.net/manual/en/class.da... | [
-0.12660154700279236,
0.03033486381173134,
0.4541246294975281,
-0.367718368768692,
0.043915558606386185,
0.029864635318517685,
0.25730931758880615,
-0.33320698142051697,
-0.31436029076576233,
-0.2631774842739105,
-0.08309941738843918,
0.16629618406295776,
-0.3470641076564789,
0.25643926858... | |
I have a log table containing user ids, ip addresses and log in datetimes. I need to find out who are the users who pretend to be other users by setting up multiple accounts.
This is my sample log table:
```
+---------+-------------+---------------------+
| user id | ip address | log in datetime |
+---------+---... | [
0.10186349600553513,
0.33446401357650757,
0.7710004448890686,
-0.022981371730566025,
0.29712390899658203,
0.15200673043727875,
0.3700655996799469,
-0.12165696173906326,
-0.021142637357115746,
-0.4700934588909149,
0.1515970677137375,
0.5643616318702698,
0.027165444567799568,
0.1176128163933... | |
2012-04-01 00:09:00 |
+---------+-------------+---------------------+
| 3 | 192.168.1.3 | 2012-04-01 00:15:00 |
+---------+-------------+---------------------+
| 8 | 192.168.1.5 | 2012-04-01 00:22:00 |
+---------+-------------+---------------------+
| 9 | 192.168.1.1 | 2012-04-01 00:26:00 |
+---------... | [
-0.19212955236434937,
0.2303459495306015,
0.641942024230957,
0.22452890872955322,
0.07491757720708847,
0.6625112295150757,
0.4144098162651062,
-0.4272770881652832,
-0.08353269845247269,
-0.44191256165504456,
-0.24341410398483276,
0.7162763476371765,
0.1950884908437729,
-0.01074259262531995... | |
2012-04-01 00:45:00 |
+---------+-------------+---------------------+
```
So, here is my question: how to select a list of user ids having the same ip address and with log in time difference of less than 5 minutes?
If your PHP version allow it consider Using [DateTime](http://www.php.net/manual/en/class.datetime.php)... | [
0.040165893733501434,
-0.007831714116036892,
0.5685677528381348,
-0.00880630873143673,
0.007808303460478783,
-0.1586882472038269,
0.2399565428495407,
-0.5579177737236023,
-0.15634839236736298,
-0.48637986183166504,
0.01657320000231266,
0.17110687494277954,
-0.08265930414199829,
0.189234867... | |
I am using ksoap2-Android for making and parsing my requests. How ever if i want to use it i have to do it asynchronous. So i choose to create a new Thread for that.
It looks something like that, i don't post all my logic request and parsing because int this case it isn't important.
```
new Thread(new Runnable() ... | [
0.36314356327056885,
0.025189366191625595,
0.45066139101982117,
-0.0039059901610016823,
0.40042802691459656,
-0.19927601516246796,
0.6095067262649536,
-0.06536144018173218,
-0.20769330859184265,
-0.8782262206077576,
-0.11352648586034775,
0.7300903797149658,
-0.5455867648124695,
0.566379487... | |
try{
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace(); | [
0.07225184142589569,
-0.34894290566444397,
-0.013300545513629913,
-0.17909279465675354,
0.39282363653182983,
-0.203731507062912,
0.47350555658340454,
-0.37683814764022827,
0.027825651690363884,
-0.33482712507247925,
-0.2533208131790161,
0.43174511194229126,
-0.5290886163711548,
-0.05964580... | |
}
}
}).start();
```
So i get request in **answer** string, but now how to update my GUI ? When i try i get exception that i can't update in that thread.
Please post your solutions to this. If you used Handler or AsyncTask or even make to work with my example.
Thanks.
Two ways I can think of:
... | [
0.08796874433755875,
0.0131416330114007,
0.22544579207897186,
-0.21257007122039795,
0.04443325102329254,
-0.21945777535438538,
0.42931655049324036,
0.18820837140083313,
-0.06427308171987534,
-1.0584547519683838,
-0.20578235387802124,
0.6450678110122681,
-0.40547457337379456,
0.176974207162... | |
./myhugeprogram.py"
```
* set the environment variable in your [`.bashrc`](http://en.wikipedia.org/wiki/Bash_%28Unix_shell%29#Startup_scripts) file. | [
0.15420827269554138,
0.3206104040145874,
0.21144576370716095,
-0.21087905764579773,
0.35007238388061523,
-0.021846136078238487,
0.3043121099472046,
0.011853868141770363,
-0.2168896347284317,
-0.5940500497817993,
-0.36348024010658264,
0.580491840839386,
-0.43247050046920776,
0.0491880178451... | |
I have a grid, with checkcolumn. It's dataIndex is, for example, 'checked'.
I want to disable or hide checkboxes for some rows, where another value, 'can\_be\_checked' for example, is false/empty.
Renderer is already defined in checkcolumn, messing with it breaks generation of checkbox.
How can I do it?
You may hide... | [
0.3223884701728821,
-0.018639760091900826,
0.3036479651927948,
-0.22811326384544373,
0.0426657497882843,
-0.021672526374459267,
0.2495388388633728,
-0.2468051165342331,
0.12409341335296631,
-0.8220939040184021,
0.0491642989218235,
0.5413554906845093,
-0.2860628068447113,
0.1265662461519241... | |
This is the fragment of code inserted with ajax:
```
<form>
<label for = "task-name">Name</label>
<input type = "text" id = "task-name" />
<label for = "task-description">Description</label>
<input type = "text" id = "task-description" />
<input type = "hidden" id = "task-col" />
<input type ... | [
-0.44867926836013794,
-0.22850002348423004,
0.2551146447658539,
-0.19749078154563904,
-0.18705545365810394,
0.05429231375455856,
-0.17419451475143433,
-0.33546188473701477,
-0.14742712676525116,
-0.6290136575698853,
-0.41286101937294006,
0.47637465596199036,
-0.009702430106699467,
-0.13973... | |
= $(this).parent().parent().attr('class').split("-");
ajaxObj = getXmlHttpObject();
ajaxObj.onreadystatechange = function(){
if(ajaxObj.readyState == 4 && ajaxObj.status == 200){
$('#pop-hold').html(ajaxObj.responseText);
$('#task-col').val(pos[0]);
$('#task-row').val... | [
0.06969425082206726,
-0.29948440194129944,
0.7502682209014893,
-0.199059396982193,
-0.05543508753180504,
0.02034670114517212,
0.30082398653030396,
-0.11510742455720901,
-0.2080138623714447,
-0.5882716178894043,
-0.5476190447807312,
0.5590821504592896,
-0.42606574296951294,
-0.1109482720494... | |
values to the hidden inputs `#task-row` and `#task-col` from the content added dynamically.
The page is properly displayed and no error is thrown but those two fields are never accessed. How can I solve this?
Try extending this [example](http://jsfiddle.net/AHPaY/6/)
jQuery:
```
$(function () {
$("#input").keydown... | [
-0.16670063138008118,
-0.07429578900337219,
0.6703096032142639,
-0.27132001519203186,
-0.037092141807079315,
0.04355580359697342,
0.3710809350013733,
-0.29012754559516907,
-0.18641799688339233,
-0.5261524319648743,
-0.35356441140174866,
0.7980036735534668,
-0.12424392998218536,
-0.13900645... | |
I want to give option to upload multiple files and then download it. I am creating link buttons Dynamically like:
```
private void AddLinkButtons()
{
string[] fileNames = (string[])Session["fileNames"];
string[] fileUrls = (string[])Session["fileUrls"];
if (fileNames != null)
{
for (int i = 0... | [
0.33567285537719727,
-0.32265031337738037,
0.6963118314743042,
-0.4004591405391693,
-0.03677762299776077,
0.15862607955932617,
0.15299440920352936,
-0.3443050682544708,
-0.3225707709789276,
-0.5949190855026245,
-0.13783445954322815,
0.7149274945259094,
-0.6800424456596375,
0.32798027992248... | |
phLinkButtons.Controls.Add(lb);
lb.Text = fileNames[i];
lb.CommandName = "url";
lb.CommandArgument = fileUrls[i];
lb.ID = "lbFile" + i;
//lb.Click +=this.DownloadFile;
lb.Attributes.Add("runat", "server");
lb.Click += | [
0.34340807795524597,
-0.12760674953460693,
0.8135212659835815,
-0.13125449419021606,
0.13864196836948395,
0.21065549552440643,
-0.19933593273162842,
-0.3376443088054657,
-0.17535638809204102,
-0.4753760099411011,
-0.33602145314216614,
0.48859602212905884,
-0.7126690745353699,
0.15020939707... | |
new EventHandler(this.DownloadFile);
////lb.Command += new CommandEventHandler(DownloadFile);
phLinkButtons.Controls.Add(lb);
phLinkButtons.Controls.Add(new LiteralControl("<br>"));
}
}
```
And my DownloadFile event is:
```
protected void DownloadFile(object sender, ... | [
-0.14734311401844025,
-0.3832132816314697,
0.815595269203186,
-0.12021130323410034,
0.253368079662323,
0.08691557496786118,
-0.0004168430168647319,
-0.2923448383808136,
-0.401323139667511,
-0.7007921934127808,
-0.6055365204811096,
0.808814525604248,
-0.23640760779380798,
0.1409226357936859... | |
try
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
... | [
-0.13395002484321594,
-0.3464723527431488,
0.7721951007843018,
-0.31661298871040344,
0.2476375848054886,
0.2541349530220032,
0.42533087730407715,
-0.36478322744369507,
0.02920989878475666,
-0.5383133888244629,
-0.7776820063591003,
0.41318291425704956,
-0.3509350121021271,
0.133632436394691... | |
catch (Exception ex)
{
}
}
else
{
Response.Write("This file does not exist.");
}
}
```
I am getting link buttons on screen but DownloadFile event is never called after clicking. i tried all options that are commented, but its not working. What is wrong in code?
Where and when ... | [
0.18168608844280243,
-0.16022230684757233,
0.7107760906219482,
-0.21009555459022522,
-0.008592215366661549,
-0.2393718957901001,
0.4583096206188202,
0.09404910355806351,
-0.2614050507545471,
-0.5881232619285583,
-0.10240538418292999,
0.6005309224128723,
-0.45349830389022827,
0.115702725946... | |
logic of your page, your OnInit should look like this
```
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
AddLinkButtons();
}
``` | [
-0.2601042687892914,
-0.3963299095630646,
0.550422191619873,
-0.04426168277859688,
0.5034977793693542,
-0.057352256029844284,
0.4079485535621643,
-0.09426339715719223,
-0.09658075869083405,
-0.6358794569969177,
-0.4742467701435089,
0.7206773161888123,
-0.5236513614654541,
-0.02921292372047... | |
I have a small piece of code that I use to keep track of time - very simply it takes a picture of my desktop every four minutes so that later I can go back over what I've been up to during the day - It works great, except when I connect to an external monitor - this code only takes a screen shot of my laptop screen, no... | [
0.4937487542629242,
0.16809627413749695,
0.44861218333244324,
-0.12346918135881424,
-0.16906143724918365,
0.4439146816730499,
0.23793010413646698,
-0.12086700648069382,
-0.049377135932445526,
-1.226448655128479,
-0.018002787604928017,
0.7045203447341919,
-0.44626563787460327,
0.05889029800... | |
{
public static void main(String args[]) throws
AWTException, IOException {
// capture the whole screen
int i=1000;
while(true){
i++;
BufferedImage screencapture = new Robot().createScreenCapture(
new Rectangle(Toolkit.getDefaultToolkit().getS... | [
0.3407909572124481,
-0.3679512143135071,
0.5019206404685974,
-0.2324690967798233,
0.05788000300526619,
0.3566802144050598,
0.3212384283542633,
-0.1894676685333252,
-0.04061490669846535,
-0.7893283367156982,
-0.09707130491733551,
0.38587531447410583,
-0.3601808249950409,
0.1801721155643463,... | |
// Save as JPEG
File file = new File("screencapture"+i+".jpg");
ImageIO.write(screencapture, "jpg", file);
try{
Thread.sleep(60*4*1000);
}
catch(Exception e){
e.printStackTrace();
}
}
}
}
```
Following the solution given, I made some improvements and the code, for ... | [
0.09524524956941605,
-0.05955778807401657,
0.4238520860671997,
-0.3012557923793793,
0.06982375681400299,
0.08787074685096741,
0.3701635003089905,
-0.3755840063095093,
-0.507188081741333,
-0.7294548153877258,
-0.13983257114887238,
0.510855495929718,
-0.054315973073244095,
0.0370292477309703... | |
shows how to do it.
Basically you have to iterate all screens:
```
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] screens = ge.getScreenDevices();
for (GraphicsDevice screen : screens) {
Robot robotForScreen = new Robot(screen);
...
``` | [
-0.06117618829011917,
-0.039362359791994095,
0.8256046175956726,
-0.05884499102830887,
-0.22998583316802979,
0.04007205367088318,
0.11111295968294144,
-0.27408143877983093,
-0.2392817884683609,
-1.2191826105117798,
-0.09597807377576828,
0.7351048588752747,
-0.19203989207744598,
-0.04100869... | |
I'm researching on how to add a *shortcut* in the windows context menu to my application. I came across [this](http://www.codeproject.com/Articles/10104/Add-a-context-menu-to-the-Windows-Explorer) article and I tried it out. This is the code it uses to create a key in the registry.
```
private void btnAddMenu_Click(ob... | [
-0.039897773414850235,
-0.04432518780231476,
0.4103471040725708,
-0.24437256157398224,
0.3215492069721222,
0.044576141983270645,
0.6708430051803589,
-0.5238056778907776,
-0.1701880246400833,
-0.5961265563964844,
-0.4435476064682007,
0.6598127484321594,
-0.2654872536659241,
0.31462407112121... | |
regcmd = Registry.ClassesRoot.CreateSubKey(Command);
if(regcmd != null)
regcmd.SetValue("",this.txtPath.Text);
}
catch(Exception ex)
{
MessageBox.Show(this,ex.ToString());
}
finally
{
if(regmenu != null)
regmenu.Close(); | [
-0.10748813301324844,
-0.13072045147418976,
0.7822317481040955,
-0.4370080232620239,
0.23096467554569244,
0.011703869327902794,
0.5172548890113831,
-0.47346043586730957,
-0.18849512934684753,
-0.3421495258808136,
-0.5799469351768494,
0.560235857963562,
-0.407548725605011,
0.198757007718086... | |
if(regcmd != null)
regcmd.Close();
}
}
```
The problem is if I run it through my Administrator account, it works fine. But when I do it through a different account which doesn't have admin privileges, it throws this exception.
```
system.unauthorizedaccessexception access to the registry key ... | [
0.1979629397392273,
0.28622671961784363,
0.4197312891483307,
-0.12775470316410065,
0.3368937373161316,
-0.27086853981018066,
0.4987901747226715,
-0.009079664945602417,
-0.17110775411128998,
-0.6425459384918213,
-0.03486782684922218,
0.699747622013092,
-0.32618027925491333,
0.41424334049224... | |
Administrator, right?
Is there any way in C# to *escalate* the user privileges when creating the registry key?
If you know any other way to add an item to the windows context menu, I'd be interested in them too.
Thank you.
There is a tutorial [Java multi-monitor screenshots](http://whileonefork.blogspot.co.uk/2011/0... | [
-0.0369943231344223,
-0.18105211853981018,
0.46387726068496704,
0.07129218429327011,
-0.2957655191421509,
-0.1049146056175232,
0.20026163756847382,
-0.26137739419937134,
-0.5289655923843384,
-1.1006947755813599,
-0.09804421663284302,
0.8534308671951294,
-0.18250598013401031,
0.209558352828... | |
How to search value in multidimensional array,
for example I want to search `example` keyword in the following data in mongodb
I used to fetch all data from command
`>db.info.find()`
```
{
"_id" : ObjectId("4f74737cc3a51043d26f4b90"),
"id" : "12345",
"info" : [
{
"sno" : 1,... | [
-0.15399135649204254,
0.06800039112567902,
0.4022488594055176,
0.11214333772659302,
0.3412454128265381,
-0.08935654163360596,
0.1576765477657318,
-0.3255443274974823,
-0.13243424892425537,
-0.8766360878944397,
-0.12735550105571747,
0.7677161693572998,
-0.15198712050914764,
-0.1594340950250... | |
"ABC",
"email" : "abc@example.com"
},
{
"sno" : 2,
"name" : "XYZ", | [
0.35797592997550964,
0.3264561593532562,
0.0032803339418023825,
0.08804651349782944,
0.16047802567481995,
0.2704279124736786,
0.06358186900615692,
0.23552341759204865,
-0.24301393330097198,
-0.447383850812912,
-0.27465584874153137,
0.3420349657535553,
-0.5992968082427979,
0.181585177779197... | |
"email" : "xyz@example.com"
},
{
"sno" : 3,
"name" : "XYZ", | [
0.15719494223594666,
0.3014378845691681,
-0.01072800625115633,
0.2070498764514923,
0.19303272664546967,
0.3406882584095001,
0.03420295938849449,
0.5490468740463257,
-0.21162104606628418,
-0.5283816456794739,
-0.3248676061630249,
0.25466102361679077,
-0.3915465474128723,
-0.0041013252921402... | |
"email" : "xyz@demo.com"
},
{
"sno" : 4,
"name" : "ABC",
"email" : "abc@demo.com" | [
0.49511998891830444,
0.29664257168769836,
-0.4339887201786041,
0.21225273609161377,
0.37730681896209717,
0.07453864067792892,
-0.12185315042734146,
0.08023843169212341,
-0.2285478264093399,
-0.5478808283805847,
-0.30658358335494995,
0.545060396194458,
-0.27076926827430725,
0.14318932592868... | |
},
{
"sno" : 5,
"name" : "Rohan",
"email" : "rohan@example.com"
}
]
}
```
Now, to | [
0.642634928226471,
0.13187521696090698,
0.14443457126617432,
-0.11884254217147827,
-0.03406919166445732,
-0.041846033185720444,
0.21820007264614105,
0.05886758118867874,
-0.09248137474060059,
-0.09941265732049942,
-0.2951980531215668,
0.9072898030281067,
-0.19495998322963715,
0.08376926928... | |
find data having `example` I used command
`>db.info.find({"info.email":"example"})`
and it gives
```
{
"_id" : ObjectId("4f74737cc3a51043d26f4b90"),
"id" : "12345",
"info" : [
{
"sno" : 1,
"name" : "ABC", | [
0.10169687867164612,
0.36400529742240906,
0.318179726600647,
0.1127626895904541,
0.4481656849384308,
0.18825900554656982,
0.00934324599802494,
-0.3081858158111572,
-0.05729147419333458,
-0.507815420627594,
-0.12761949002742767,
0.4180355668067932,
-0.32859352231025696,
0.05663201957941055,... | |
"email" : "abc@example.com"
},
{
"sno" : 2,
"name" : "XYZ",
"email" : "xyz@example.com" | [
0.11385829001665115,
0.3898881673812866,
-0.09839542955160141,
0.12748868763446808,
0.20734646916389465,
0.304532915353775,
-0.03329562023282051,
0.37802600860595703,
-0.33592137694358826,
-0.4725365936756134,
-0.37884771823883057,
0.30309823155403137,
-0.5661622881889343,
0.02075137943029... | |
},
{
"sno" : 3,
"name" : "XYZ",
"email" : "xyz@demo.com"
}, | [
0.3935818374156952,
0.025848738849163055,
-0.27315548062324524,
0.36465615034103394,
0.569946825504303,
0.11380994319915771,
-0.11332645267248154,
0.3282620906829834,
-0.09709255397319794,
-0.6943485736846924,
-0.3390243351459503,
0.577839732170105,
-0.12540332973003387,
0.0381384752690792... | |
{
"sno" : 4,
"name" : "ABC",
"email" : "abc@demo.com"
},
{ | [
0.5306317806243896,
0.14154469966888428,
-0.4233883023262024,
0.3777436912059784,
0.5094811916351318,
0.1393340677022934,
-0.004310782067477703,
0.13295552134513855,
-0.1803979128599167,
-0.6147300601005554,
-0.16293194890022278,
0.6777501702308655,
-0.13444113731384277,
0.0720908567309379... | |
"sno" : 5,
"name" : "Rohan",
"email" : "rohan@example.com"
}
]
}
```
But I want only 3 out of 5 sub rows like
```
{
"_id" : ObjectId("4f74737cc3a51043d26f4b90"), | [
0.044230710715055466,
0.01452801376581192,
0.453246146440506,
-0.055077336728572845,
-0.047995228320360184,
0.2905806601047516,
0.003592472290620208,
-0.021513789892196655,
-0.15656356513500214,
-0.3506600260734558,
-0.3027721047401428,
0.5781304836273193,
-0.2371031492948532,
0.0231042299... | |
"id" : "12345",
"info" : [
{
"sno" : 1,
"name" : "ABC",
"email" : "abc@example.com"
}, | [
0.5813518762588501,
0.3800737261772156,
-0.21311278641223907,
0.09347520768642426,
0.31919151544570923,
0.2590675354003906,
0.006548765581101179,
0.05584372207522392,
-0.16203297674655914,
-0.4046010971069336,
-0.09361705183982849,
0.39544910192489624,
-0.518111526966095,
0.052330300211906... | |
{
"sno" : 2,
"name" : "XYZ",
"email" : "xyz@example.com"
}, | [
0.2296023666858673,
0.2350047379732132,
-0.10606473684310913,
0.17649909853935242,
0.21550674736499786,
0.24880492687225342,
0.03235815837979317,
0.49639296531677246,
-0.304362952709198,
-0.5193876624107361,
-0.3372524380683899,
0.31866443157196045,
-0.4467131495475769,
-0.0382063798606395... | |
{
"sno" : 5,
"name" : "Rohan",
"email" : "rohan@example.com"
}
]
}
```
I tried Map Reduce Function and it works on this type of problems the code is something like | [
0.22797860205173492,
-0.29753074049949646,
0.03686496615409851,
-0.02542106620967388,
-0.4280780851840973,
-0.010043212212622166,
0.2856605350971222,
-0.23860400915145874,
-0.17943646013736725,
-0.5153577923774719,
-0.019355569034814835,
0.6936896443367004,
-0.25857484340667725,
-0.1319185... | |
that:
Write a map function
```
map=function ()
{
filter = [];
this.info.forEach(function (s) {if (/example/.test(s.email)) {filter.push(s);}});
emit(this._id, {info:filter});
}
```
Write a reduce function
```
reduce=function(key, values) { return values;}
```
MapReduce Function
```
... | [
-0.09772273898124695,
-0.34889280796051025,
0.5313733816146851,
-0.3228124678134918,
0.011476182378828526,
0.06538901478052139,
0.1748938262462616,
-0.7821809649467468,
0.08844658732414246,
-0.9466590881347656,
-0.2663479149341583,
0.6302640438079834,
-0.4388328790664673,
-0.00410484243184... | |
"info" : [
{
"sno" : 1, | [
0.10696857422590256,
-0.09753960371017456,
0.262450635433197,
0.24872873723506927,
0.6754266619682312,
0.09721750020980835,
-0.1099737212061882,
0.38767531514167786,
-0.20258548855781555,
-0.5423246622085571,
-0.25037136673927307,
0.4585838317871094,
-0.3535453677177429,
0.0726764723658561... | |
"name" : "ABC",
"email" : "abc@example.com"
}, | [
0.5345860719680786,
0.39724820852279663,
-0.19880498945713043,
-0.08596941828727722,
0.12331228703260422,
0.3142588138580322,
0.07376693189144135,
0.20264627039432526,
-0.1427634358406067,
-0.3989046514034271,
-0.09568779915571213,
0.41865333914756775,
-0.6253486275672913,
0.21792729198932... | |
{
"sno" : 2,
"name" : "XYZ", | [
-0.10512743890285492,
-0.08903016895055771,
0.063057079911232,
0.061130642890930176,
0.25396761298179626,
0.303907573223114,
0.0876966118812561,
0.3975486755371094,
-0.19317470490932465,
-0.5537327527999878,
-0.605874240398407,
0.06893325597047806,
-0.35131627321243286,
-0.0474687926471233... | |
"email" : "xyz@example.com"
},
{ | [
0.4532080888748169,
0.4115297794342041,
-0.06882639974355698,
0.11819881945848465,
0.15288542211055756,
0.3322177529335022,
0.12518428266048431,
0.6136460900306702,
-0.13727688789367676,
-0.41347312927246094,
-0.012764657847583294,
0.42413923144340515,
-0.4462747573852539,
0.14192464947700... | |
"sno" : 5,
"name" : "Rohan",
"email" : "rohan@example.com" | [
0.5754830837249756,
0.048530589789152145,
-0.1579228639602661,
0.1031111627817154,
-0.14957532286643982,
0.5348954796791077,
0.24073734879493713,
0.27045997977256775,
-0.26345378160476685,
-0.009000602178275585,
-0.3476373255252838,
0.4144182503223419,
-0.08492883294820786,
-0.233213156461... | |
}
]
}
}
],
"timeMillis" : 1,
"counts" : {
"input" : 3,
"emit" : 3, | [
0.12958256900310516,
-0.13900282979011536,
0.353813499212265,
0.02828609012067318,
0.39303913712501526,
0.3977307677268982,
0.2148687243461609,
-0.47501474618911743,
-0.21206316351890564,
-0.33140650391578674,
0.06533364951610565,
0.4276675581932068,
-0.15977679193019867,
0.322980523109436... | |
"reduce" : 0,
"output" : 3
},
"ok" : 1,
```
Now you can find your search data from
```
printjson(res.results)
``` | [
-0.17733192443847656,
0.12344855070114136,
0.6950077414512634,
-0.16109740734100342,
0.1305355727672577,
-0.0537448450922966,
0.21929866075515747,
-0.24463213980197906,
-0.18840692937374115,
-0.6907421350479126,
-0.45175522565841675,
0.46507585048675537,
-0.1321604698896408,
0.173554718494... | |
i used virt-install to create a DomU image, but i cannot make sure the DomU created is a HVM or a PV.....anyone has any ideas?
Run
```
virsh edit VM_NAME
```
Then look for the element inside the element. If the value is linux is PVM. | [
0.5884181261062622,
-0.01080424152314663,
0.3707856237888336,
-0.05339236557483673,
0.08159922063350677,
-0.31900689005851746,
0.1864708513021469,
-0.1511479914188385,
-0.21528765559196472,
-0.5008680820465088,
-0.10804536193609238,
0.8737351298332214,
-0.3763136565685272,
0.31974914669990... | |
What do I write in my LIKE statement so that it matches all strings consisting of two words separated by one space?
You could try this:
```
WHERE x LIKE '%_ _%'
AND x NOT LIKE '% % %'
```
Note that it will be slow! If your table can be large and you need to do this often, you may want to rethink your design. | [
0.10144080221652985,
0.115003801882267,
0.1518588662147522,
-0.1749412566423416,
-0.10590159147977829,
-0.005674129351973534,
-0.0003134187136311084,
0.09864310175180435,
0.005159701686352491,
-0.5964931845664978,
0.23304440081119537,
0.26710838079452515,
-0.25710776448249817,
-0.001017459... | |
I'm using [jQuery file upload](https://github.com/blueimp/jQuery-File-Upload "jQuery file upload homepage") for AJAX-based uploads. It always starts uploading after a file is selected. Is it possible to change the behavior to use the "submit"-button? I am aware of [Issue #35](https://github.com/blueimp/jQuery-File-Uplo... | [
0.06436549872159958,
-0.11437908560037613,
0.4224468171596527,
-0.007610234897583723,
-0.46045613288879395,
-0.2451554238796234,
0.20337778329849243,
-0.09201294928789139,
-0.27466702461242676,
-0.8254255056381226,
-0.22137942910194397,
0.5638027787208557,
-0.14123019576072693,
-0.03738741... | |
$("#up_btn").off('click').on('click', function () {
data.submit();
});
},
});
```
EDIT: according to comments a better answer considere `off` to avoid duplicated requests. (also work `unbind`, I do not check if is `bind` and `unbind` but jquery team recommend `on` and `off` [link](http://blog.... | [
0.2081991583108902,
0.029149740934371948,
0.5205698609352112,
-0.273589551448822,
-0.11942272633314133,
0.010119765065610409,
-0.054746199399232864,
-0.07031261920928955,
-0.5535632371902466,
-0.21002496778964996,
-0.40252941846847534,
0.5592934489250183,
-0.4329436123371124,
0.20445783436... | |
here the sample case..
i want to display banner randomly by percentage based on visitor hits.
for example i want to display ads 70% of visitor hits..
the problem is we don't know how many visitor is.
if it make easier we have set percentage 10%, 20%, 30% ... 100%
* and maybe also possible if we save counter per 100 ... | [
0.44373399019241333,
0.14625877141952515,
0.5974894165992737,
-0.025265004485845566,
-0.47985541820526123,
-0.13855744898319244,
0.04840968921780586,
-0.028381748124957085,
-0.3616107106208801,
-0.6424517631530762,
0.16900788247585297,
0.1069498062133789,
-0.14652380347251892,
-0.075573496... | |
work out, and display the banner to 70% of the people:
```
if (rand(1,100) <= 70) {
display_banner();
}
```
If you want to keep this number, and show it to the user for all page views, then store it in a $\_SESSION var of some sort, and based on that value display the banner. | [
0.5826472043991089,
0.1078314483165741,
0.5276585817337036,
-0.5449478030204773,
0.10168899595737457,
-0.022327594459056854,
0.22697347402572632,
-0.3714853823184967,
-0.22025279700756073,
-0.9118116497993469,
-0.37365520000457764,
0.3389778733253479,
-0.17597061395645142,
-0.1730318963527... | |
The following is the problem description:
let `c[n]` be the catalan number for `n` and `p` be a large prime eg.`1000000007`
I need to calculate `c[n] % p` where `n` ranges from `{1,2,3,...,1000}`
The problem which I am having is that on a 32 bit machine you get overflow when you calculate catalan number for such lar... | [
-0.6396245956420898,
0.3024134635925293,
0.2770099639892578,
-0.3387674391269684,
-0.17621351778507233,
0.40388864278793335,
0.1327686607837677,
-0.06210733950138092,
-0.3312506079673767,
-0.39657166600227356,
-0.24558420479297638,
0.5394449830055237,
-0.08187605440616608,
0.19074563682079... | |
avoiding overflow with only 32-bit integers is cumbersome. But any decent C implementation provides 64-bit integers (and any decent C++ implementation does too), so that shouldn't be necessary.
Then to deal with the denominators, one possibility is, as KerrekSB said in his comment, to calculate the modular inverse of ... | [
-0.21641868352890015,
-0.04286655783653259,
0.047701939940452576,
-0.19740277528762817,
-0.22249551117420197,
0.41010281443595886,
0.02796812914311886,
-0.23110319674015045,
-0.301761269569397,
-0.4667423367500305,
-0.1412028670310974,
0.4694664180278778,
-0.12579023838043213,
-0.289041996... | |
numbers, which gives a calculation without divisions:
```
C(0) = 1
n
C(n+1) = ∑ C(i)*C(n-i)
0
```
Since you only need the Catalan numbers `C(k)` for `k <= 1000`, you can precalculate them, or quickly calculate them at program startup and store them in a lookup table.
---
If contrary to expectatio... | [
-0.325357049703598,
0.34941789507865906,
0.23729415237903595,
-0.2528650164604187,
0.14750297367572784,
0.7773213982582092,
-0.034487079828977585,
-0.4534069299697876,
-0.601938009262085,
-0.30501577258110046,
-0.0811818391084671,
0.552362859249115,
-0.02102239988744259,
-0.212245374917984... | |
<< 16)
b = b1 + (b2 << 16) // 0 <= b1, b2 < (1 << 16)
a*b = a1*b1 + (a1*b2 << 16) + (a2*b1 << 16) + (a2*b2 << 32)
```
To calculate `a*b (mod m)` with `m <= (1 << 31)`, reduce each of the four products modulo `m`,
```
p1 = (a1*b1) % m;
p2 = (a1*b2) % m;
p3 = (a2*b1) % m;
p4 = (a2*b2) % m;
```
and the simplest wa... | [
-0.145142063498497,
0.09732050448656082,
0.20745405554771423,
-0.637773871421814,
-0.01978643424808979,
0.592287540435791,
0.2637037932872772,
-0.8873302340507507,
-0.1899494230747223,
-0.23342348635196686,
-0.42153051495552063,
0.43421101570129395,
-0.34282350540161133,
-0.176398709416389... | |
for `p3` and with 32 iterations for `p4`. Then
```
s = p1+p2;
if (s >= m) s -= m;
s += p3;
if (s >= m) s -= m;
s += p4;
if (s >= m) s -= m;
return s;
```
That way is not very fast, but for the few multiplications needed here, it's fast enough. A small speedup should be obtained by reducing the number of shifts; firs... | [
-0.4250938892364502,
-0.13451987504959106,
0.5545921325683594,
-0.505232036113739,
0.19783255457878113,
0.3945091664791107,
0.35660067200660706,
-0.5923622250556946,
-0.24409455060958862,
-0.3145996034145355,
-0.47501885890960693,
0.4978350102901459,
-0.16611388325691223,
-0.22893223166465... | |
`p4` need to be multiplied with 216 modulo `m`,
```
p4 += p3;
if (p4 >= m) p4 -= m;
p4 += p2;
if (p4 >= m) p4 -= m;
for(i = 0; i < 16; ++i) {
p4 *= 2;
if (p4 >= m) p4 -= m;
}
s = p4+p1;
if (s >= m) s -= m;
return s;
``` | [
-0.23926816880702972,
0.1484891027212143,
0.6897667646408081,
-0.4107694923877716,
0.0992559939622879,
0.42817819118499756,
0.491374135017395,
-1.008697509765625,
-0.5230461955070496,
0.12092028558254242,
-0.5407217741012573,
0.5940911173820496,
-0.4042997360229492,
-0.20514844357967377,
... | |
I have some jQuery code, which attempts to show the first 6 divs on page load and hide all of the others. It is littered with errors, but ideally I am trying to create a function that shows the next six divs on an event, ultimately when the user scrolls to the bottom. I know my code is not great, but I have done my bes... | [
0.32089146971702576,
0.1996750384569168,
0.29336661100387573,
0.06631410866975784,
-0.14588424563407898,
-0.0752774327993393,
0.30123981833457947,
0.14404162764549255,
-0.35118788480758667,
-0.6789445877075195,
0.07324346899986267,
0.3570423722267151,
-0.14452752470970154,
0.04372680187225... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.