|
Цитата: Абырвалг от 20 Март, 2012, 06:00:06 формируем список доступных и выгребаем случайныйА если выгребать сразу случайный? Если не available, то еще раз выбрать, а если нет, то какой-то дефолтный совет.
|
|
|
|
|
romawka_ural, число имеется ввиду количество дней? Если количество дней[c#]DateTime dateVal = DateTime.Now;dateVal.AddDays(-20);[/c#]
|
|
|
|
|
arvitaly, ты имеешь ввиду программирование по контракту.Например, в .NET/C# есть следующее: [c#]using System;using System.Diagnostics.Contracts;// An IArray is an ordered collection of objects. [ContractClass(typeof(IArrayContract))]public interface IArray{ // The Item property provides methods to read and edit entries in the array. Object this[int index] { get; set; } int Count { get; } // Adds an item to the list. // The return value is the position the new element was inserted in. int Add(Object value); // Removes all items from the list. void Clear(); // Inserts value into the array at position index. // index must be non-negative and less than or equal to the // number of elements in the array. If index equals the number // of items in the array, then value is appended to the end. void Insert(int index, Object value); // Removes the item at position index. void RemoveAt(int index);}[ContractClassFor(typeof(IArray))]internal abstract class IArrayContract : IArray{ int IArray.Add(Object value) { // Returns the index in which an item was inserted. Contract.Ensures(Contract.Result() >= -1); Contract.Ensures(Contract.Result() < ((IArray)this).Count); return default(int); } Object IArray.this[int index] { get { Contract.Requires(index >= 0); Contract.Requires(index < ((IArray)this).Count); return default(int); } set { Contract.Requires(index >= 0); Contract.Requires(index < ((IArray)this).Count); } } public int Count { get { Contract.Requires(Count >= 0); Contract.Requires(Count = 0); Contract.Requires(index = 0); Contract.Requires(index < ((IArray)this).Count); Contract.Ensures(((IArray)this).Count == Contract.OldValue(((IArray)this).Count) - 1); }}[/c#]Пример взят с MSDN. Ты хочешь тоже самое только на PHP? Или что?
|
|
|
|
|
что-то в этом направленииЦитироватьcontact_process: pattern: /contact defaults: { _controller: AcmeDemoBundle:Main:contactProcess } requirements: _method: POST username: * password: * http://symfony.com/doc/current/book/routing.html
|
|
|
|
|
meta то, что ты сделал называется рееестром. В твоем случае вообще не стоит думать о скорости, ты ее потеряешь на другом. Используй синглтон и прочие штуки до тех пор, пока не поймешь, что это плохо. Лучше конечно сразу понять, но ты будешь упираться, так как тебе лень совершенствоваться.
|
|
|
|
|
Цитата: "fgets" от 24 Июль, 2011, 02:16:17 Цитироватьне красиво ничего не возвращатьvoidНе, не, не... Не вырывай так слова из контекста. Там другое имеется ввиду. isFile или тру или ничего. Понятно, что сработает, если проверять все время только на тру. Другое дело, что это реально не красиво, и возможно false удобней. Короче, код должен быть предсказуемым.
|
|
|
|
|
Цитата: master от 22 Июль, 2011, 08:15:34 поле $info объяви protectedпочему не private?
|
|
|
|
|
Цитата: "mario" от 22 Июль, 2011, 02:46:15 А диалоги мы центрировали так:[js]this.dialogX = $(this.dialogInner).width() - $(this.dialogInner).outerWidth()/2;this.dialogY = $(this.dialogInner).height() - $(this.dialogInner).outerHeight()/2 + $(this.dialogClass).outerHeight();[/js][js]$('#dialog').dialog({ autoOpen: false, width: 200, height: 200, dialogClass: this.dialogClass, buttons: this.dialogButtons, position: [this.dialogX,this.dialogY]});[/js]хтмл примерно так выглядит: {+++50+++} dialogInner должен быть с заданой высотой, хотя точно не знаю, т.к. в цсс лезть далеко ))Цитата: "krasun" от 17 Июль, 2011, 12:04:41 [js] // $appCon node относительно которого центрирую var positionX = $appCon.position().left + $appCon.width() / 2 - $crGmDlg.dialog("option", "width") / 2; var positionY = $appCon.position().top + $appCon.height() / 2 - $crGmDlg.dialog("option", "height") / 2; var position = [Math.round(positionX), Math.round(positionY)];[/js]Ну как я и делаю, короче {+++64+++} Все равно, спасибо, что посмотрел
|
|
|
|
|
Цитата: mario от 22 Июль, 2011, 02:56:26 да можно, см. код vasa_c с 77 строки http://code.google.com/p/go-js/source/browse/go.jsДа, раньше, что-то такое и делал - http://code.google.com/p/go-js/source/browse/go.js#77 Цитата: mario от 22 Июль, 2011, 02:56:26 $("#test").click(jQuery.proxy(object, "methodName"));То что надо!
|
|
|
|
|
Постоянно сталкиваюсь с таким кодом: [js]var _this = this;$.post( this.getUrl( 'gameConnect' ), { 'gameId' : gameId }, function( game ) { _this.connectedToGame( game );});[/js]Как можно красиво избавиться от var _this = this; и возможно ли такое в принципе в js. Помню раньше, как-то решал это, сейчас давно не кодил, не могу ничего вспомнить
|
|
|
|
|
Цитата: "mario" от 22 Июль, 2011, 01:02:31 бля... Нужно было раньше написать сюда )))Сейчас посмотрим, как раз сижу работаю )та я забыл, сегодня вернулся к коду и опять вспомнил
|
|
|
|
|
Цитата: mario от 17 Июль, 2011, 01:09:12 завтра попробую найти пример. )Я так и не знаю, когда настанет, завтра. Но mario, мож глянуть, если конечно не сложно. А то у меня уже куча этих диалогов и всех их центрирую подеццки
|
|
|
|
|
bounding rectangle - это прямоугольник в который вписывается эллипс, $sd, $ed - угол от которого, до которого его прорисовывать
|
|
|
|
|
Цитата: armageddance от 17 Июль, 2011, 01:52:25 Насколько мой подход правильный?мне нравится сама суть вопроса))
|
|
|
|
|