Home arrow Coding

Airing Dirty Laundry In Public...

PDF  | Print |  E-mail
(0 votes)
Coding
Written by ultrabeast   
Monday, 14 April 2008
(Sigh) Just posting this here to collect my thoughts... and perhaps some kind soul might just have the experience and the answers to the below conundrums.









Hi there...

A number of questions I have here. The first two are related to DS-syndicate as stated in the title, the other is a general Joomla/PHP/permissions question which some might have encountered before. So, hope you can help me out with your experience.

Firstly,
I see that this site ([b]www.goodwebpractices.com[/b]) has an excellent RSS feed page generated (displayed when you click that "RSS Subscribe" link on the upper right part of this page... with the same template and display style as the rest of this site.

Apart from that, the article order there follows exactly the article order of the articles on its main page.

I'm trying to use ds-syndicate on my site too, and the display is really nothing like the way that I would like it to be; that is, how it is for that site.

First of all I can't get the article order same as the article order on my main page (I'm using Blog-Content Section as my main page, I've moved my 'frontpage' to another menu item.)

Secondly, as I said, I'd like the feed to be rendered out using the same template as the rest of my site.. not as how it is now - that generic drab 'subscribe to feeds' page that Firefox shows.

Am I missing something? What are the things that I should do or look out for?




Next: is the URL that I keep on getting from ds-syndicate. Whenever I've done something wrong in creating the feed and I delete it from the administration interface to start over...

The URL I get is inexorably incremented by 1
     http://virtualestate.org/ultrabeast/index2.php?option=ds-syndicate&version=1&feed_id=5

as in feed_id=1, then =2, ...

But in feedburner, the URL that I submit is =1 ... how do I force DS-syndicate to just create a certain URL with a certain ID? Even if I deleted all the feeds in the list to start over, I can never get a feed with id=1 .. [i]forever[/i].






On another note, I always seem to have a general problem with the folder permissions from time to time. It seems that whatever is created by Joomla, it's not necessarily that I am the owner - although I would think that I ought to be. Hence sometimes I get the error line like "fopen() failed in xxxx.php on line 74" when using some components that heretofore worked alright.

The implication of that -
On one instance the problem happened this way - rsgallery2 notified that some of its folders are 'unwritable' and I found that I could not even CHMOD those certain folders (rsgallery2 image folder) with joomlaXplorer, FTP or even with my [i]webhost administration cpanel[/i]  :eek: !!!
After some headaches from this I realized that I had recently chosen to use PHP 5.2.5 in my cpanel administration, I switched back to "System Default" (PHP 4.4.8) and the problem of the "unwritable and permission unmodifiable rsgallery2 folders" went away... but problem is, then onwards from time to time I will get the error line as told in the paragraph above.

Is there a concept of a 'PHP user'  or that kind of thing? I never even realized things would be so un-straightforward when I started out. I noted for those troubled rsgallery2 folders, the 'user/owner' was displayed by joomlaXplorer as [b]'nobody'[/b]. How could that happen?

It could be not so easy to gather what I mentioned here.. If anyone could please take a look at my site. I'm facing a lot of problems from time-to-time specifically with file and folder writable permissions.

http://virtualestate.org/ultrabeast

Any suggestions on other site-related things as well are welcome. I'm still a neophyte.
Thanks guys.
 

Added Author Avatar image to Articles!

PDF  | Print |  E-mail
(0 votes)
Coding
Written by ultrabeast   
Thursday, 20 March 2008
After some more painstaking work, implemented the hack (i.e. code) to display the avatar picture of the author in the posts and not only in the comments section.

Although this effort was strictly optional, but it was a good exercise in learning how to pull out data from mySQL databases using PHP.

Not only that, new html class tags had to be defined, and the CSS template had to be tweaked again, to get it displayed as desired.
 

CSS - Inline, Internal and External Style Sheets.

PDF  | Print |  E-mail
(0 votes)
Coding
Written by ultrabeast   
Wednesday, 19 March 2008
When one does programming, one wants fast access to the function definitions, attribute descriptions, all the available options, info, etc. Trying to code something without the documentation is like trying to write a C++ or MFC program without the MSDN library. In short, that means impossible.

Likewise, don't CuSS CSS when you need to tweak your template, for complete online documentation is handily available at w3schools.com - for every web element that you can tweak, there are handy Try-It! pages for you to tweak and update to see the effects of your changes on-the-spot.

Today, we're talking about CSS inline style definition, internal and external stylesheets.
inline: <tag style="..."> within the tag itself
internal: <style> ... </style> between the <head> tags
external: most commonly seen, defines everything in a file separate from the HTML file, and can be reused by different HTML files.

http://www.w3schools.com/css/css_howto.asp
for the quickest reference.

Example of Inline CSS
  1. <p style="color: sienna; margin-left: 20px">
  2. This is a paragraph
  3. </p>

'Internal' style sheet
  1. <head>
  2. <style type="text/css">
  3. <!--
  4. hr {color: sienna}
  5. p {margin-left: 20px}
  6. body {background-image: url("images/back40.gif")}
  7. -->
  8. </style>
  9. </head>

Linking a HTML file to an External style sheet
  1. <link rel="stylesheet" type="text/css"
  2. href="mystyle.css" />
  3. </head>

And there you have it - the quickest reference to CSS.

I also strongly recommend this article at
http://www.communitymx.com/content/article.cfm?page=2&cid=FAF76
namely: CSS: Getting Into Good Coding Habits.

Page 2 talks about removing the browser's default formatting settings,
Page 3 talks about making your pages standards compliant and all-browser friendly,
Page 4 talks about specifying your id and class selectors,
Page 5 talks about specifying our own custom settings to override the browser's defaults that we have just cleared off in Page 2.

So there we have it, quick reference whenever questions about these aspects pop up in one's mind...
 

I (want to) know what you did this Sunday

PDF  | Print |  E-mail
(0 votes)
Coding
Written by ultrabeast   
Sunday, 16 March 2008
After an extended period of tweaking and customization and more tweaking to this back-end engine... Finally, at long last I get to sit down and actually type some content.
 
After a busy morning which involved a lot of exertion... had a hearty lunch before settling down to... yes... more exertion. In this case, throwing a lot of exceptional cases at this engine and template (that I put a lot of effort in) in an attempt to try to break it... not only that.. under both Mozilla Firefox and IE7.
 
As a result a lot of things were discovered that 'breaks' the template - i.e. if text runs off the right edge of the screen, the template layout breaks up and makes the hated horizontal scrollbar appear.
 
It seems that if I don't do anything funny, no one would notice that there could be anything wrong.. but I couldn't sleep peacefully at night with the knowledge that something could have been done, but wasn't. (That explains my distressing masochistic compulsion.)
 
One culprit is pasting of text formatted with the <pre> tag - which indicates a block of preformatted text, such as source code.. where lines are not wrapped, but run off the edge of the screen..
 
For this case a CSS hack serves to force the contents within <pre> tags to also wrap... however, only under FireFox. IE7 still breaks crap.
 
However, not to panic, there is a custom <code> tag that makes source code appear as below:

C Code
  1. for(i=0;i<10;i++) { printf("Lengchai boh?\n"); }
  2. while(1) { printf("Ini bagus punya\n"); }

C# also can
  1. /// <summary>
  2.   /// Initializes a new instance of the <see cref="TFTPClient"/> class.
  3.   /// </summary>
  4.   /// <param name="server">The server.</param>
  5.   public TFTPClient(string server)
  6.      : this(server, 69) {
  7.   }
  8.  
  9.   /// <summary>
  10.   /// Initializes a new instance of the <see cref="TFTPClient"/> class.
  11.   /// </summary>
  12.   /// <param name="server">The server.</param>
  13.   /// <param name="port">The port.</param>
  14.   public TFTPClient(string server, int port) {
  15.     Server = server;
  16.     Port = port;
  17.   }

How to write Tetris in VB.net...
  1. Public Function WillCollide(ByVal shape As Shape, ByVal direction As NewDirection)_
  2.     As Boolean
  3.  
  4.     Dim pntsToCheck As Collection(Of Point) = GetNewPoints(direction)
  5.     For Each pnt As Point In shape.Points
  6.         For Each pnts As Point In pntsToCheck
  7.             If (pnt.Equals(pnts)) Then
  8.                 Return True
  9.             End If
  10.         Next
  11.     Next
  12. End Function
  13. Public Function WillCollide(ByVal direction As NewDirection) As Boolean
  14.     Dim pntsToCheck As Collection(Of Point) = GetNewPoints(direction)
  15.     For Each pnt As Point In pntsToCheck
  16.         If (pnt.X < 0 Or pnt.X > 9 Or pnt.Y > 19 Or pnt.Y < 0) Then
  17.             Return True
  18.         End If
  19.     Next
  20. End Function

All automatically formatted! Especially...
1 Note the neat code line numbers and
2 Language-specific syntax highlighting!
3 Note the monospace char width!
 
However the template's auto margin style definition was still not enough to prevent the template from breaking up and the horiz scrollbar from appearing... This was solved in CSS by setting the <code> class width to 720px, fixed.
 
After these corrective measures:
In exceptional case of the source code being too long (as in code1.code2.code3.code4...codeN.dosth();
 
1) the template won't break, but horizontal scrollbar appears. still acceptable.
2) <pre> tag will break template in IE7, no matter what.. because CSS overriding the <pre> tag to word wrap (as below) doesn't work...

This still doesn't wrap <pre> tag code in IE7.. -_-"
  1. pre {
  2.  white-space: pre-wrap;       /* css-3 */
  3.  white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */
  4.  white-space: -pre-wrap;      /* Opera 4-6 */
  5.  white-space: -o-pre-wrap;    /* Opera 7 */
  6.  word-wrap: break-word;       /* Internet Explorer 5.5+ */
  7.  width: 99%;   /* remove horizontal scroll-bar when viewing in IE7 */
  8. }
Can anyone give me any solution that works to wrap <pre> tag text in IE ???
 
The motivation behind making all these painstaking customizations were so that all these features are built into the rich text editor, so that I don't need to separately enter any HTML tags.. thanks to putting in the diligence in the one time job , (which was a long time job) to solve all these problems.
 
I still cannot foresee the drama of the effort to produce automated prettily formatted content being made into a movie.. I guess making Internet content robustly browser-friendly still does not carry the same glamour as internet hacking XD
 
Still, carrying the euphoria of achievement.. it was then time for more exertion in the form of a swim in the nice weather..
 
Next up: The lunch at Sungai Kob, Kulim (with photos! oh wow!)
 
<< Start < Prev 1 2 Next > End >>

Results 11 - 14 of 14
Advertisement

Latest Comments!

RSS Syndication


Save to FireFox Live Bookmarks:
feed-icon-12x12-orange.gif
View Feed XML

Search I, UltraBeast!

ShoutMix CB


Say No to Internet Explorer!

- This site will give an "Operation Aborted" error with IE whenever there are photo galleries on the page.

- MOZILLA FIREFOX is the recommended browser.

- Let me know if there are problems with Opera, Safari, etc.
Thanks ~

Problems Registering?

If you have problems getting your activation email, fret not:
  • Simply log in below using your Username and Password to get that mail sent again to you.
  • Check your bulk/junk/trash mail.
  • Rinse and repeat as many times as necessary.
Should all else fail - I can be contacted at
Email webmaster

Login





Live Traffic Feed

Who's Online

No Users Online
© 2008 Interview With The UltraBeast
Joomla! is Free Software released under the GNU/GPL License.