« first day (417 days earlier)      last day (4540 days later) » 
00:00 - 16:0016:00 - 00:00

12:06 AM
select other, and let a mod decide
 
Well, after reading over programmers and codereview FAQs I'm no longer as certain that the question belongs there.
In fact, after reading it I'm not even sure if some of my own questions on codereview are appropriate there or on programmers
 
 
1 hour later…
1:35 AM
Hi, I am trying to upload a file in my web host so that I can use it in tumblr. However if I refer to it from tumblr or localhost it returns false
is there a way to change the permition or something?
 
What do you mean it returns false? What kind of HTTP error are you getting?
 
no error
it is a json file and I am use jquery to get its content,
the code works as I did it in localhost, and if I run it all in the same location it works, only when I try to access the file from tumblr/localhost it does not work
 
Give me just a moment, I need to do a little referencing to make sure I'm not about to tell you something wrong. But, to start off with when you encounter a problem like this your first solution shouldn't be changing permissions.
You should only ever change permissions like that after all other possible solutions have been exhausted and you have clear proof that it is a file permissions issue
 
if you run this <?php include("http://aurelkurtula.co.uk/text.txt"); ?> you would not get anything
I was just testing
 
Right, well this is just a normal cross-site security measure. Requests must originate from the same domain
There's ways around this of course, you could set up a "micro-restful API" on your webpage that serves up the proper data and you call that from tumblr
In computing, the same origin policy is an important security concept for a number of browser-side programming languages, such as JavaScript. The policy permits scripts running on pages originating from the same site to access each other's methods and properties with no specific restrictions, but prevents access to most methods and properties across pages on different sites. This mechanism bears a particular significance for modern web applications that extensively depend on HTTP cookies to maintain authenticated user sessions, as servers act based on the HTTP cookie information to revea...
 
1:43 AM
I dont understand that
 
We have 2 webservers, Bob and Frank. Bob has some tools that it can use to generate a webpage. Frank also has some tools, but slightly different, that it uses. Bob can only use Bob's tools. Vice versa Frank can only use Frank's tools. They can't share tools with each other.
It is working locally because you're using your own tool. When you attempt to use it from somewhere else it would be as if Bob went over to Frank's tools and stole some. Web servers are built to not let that happen
Well, to try not to let that happen*
 
ok
 
nice names for the servers :-P
 
I got the idea, thanks, do you know any tutorials which might explain how to get around it?
 
1:51 AM
lol
 
@aurel Well, I don't know how Tumblr works...But assuming you have some way to make an HTTP request it would be as simple as creating a webpage at a known url, I'm not sure what domain you're working in but make the url appropriate. Call a HTTP request on your url from tumblr and do whatever it is you were wanting with the data.
I've never actually implemented a restful API but the basic concept is simple enough and should be relatively easy to implement on a small-scale, particularly if you're just learning.
 
yes, thanks for your help I think I know wat
*what to put on google search
 
Great. Happy learning.
 
Thanks
 
@ircmaxell Are you available for a discussion? I'm having a problem with a design that I would like some feedback on.
 
2:01 AM
sup?
 
I'm working on my own personal project to learn about good design and clean code. I'm wanting to implement a slim MVC framework. I'm working on the persistence storage strategy and just need some advice to make sure I'm not doing things in a bad way. I've done quite a bit of research on the topic but really have no feedback on it.
 
ok...
 
Essentially though there are several different aspects: Model, DataSource, Query, DataMapper`, Entity. The Model controls the interaction between the components and institutes the logic for that domain. The DataSource interacts with the actual persistence layer. Query generates the appropriate statement needed by the DataSource. DataMapper would take Entity objects and create the appropriate Query objects.
 
hrm, the only thing that seems off is the query builder part
 
What should be generating the query then?
 
2:09 AM
Not really sure, it's not clear each's responsibilities. But it feels like query is mixing the Source with the Mapper...
 
In a way it is, its expected that different data sources will need different queries. The query is really there as an abstraction between the Source and the mapper. ultimately i'm afraid that Mapper will become far too large and powerful if it is responsible for parsing Entity AND creating the right Query for Source
 
what's the difference in responsibility between the mapper and source?
 
The source is what's actually persisting the data to the database, file, api, whatever. The mapper reads the appropriate Entity data, puts it into a data format that can be interpreted by Query, then takes the data returned by Query and converts it into the appropriate Entity objects
I mean, really, that's already doing a lot
 
wait, so neither source nor query are going to be used by the application? They will be hidden behind the mapper?
 
In theory yes, the application should only ever have to interact with the model for business logic, the mapper and entity
 
2:15 AM
Nice, ok, objection partially withdrawn
 
The problem I'm encountering is really the Source and the Mapper
Its expected that different Mapper will need different Source
I already plan to create a SourcePool object but i'm not sure how to give the right source to the Mapper
 
why?
 
well, i'd really like to make it a constructor dependency...but that would mean i'd have to know the data source needed by the mapper before it is constructed...which means static
i'm adamantly against static...the fact that this was my first solution made me stop and rethink what i was doing
 
no argument
 
I thought about a setDataSource($Source) method
 
2:18 AM
Well...
you could make Source generic (kind of an ORM layer)
 
but then I'm afraid that the mapper may be used before the source is set
i don't really like that either
what do you mean?
 
Well, that would let you use the mapper to convert business entities into ORM layer objects. That way you can persist them independent of the business relationships, but also not pollute your app with tons of classes for each domain object
 
I guess I don't understand the difference between an ORM layer object and Query
 
What is your take on Query? What does it do and what is it responsible fo?
 
It is responsible for accepting data about the fields, conditions and clauses that are being requested. It has 3 setter methods for the appropriate data. Then it has a single getter method to return the actual statement needed by Source
 
2:23 AM
hrm... Interesting...
 
So, essentially it is responsible for parsing the data about the query and generating the appropriate statement
 
ORM does something similar, but instead of "building a query", it does it through relationships with the objects that are passed to it
 
right, i looked at adding a setAssociatedMapper or something similar
but honestly i don't feel like i've really got my head completely wrapped around this
i just have this gut instinct that i'm missing something
 
me neither
yeah, something "feels" slightly off...
 
Well, thank you for the talk either way, feels refreshing to talk about programming to somebody who doesn't just stare back jaw-agape with a pool of drool forming on the floor.
 
2:27 AM
lol
++
 
Ultimately my programming & logic course at school was a little disappointing...I guess I was expecting something a little more..advanced. I feel like I can't talk to anybody in the class really as they don't understand basic OOP concepts even.
 
Sadly, that seems pretty common
You're still in school?
 
Yes, I go into my second semester in January
 
Wow
Color me impressed
 
Everything I know about programming I learned on my own
Ultimately this prog & logic I taught me Java syntax
Honestly, big woop.
If I had wanted to learn a programming language syntax i probably would have learned C or C++, did it over a summer and not spent thousands of dollars on it
 
2:33 AM
Same here
(learned on my own, not the other part)
I chose to do a Math degree instead of going CS...
 
right now i'm not feeling really enthusiastic about my degree program, but i also know that most places want that paper
 
Nah, some do, but experience and knowldege will get you far further
entry level, sure
 
I actually had a job interview at a local development shop, but ultimately it was about a month before school started so it was a no go.
But, they also interviewed me because I had my own personal project going on so it kind of validated some of the work I had been doing.
Ultimately though, the biggest thing that has impacted my programming and coding since school started? I read Clean Code ...and it isn't even on the school reading list :P
 
Yup. Open source or just personal work will get you MUCH further than you seem
for me it was Code Complete 2
I liked Clean Code, but CC2 was the game changer for me
 
I've started reading that as well but feel like some of the things are hard for me to grasp, or really get the importance of, as I'm flying solo over here.
What I'm really afraid of in school? I get to my PHP class and the professor is teaching the class with mysql_
shudder
I just may withdrawal from class, right then and there
 
2:41 AM
lol
talk to the teacher first
mention to him that you have expererience in it, and that you disagree with some of what he's teaching
if he's a good teacher, he will engage you and try to learn from you or use you to help teach the class (GREAT expererience). If not, you'll know then and withdraw
 
Yea, if I can just control my patience. I got into PHP late, so when I see stuff like PHP4 code and mysql_ it makes me want to scream.
How can you not know that this is crap?!
 
not everyone is good
 
I don't think that it is a matter of being good. I think it is a matter of drive and passion. You don't have to be good at programming to use Google and comprehend basic concepts.
i mean, even if you wanted to use procedural code for most people starting out you just change mysql_ to mysqli_...that's not a matter of being good, that's lazy
 
I consider that part at being good
 
I guess I just assume its natural for everybody to be obsessively passionate about the fact that you can type some stuff into a computer and make it do ANYTHING IN THE WORLD! ;)
 
2:50 AM
Nope. And it's sad
 
mornings
 
sup
 
what the hell .. it is 5am and i just woke up .. now what to do
 
When I wake up at 5am I generally decide to go back to bed
 
2:58 AM
tried that hour ago ... did not work anymore
 
Brew a pot and get to crackin' on something then :P
 
pot .. now there is an idea
 
Surely some code somewhere needs to be refactored or a bug squashed! I really should be doing the same...
 
3:09 AM
lol
 
3:22 AM
Hi again can you help me on how to get the contents off this request

$.getJSON('http://anyorigin.com/get?url=aurelkurtula.co.uk/text.txt&callback=?', function(data){
$('#output').html(data);
});
it outputs my content, plus some overhead which makes it hard (for me) to drill down to the content I want
 
 
2 hours later…
5:13 AM
hi
need help in PHP and regex
but no correct answers yet. but 2 down votes :)
I improved my question by editing. could u plz help me?
-1
Q: Regular expression in PHP

Sayujstr = "abc xyz asdf @ Rs1.5/day.poi qwerty." I want to use regex in PHP and convert it into "abc xyz asdf @ Re1/day.poi qwerty." ie, i want to replace the substring "Rs1.5/day"(say s1) with "Re.1/day"(say s2) Here s1 and s2 can be any string in the format (Rs|Re)<digit>[.<digit>]/...

 
Need help in passing parameters to a SOAP service
The body parameters are
$client->VerifyTxn( '7452', 'I2344', 'P1', '123' );
this is how im passing it
<s:element minOccurs="0" maxOccurs="1" name="obj1"/>
<s:element minOccurs="0" maxOccurs="1" name="obj2"/>
<s:element minOccurs="0" maxOccurs="1" name="obj3"/>
<s:element minOccurs="0" maxOccurs="1" name="obj4"/>
 
 
1 hour later…
6:58 AM
Why is zend doing this ?
/**
         * Convert <?= ?> to long-form <?php echo ?> and <? ?> to <?php ?>
         *
         */
        $this->_data = preg_replace('/\<\?\=/',          "<?php echo ",  $this->_data);
        $this->_data = preg_replace('/<\?(?!xml|php)/s', '<?php ',       $this->_data);
 
could be somehow related to fact that <? ?> is not recognized on all servers
 
but don't they have the configuration anyways ?
btw, Hi :)
 
its zend .. are you honestly surprised ?
yeah , mornings
 
well I am not a zend guy and haven't used in an actual project yet, but I think the Zend guys contribute alot to PHP so they should know they are stuff.
 
then how comes Zend Framework is one of the most archaic frameworks out there filled with bad practices ? .. and i do not know anyone who would willingly choose Zend Studio as his IDE
additionally , zend's engine has been one of the main forces holding php's evolution , because it is ancient and they (php core devs) have to fight against the limitations for every new feature they add in language
 
7:15 AM
I would agree with the last part, for example the scope resolution operator issue.
but the first one is a bit subjective thing so I wouldn't say anything.
 
@OmeidHerat , are you really gonna tell me that seeing the use of global keyword in ZF2.x as bad practice is subjective ?
 
Nope, but sure an IDE is.
 
sure , i can agree with that
 
and the global keyword is not from second loop of hell, it's just a tool, it just doesn't work when used like a fool.
 
but do you know anyone who develops using ZS ?
 
7:20 AM
quit a few active high rep (it's not all about knowledge though) and active users in this room.
 
7:41 AM
hullo
 
Holla @tpae
 
what's up
 
nothing much just wondering around but not lost for sure.
hbu ?
 
just doing some work
 
good
 
7:45 AM
i need a good break
 
I rather have my breaks away from computer.
 
indeed, that'd be the best
where are you from?
 
Old Afghanistan, why so ?
 
just curious
 
ah, hbu ?
 
7:49 AM
im in seoul, korea
it's crowded here
 
I think I have heard about it, Seoul.
 
yeah
 
@tereško what MVC do you use ? or have put up together your own ?
 
currently Koahana , but i am trying to build my own
i find this one to be the lesser evil
( i assumed that you meant framework , because MVC is just an architectural pattern )
 
@ter
woops
 
8:02 AM
@tereško what is cool about it ?
 
implements HMVC, small enough that you can actually know how it works, powerful routing system, community is pretty ok
 
ah looks good.
 
one of main shortcoming, imho, is that they are still not migrating to php5.3+
 
Ah! that is one big issue.
there is lots of things that I use that are 5.3 specific
 
8:19 AM
well , it works on 5.3 , but they are not adopting any features from it
 
ah got it, so no namespace yet ?
 
nope, no namespaces , none whatsoever
and not planned for 3.4 release either
 
bugga
 
cool! got my SO Shirt today. They also enclosed a sticker and two pens :)
 
Nice! @Gordon
I have get one too.
how much are they ?
 
8:32 AM
@OmeidHerat I dont know. I got one for free because im in the all time top 100 list of users
 
aight, I will check it out then.
what framework you guys use for a project that is 'due yesterday ?'
just stick with the one you have or ?
 
using a framework with which you are not familiar in a overdue project is not a smart choice .. not at all
 
Well I defs agree with that, but maybe my question wasn't clear enough.
 
hell , same is true for any project .. you should not use a critical (as in : money is involved) project as a way to learn new framework
 
is it worth learning a simple and easy to use and fast to implement Framework (which might not be too good) as sidekick when you have projects with short due time ?
 
8:43 AM
hello
just a simple question
how can I go to the end of a file with PHP?
 
@ivanfreire I am afraid, you can't go anywhere with that much of PHP ;)
 
please
 
@tereško true that, but there we go, I finally put my question together.
@ivanfreire Your question is not clear, what are you trying to do and why ?
 
@OmeidHerat , no , finish what you are doing or you will loose the interest in current project
 
I am trying to open a word document, going to the end, inserting a page break and in the new page an image
 
8:48 AM
@ivanfreire and what do you use to do that ? do you know word is not a simple txt file ?
 
I can insert the image already by using COM
but I need the image at the end of the file
 
@tereško No, not halfway through project. Say you start a project and you know you have not enough time.
@ivanfreire COM?
 
$word = new COM("word.application");
 
@OmeidHerat call the project owner and say you need more time
 
+ you tell him what WILL be done one time , so that the owner can plan accordingly
 
8:52 AM
So it doesn't worth learning something rubish that you can do in fast time ?
just simply avoid doing it.
 
@OmeidHerat its more about avoiding martinfowler.com/bliki/TechnicalDebt.html
 
> "The first 90 percent of the code accounts for the first 90 percent of the development time. The remaining 10 percent of the code accounts for the other 90 percent of the development time."
 
That is 180%, but I get it ;)
@Gordon Thanks, that is a good article, almost halfway through.
 
@tereško Thanks, I will just add that book to my list.
 
 
2 hours later…
10:59 AM
hello
any drupal developer here?
plz
 
Hi. How can I go to the end of a Word document using COM?
 
11:17 AM
Hi. How can I go to the end of a Word document using COM?
 
11:50 AM
hi all
 
@ivanfreire First you need a digitizer. Then you need to digitize yourself into the computer. Use a cron-job to start the digitizer and then hop into it. Don't forgot to also digitize your mouse and keyboard, otherwise you won't be able to get out.
 
Hi everyone
 
hi @Robik
 
Hello @NikiC, How are you?
 
12:16 PM
@Ch
@ChristianSciberras smarty pants
 
12:33 PM
@Robik good, only tired. You?
 
Fine.
 
1:09 PM
hi
 
1:22 PM
posted on December 06, 2011 by Mayflower Blog - PHP

Today's topic is deployment. It's called one-click deployment for a reason: Developers are lazy. It's hard to do less than clicking on one button, so that's our goal. With the growing need for lower time-to-market and faster response to user feedback it is inevitable to not be limited by technical factors (there are enough other obstacles already). The focus lies on reproducible resul

 
2:17 PM
He doesn't want the href ;)
he wants the whole tag
 
@NikiC the linked dup shows how to get the tag as well. besides you know this is a duplicate and should be deleted so there is no point in argueing about the duplicate being appropriate. the entire question should just be removed.
 
Sup
 
2:33 PM
@Gordon Sorry, I didn't read past the title and thus didn't see that you are answering his question too. cvd now
just got a nice answer badge for:
10
A: How to check for null in Twig?

NikiCDepending on what exactly you need: is null checks whether the value is null: {% if var is null %} {# do something #} {% endif %} is defined checks whether the variable is defined: {% if var is not defined %} {# do something #} {% endif %}

:)
 
very nice
I'm one upvote from my 101st badge in 6 questions...
 
hey all, I'm having trouble understanding classes.  Any direct help or reference to useful learning documentation for this problem is welcome.

$notice = adminErrorNotice::newIntance( $arr_errors );

class adminErrorNotice {
        var $Errors;
        public static function newIntance( $aError ){
               $this->Errors = $aError;
        }
}

how do I go about initializing $this without implementing a `function __construct(){}` ?  Or, rather than using `$this` what can I use to assign values to the object properties?
 
first off, that's a fatal error
 
right, which is why I'm asking for help on it
 
since static methods can't access $this (since there is no object to access)
 
2:45 PM
:/
 
$this does not have to be initialized. Inside your class it always refers to the instance of the class that is invoking the method or accessing the property
 
You'd either need to implement $Errors as static: protected static $Errors = null; and change the access to static::$Errors
or, change the method to non-static and use new
you could also do:
public static function newInstance($aError) {
    $obj = new static;
    $obj->Errors = $aError;
    return $obj;
}
 
o.O.o
 
What type of object would be returned from that? Is there a static object?
 
2:50 PM
@ircmaxell with the last implementation, if I wanted to reference Errors outside the class I would remove 'protected' from the variable declaration in my class header
 
or provide a getter fucntion
 
right
 
public function getErrors() {
    return $this->Errors;
}
 
You definitely don't want to make it public. Chances are most of the properties in your classes should be protected or private
 
@ircmaxell but I thoughts I couldn't use $this-> if it was originally declared as static
I have to use self::Errors right?
 
2:53 PM
class adminErrorNotice {
    protected $Errors;
    public static function newInstance($error) {
        $obj = new Static;
        $obj->Errors = $error;
        return $obj;
    }
    public function getErrors() {
        return $this->Errors;
    }
}
$obj = adminErrorNotice::newInstance('foo');
echo $obj->getErrors(); // 'foo'
 
oh yea, our newest example is by using a getter function with a protected variable
my bad
 
but can I ask what you are trying to do?
 
....learning
?
 
meaning, what is the class supposed to be doing
 
compiling an email body based upon the contents of $arr_errors, querying an admin profile table to get emails and usernames and sending an email to those addresses containing error information...
but I'm just doing it to see if I can
 
3:04 PM
and you need LSB for that ?
 
@ircmaxell what if I had 2 functions within my class that I wanted to execute, how could I execute both of them in a minimal way? i.e.:

class adminErrorNotice {
    protected $Errors;
    public static function newInstance($error) {
        $obj = new Static;
        $obj->Errors = $error;
        return $obj;
    }
    public function getProfiles() {
        $this->profile = array( 'my_email@example.com', 'userid' );
    }
}

$obj = adminErrorNotice::newInstance('foo')->getProfiles();
 
you could do that
try it
play around with it.
 
notice the last line, I'm not sure if there is a simpler way to do that.... the ->getProfiles() seems to break it...
 
You'll learn more by trying and failing than asking questions... That doesn't mean not to ask questions, just try it yourself first
break what?
what version of PHP are you using?
 
var_dump( $obj ) displays NULL
5.3.6
 
3:08 PM
getProfiles doesn't return anything
 
that's because getProfile doesn't return ;)
hum @ircmaxell was faster ^^
 
but since getProfiles adds a property to $obj I would have thought it should var_dump() everything from the newIntance function AND getProfiles()
 
:-P
@sadmicrowave no, because the obj return from newInstance is passed to getProfiles instead
so the return from getProfiles is what's actually returned...
In this case, there is no return, so it's null
 
so in getProfiles() if I return $this; I will get everything ;)
 
yes
 
3:11 PM
^not a question
 
if a method returns $this so that you can call multiple methods in one go it's called "method chaining". That's a pretty common pattern ;)
 
I'm getting the hang of this :) @tereško - I don't need to do it this way, but I'm playing around and learning about classes. I actually already created a function to do this but porting it to OO is a good learning exercise
 
@NikiC That's a pretty common anti-pattern FTFY
 
@ircmaxell is method-chaining not a good practice?
 
blame jquery / ror
 
3:13 PM
lol
 
@tereško No, but then if you do somethingElse extends adminErrorNotice {}, the call somethingElse::newInstance will work as expected...
@sadmicrowave I don't think it is in most cases
 
@ircmaxell Pattern was neutral here :P But, if the object is a builder wouldn't method chaining be okay?
 
Maybe. Maybe not. It depends on the API.
I dislike chaining because it hides what's going on
$obj->doSomething()->getSomething()->doSomethingElse()->foo()->doSomethingElseEntirely(); what type of object is ->foo() called on?
the answer is that without inspecting each and every call before it, you have no idea
 
imho, getSomething() should never return $this
 
well, what does it return then?
 
3:18 PM
and doSomething() should not be returning anything at all
 
(and I don't disagree, unless it's getIterator(), which can be useful in some cases)
 
@ircmaxell i would assume that that would be an instance of Something class
 
@tereško Maybe, maybe not
 
bottom line : it's a fucking magic, don't do it ( the chaining )
 
I think it makes sense for objects with fluent interfaces
Like builders, as I already mentioned
 
3:25 PM
I personally don't like chaining because I find it hard to read when you start doing it too deep. And chances are you're gonna be chaining too deep when you start doing it.
 
E.g. $mock->expects($this->at(0))->method('test')->with($arg)->will($this->returnValue($return))
(That example isn't exactly classical method chaining as it doesn't return $this but different objects, but the concept stays)
 
@NikiC Still, I don't care for that. It's not obvious how it works...
perhaps you could argue that you don't need to know, but eih
 
3:38 PM
@ircmaxell joomla question...
    <administration>
		<files folder="backend">
			<file>index.html</file>
The problem is that I also need to put a file in administrator/com_a/a.php
and a.php is situated outside of backend folder
so in theory, the above would look like:
 
too bad. If you need to do that, you'd need to write a custom installer
 
    <administration>
		<files folder="">
			<file>a.php</file>
		</files>
		<files folder="backend">
			<file>index.html</file>
oh
:(
 
it's not hard at all, just need to hook into the install and uninstall methoids
 
@ircmaxell Funny, the file a.php is actually install.php in my case. And it has those methods.
 
3:42 PM
OMG O.o
 
lol.
 
Well, I could do it the easy way:
copy(__FILE__, 'whatever/administrator/com_a/'.basename(__FILE__));
 
It's something I wrote a few years back to install multiple extensions in one shot (you could bundle multiple components and multiple plugins in a single package)
@ChristianSciberras Why are you storing data outside of the normal directory structure
 
@ircmaxell Sounds like someone that got fed up of J's system :D
@ircmaxell Outside? It's inside.
 
@ChristianSciberras no, it'd need to be administrator/components/com_a
@ChristianSciberras No, just knew it inside and out and built this to use the internal systems to their advantage
 
3:45 PM
oh, by whatever I meant whatever I need to do to get J's absolute path
I'd put the above liner inside my install.php. Coz that file is also the uninstaller.
 
no, menaing the components directory
 
oh, forgot that part
Hey, can't be blamed with such long dirnames :D
 
IT VORKZ!
So, next issue.
I have this xml:
<administration>
    <menu img="components/com_a/a.png" link="option=com_a">ABC</menu>
But the menu item displays as abc
Why's that?
I suspect it has to do with language files? But I kept them empty intentionally.
I noticed that when I change the alias field for the menu item in the DB, it displays correctly (according to the field's value).
 
00:00 - 16:0016:00 - 00:00

« first day (417 days earlier)      last day (4540 days later) »