Search Results

Search found 33 results on 2 pages for 'fedor'.

Page 2/2 | < Previous Page | 1 2 

  • Creating a db driven primary navigation in django?

    - by Fedor
    I find that it's pretty common most people hardcode the navigation into their templates, but I'm dealing with a pretty dynamic news site which might be better off if the primary nav was db driven. So I was thinking of having a Navigation model where each row would be a link. link_id INT primary key link_name varchar(255) url varchar(255) order INT active boolean If anyone's done something similar in the past, would you say this sort of schema is good enough? I also wanted for there to be an optional dropdown in the admin near the url field so that a user could choose a Category model's slug since category links would be common, but I'm not quite sure how that would be possible.

    Read the article

  • How can I implement lazy loading on a page with 500+ images?

    - by Fedor
    I basically have a booking engine unit results page which must show 40 units and per each unit there's 1 large image of the first thumbnail and an X number of accompanying thumbnail images. I've been using the jquery lazy load plugin, but it's not thorough enough ( I'm invoking it on DOM Ready ), plus it doesn't really work in IE ( 50% of the clients use IE so it's a big issue ). What I think I really need to do is not really spit out the image but a fake element such as a span, and possibly modify my code such that if the user views the span, render it into an image element. <span src="/images/foo.gif"> The booking engine relies on JS so I think I might be forced to just rely on ajaxifying all the thumbnails and have event handlers on window scroll, etc in order for the page to be "usable" and load at an average time ( 2-3 seconds instead of 5-30s on high speed DSL/Cable ). I'd appreciate any examples or ideas.

    Read the article

  • Should I be using the command pattern? Seems like a lot of work...

    - by Fedor
    My Room class has a lot of methods I used before I decided to use the command pattern. Previously, I was invoking a lot of commands and now it seems I have to make a method in my roomParser class for every method. If I wanted to invoke say, setHotelCode I would have to create a method in roomParser that iterates through and invokes the method. Is this the way I should be using the command pattern? <?php interface Parseable { public function parse( $arr, $dept ); } class Room implements Parseable { protected $_adults; protected $_kids; protected $_startDate; protected $_endDate; protected $_hotelCode; protected $_sessionNs; protected $_minRate; protected $_maxRate; protected $_groupCode; protected $_rateCode; protected $_promoCode; protected $_confCode; protected $_currency = 'USD'; protected $_soapAction; protected $_soapHeaders; protected $_soapServer; protected $_responseXml; protected $_requestXml; public function __construct( $startdate,$enddate,$rooms=1,$adults=2,$kids=0 ) { $this->setNamespace(SESSION_NAME); $this->verifyDates( $startdate, $enddate ); $this->_rooms= $rooms; $this->_adults= $adults; $this->_kids= $kids; $this->setSoapAction(); $this->setRates(); } public function parse( $arr, $dept ) { $this->_price = $arr * $dept * rand(); return $this; } public function setNamespace( $namespace ) { $this->_sessionNs = $namespace; } private function verifyDates( $startdate, $enddate ) {} public function setSoapAction( $str= 'CheckAvailability' ) { $this->_soapAction = $str; } public function setRates( $rates='' ) { } public function setHotelCode($code ) { $this->_hotelCode = $code; } private function getSoapHeader() { return '<?xml version="1.0" encoding="utf-8"?> <soap:Header> </soap:Header>'; } private function getSoapFooter() { return '</soap:Envelope>'; } private function getSource() { return '<POS> <Source><RequestorId ID="" ID_Context="" /></Source> </POS>'; } function requestXml() { $this->_requestXml = $this->getSoapHeader(); $this->_requestXml .='<soap:Body></soap:Body>'; return $this->_requestXml; } private function setSoapHeaders ($contentLength) { $this->_soapHeaders = array('POST /url HTTP/1.1', 'Host: '.SOAP_HOST, 'Content-Type: text/xml; charset=utf-8', 'Content-Length: '.$contentLength); } } class RoomParser extends SplObjectStorage { public function attach( Parseable $obj ) { parent::attach( $obj ); } public function parseRooms( $arr, $dept ) { for ( $this->rewind(); $this->valid(); $this->next() ) { $ret = $this->current()->parse( $arr, $dept ); echo $ret->getPrice(), PHP_EOL; } } } $arrive = '12/28/2010'; $depart = '01/02/2011'; $rooms = new RoomParser( $arrive, $depart); $rooms->attach( new Room( '12/28/2010', '01/02/2011') ); $rooms->attach( new Room( '12/29/2010', '01/04/2011') ); echo $rooms->count(), ' Rooms', PHP_EOL; Edit: I'm thinking it may be easier if I made the RoomParser less generic by storing properties that all the objects will share. Though I'll probably have to make methods if I want to override for a certain object.

    Read the article

  • How can I fake sql data while preserving statements without commenting my server-side code?

    - by Fedor
    I have to use hardcoded values for certain fields because at this moment we don't have access to the real data. When we do get access, I don't want to go through a lot of work uncommenting. Is it possible to keep this statement the way it is, except use '25' as the alias for ratecode? IF(special.ratecode IS NULL, br.ratecode, special.ratecode) AS ratecode, I have about 8 or so IF statements similar to this and I'm just too lazy ( even with vim ) to re-append while commenting out each if statement line by line. I would have to do this: $sql = 'SELECT u.*,'; // IF ( special.ratecode IS NULL, br.ratecode, special.ratecode) AS ratecode $sql.= '25 AS ratecode';

    Read the article

  • Progress dialog getting dismissed before the thread gets finished - Android

    - by user264953
    Hi experts, I use the code provided by Fedor in the following link, in order to get the latitude and longitude from my simple demo app. I am trying to fetch the latitude and longitude using the MyLocation class provided by him in that link. What is the simplest and most robust way to get the user's current location in Android? I try to fetch the latitude and longitude on a button click. On the button click, I start an async task and delegate the location fetching work to the do in background method of my asynctask. pre execute - progressdialog initiated. post execute - progress dialog dismissed. This is how, the progress dialog in my code should work and here is the issue which I have. THe progress dialog gets initiated correctly, but even before the latitude and longitude gets printed in the doinbackground method, the progress dialog gets dismissed. I do not understand why this happens. Here is my front end activity public class LocationServices extends Activity { MyLocation myLocation = new MyLocation(); LocationResult locationResult; TextView tv1, tv2; Location location; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); tv1 = (TextView) findViewById(R.id.tv1); tv2 = (TextView) findViewById(R.id.tv2); Button btn = (Button) findViewById(R.id.Button01); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new LocationAsyncTasking().execute(); } }); } public class LocationAsyncTasking extends AsyncTask<String, Void, Void> { ProgressDialog dialog; int totalAvail; protected void onPreExecute() { // this.dialog.setMessage("Inserting data..."); dialog = new ProgressDialog(LocationServices.this); this.dialog.setMessage("Fetching data..."); this.dialog.show(); } protected Void doInBackground(String... args) { Looper.prepare(); locationResult = new LocationResult() { public void gotLocation(Location location) { // TODO Auto-generated method stub // LocationServices.this.location = location; System.out.println("Progress dialog should be present now - latitude"+location.getLatitude()); System.out.println("Progress dialog should be present now - longitude"+location.getLongitude()); } }; myLocation.getLocation(LocationServices.this, locationResult); return (null); } protected void onProgressUpdate(Integer... progress) { } protected void onPostExecute(Void unused) { dialog.dismiss(); } } } I am quite puzzled, thinking of what makes this progress dialog disappear even before the SOP in doinbackground is finished. Experts, please help me understand and resolve this issue. Any help in this regard is well appreciated. Looking forward, Best Regards, Rony

    Read the article

< Previous Page | 1 2