Jump to content

rain13

Members
  • Posts

    346
  • Joined

  • Last visited

Everything posted by rain13

  1. Thanks. It works. How does this[this.config.branch](); exactly work? Basically calling string()? I mean normally, "alert"() wouldnt work but this.config.branch is also string. why is there this and then square brackets?
  2. Hi! Sorry if it is wrong word in the title. I am not sure how to call it in english if I do var x = functionName and then x() to call it. Just to clarify this is what I meant bycalling by pointer. What I just described works normally. For example you can do x = alert and then use x() to actually call alert. Now In my case I want to get the same thing work in class. How do I do that? class MyClass { constructor(){ this.config = {"branch": this.branchA}; this.classVar = {"a":1} } main(){ this.classVar["b"] = 2; this.branchB(); this.config.branch(); } branchA(){ alert(this.classVar["a"]); } branchB(){ alert(this.classVar["b"]); } } var myClass = new MyClass(); myClass.main(); myClass.config.branch = myClass.branchB; myClass.main(); // I want this.classVar to be accessible in both branchB calls In this example first call from main to branchB works as I want but 2nd call complains that TypeError: this.classVar is undefined. How do I fix that? Basically I want to have main method that has code that gets executed every time and then n possible alternations which are decided by configuration.
  3. Hi! I have strange problem that I did not have before with my host. I have this php script <?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); include_once "./incltest.php"; setcookie('Session', 'val23', 1577840461, '/'); exit(0); ?> And the contents of incltest.php is: <?php ?> The cookie does not set and the message i get it: I figured that if I remove closing tag ?> from php file that I include then *I no longer get this error. So far I've always used closing tags at the end of my php scripts and it has worked that ways. Are there any new php standards out there that now it doesn't work anymore? To me it looks strange to have starting tag <?php at the beginning of my file but not ending tag. Should I now change all my php files or would it be better to set some php ini value?
  4. Hi! I want to use Imagick to resize images. I have one problem. Script finishes immediately despite of fact that original file is about 10 MB which should take some time to process. An other thing is that no errors or warnings are printed. So for debugging purposes I printed version number but it also didnt show anything. <?php error_reporting(E_ALL); print(imagick::getVersion()); $im = new Imagick(); print($im->::getVersion()); $im->readImage( "./uploads/0YZSQJErNxtcb2Dc.jpg" ); $im->resizeImage(1008, 756,Imagick::FILTER_LANCZOS,1); $im->writeImage('./uploads/small.jpg'); $im->destroy(); ?> Any ideas what could possibly be wrong?
  5. Ok, now the left side of green block starts where blue ends. But I needed right side of green to end where right side of blue ends. Edit: Got it solved. Trick was to add span around 2 inner spans with display inline block and then inside this I was able align right. Btw, your example was also interesting. I havent seen such alignment before.
  6. What do you mean by update git? I have already latest git version. Or you mean run some command line command? Can you see screenshot when you follow this link: https://s1.postimg.org/85bw8veqxr/Capture.png
  7. Hi! It looks like a simple thing but right now I couldnt find any way to do it: I need text to be aligned center and then an other text below it. But the text that is below it must be aligned so that it's right side is at same place where previous line's right side. <div style="text-align: center; width: 864px; background-color: red"> <span style="background-color: blue">Some long text that takes more space that is nicely centered</span> <br> <span style="background-color: green">aligned to right</span> </div> right now the green and blue are both centered. I need the green block end where blue block ends.
  8. Hi! I have settings.php in root directory (same directory as my .gitignore). I have tried everything. But settings.php still shows up when I commit stuff and when I change it it shows modified as status. I have tried everything: .idea/ settings.php /settings.php ./settings.php Interesting is that it successfully ignores .idea directory but it doesnt ignore my settings file. Any ideas? Below is screenshot that shows that settings.php is green right now.
  9. Hi! I try to use HSQL database manager to create 2 views. I want to create intermediate view first and then use the intermediate view in new view. Like create view a as .... . And then create view b as select x, ... from a. If I write those 2 statements in HSQL database manager and hit 'Execute' query then it tells me user lacks privilege or object not found. However if I enter first create view statement, click "Execute SQL" and then write 2nd SQL statement ans click "Execute SQL" then it works. The same happens when I migrate date from .sql files. If I put these 2 create view statements in separate .sql files it works but if I put them in same .sql file the 2nd one fails because first view is not created yet (the same error I showed before) However I have these statements separated with semicolon so it should not be issue. Any ideas what it is? And how I could make it so that I could have only one .sql file that has both statements instead of having 2 separate files?
  10. Hi. How do I reliably detect input change? At first I tried on change but it didnt work. Now I try onkeypress but it also doesnt work. You always have to press key twice before button changes state. If the input is empty and button is disabled, you have to type either 2 digit number or work around hack is that you type in 1 digit number and then hit one of the arrow keys. The same is when next button is enabled and you delete the text from input. when delete all digits from the input, it will not disable next button until you have pressed something else. Could anyone explain why I always have to key press at least 2 times before it reacts? And how could I fix it so that it would immediately react when it changes? <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script> function valueChanged(){ var inputValue = $("#interval_size").val(); if (inputValue == "") { $("#generalization_next").prop("disabled", true); } else { $("#generalization_next").prop("disabled", false); } } </script> </head> <body> <input type="number" id="interval_size" onkeypress="valueChanged()"> <input id="generalization_next" type="button" value="Next" disabled="disabled"> </body> </html>
  11. Hello! I want to create my own window in html/css/js which I managed. Now I want to have status bar at the bottom of that window. I am stuck with this because I dont know how to make it consume all width of window (not talking about browser's window but about window I created myself). As I have understood I need position: absolute; to make it stick to bottom. I tried to play with left and right property and even width 100% but nothing helped me. I also dont quite understand why adding position: absolute made my div not to consume all available space. Basically I want my red div to be as wide as it would be without position: absolute; but stick at bottom. The reason for position: absolute; attribute was that bottom didnt work with out it. How should I solve my issue? <!DOCTYPE html> <html> <head> <title>My cool web app</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <script src="./jquery.js"></script> <script src="./jquery-ui.js"></script> <link rel="stylesheet" type="text/css" href="./jquery-ui.css"> </head> <body> <p>Some content in web page</p> <div id="win" style="border: 1px solid rgb(66, 138, 255); position: fixed; left: 552.25px; top: 233.75px; width: 170px; height: 130px; background: rgb(219, 237, 255) none repeat scroll 0% 0%; right: auto; bottom: auto;" class="ui-draggable"> <div style="background:#9CF" id="titlebar" class="ui-draggable-handle"> Window Title <div style="float:right; text-align: left;" onclick="$('#win').remove();"> <img class="icon24" src="./lib/acp/close.png"> </div> <div style="clear:both;"> </div> </div> <div id="wincontent" style="height: 100%; overflow:auto;"> Window content <div style="bottom: 0px; left: 0px; right:0ox; position: absolute; width 100%; background:red;"> Status bar <div></div> </div> <script> $("#win").draggable({ containment: 'window', scroll: false, handle: '#titlebar' }); </script> </body> </html>
  12. You mean to create 2 divs on top of each other? I dont know how to exactly do that. I have tried different examples, but never figured it out. Could you show me minimalistic example?
  13. Hi Right now I have background image with background color but only image gets displayed. I have to remove image if I want color. How do I draw background color on image so that I could get profir from half transparent bg? color: rgb(187, 187, 187); background-color: rgba(255, 81, 81, 0.46); background-image: url(http://orig01.deviantart.net/293b/f/2013/308/7/e/kali_linux_wallpaper_by_blur212-d6szsz7.png); background-repeat: no-repeat; background-attachment: fixed; background-position: center;
  14. Ok after over hour of googling I decided to post here. I get Forbidden You don't have permission to access /test.php on this server. Apache/2.4.18 (Ubuntu) Server at localhost Port 80 in my apache2.conf is: <Directory /> Options FollowSymLinks AllowOverride None Order allow,deny Require all granted Allow from all </Directory> in my 00-default.conf I have DocumentRoot /home/rain/www/ <Directory /home/rain/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> What do I need to do to get access?
  15. Thanks for hints. I dont have my own company. Just wanting to send it to student project contest...
  16. Hello. I would like to use your help. Over years I have developed a software (as a hobby project) that has a loads of functionality (almost like phpbb3 or gallery 3 or cmsimple). Now it is almost ready to be released. With this software you can create websites, blogs, galleries and forums. But I need some ideas for coming up with good name to it. The problem is that if this name contains "CMS" then those who want to build galleries would dismiss it. If it's name contains "gallery" then those who are looking for "CMS" would dismiss it. I dont speak english natively so it would be interesting to see if some of the native speakers can come up with word that describes software that does all these 4 (cms, gallery, blog, forum) things.
  17. I have question. Is there difference in performance when I compare direct file download to download trough php script? By direct download I mean site.com/photos/file.jpg By download trough PHP I mean site.com/download.php?file=123 Am working on web gallery. If offer downloads trough direct link, then I dont need to run php script but I cant have control over downloads and actual file names in server would be revealed. From the other hand if I use php script such as download.php then I would have more control over access and actual file path would remain hidden. Now I am wondering if there is any difference performance wise whether I use direct link or php script? I mean thumbnails page would generate many requests and thats why I am wondering if there is any difference between these 2 options.
  18. Tnx, got it work. Edited the post above so that who ever finds it can now copy-paste this code.
  19. Hello. I made simple php script to download attachments but I have problem that instead of my_file.txt I get upload.php for file name: <?php header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-description: File Transfer"); header("Content-type: application"); header('Content-Disposition: attachment; filename="my_file.txt"'); header("Content-Transfer-Encoding: binary"); header("Content-Length: 5"); echo "Hello"; ?> Any suggestions?
  20. Hi Is there way in PHP to convert Adobe RGB to sRGB?I am currently using GD image functions such as imagecreatefromjpeg, imagecreatetruecolor, imagecopyresampled and imagejpeg. to resize the photos. Since I dont have access to Imagick on my host I am limited to GD image functions. The problem with this is that as soon as I resize Adobe RGB image, I see a little bit different colors on resized image. Left is original image, right is after resize.
  21. Tnx for info. How can I make it be 100px height at lease? if I resize li to be >100px then div doesnt change and I didnt find a way to make dives min-height work.
  22. Hi,I am trying to build forum view. However there are few things that I don't understand.1) Why doesnt max-width: 100px; in div.count work? min-width seems to work but when you view this html on 1900x1080 you can see that div.count is clearly more than 100px;1.1) Which is better varying width (min, max) or fixed width?2) why doesn't min-height: 100px; work in li.forum_item > div ?2.2) How to make it work? <html><head><style>li div{ display: table-cell; border-right: 1px solid #000; border-bottom: 1px solid #000;}li{ width: 100%;}div.forum{ min-width: 300px;}div.count{ max-width: 100px; min-width: 75px;}div.post{ max-width: 24%; min-width: 270px; width: 24%;}.placeholder{ display: table; table-layout: fixed; width: 100%;}.list_head{ background: #00285D;}.list_head div{ color: #fff;}.forums{ list-style-type: none; padding: 0;}h4{ margin: 0px;}li.forum_item > div{ min-height: 100px;}</style></head><body><ul class="forums"> <li class="list_head"> <div class="forum">foorum</div> <div class="count">posts</div> <div class="count">topics</div> <div class="post"><span class="placeholder">Last post</span></div> </li> <li class="forum_item"> <div class="forum"><h4>parent</h4></div> <div class="count">0</div> <div class="count">0</div> <div class="post"><a href="./?p=0" class="placeholder"></a>By <a style="color: " href="./?p=0"></a><br><span class="post_time">On Never</span></div> </li><li class="forum_item"> <div class="forum"><h4>comments</h4></div> <div class="count">0</div> <div class="count">0</div> <div class="post"><a href="./?p=0" class="placeholder"></a>By <a style="color: " href="./?p=0"></a><br><span class="post_time">On Never</span></div> </li><li class="forum_item"> <div class="forum"><h4>test</h4></div> <div class="count">0</div> <div class="count">0</div> <div class="post"><a href="./?p=0" class="placeholder"></a>By <a style="color: " href="./?p=0"></a><br><span class="post_time">On Never</span></div> </li><li class="forum_item"> <div class="forum"><h4>child1</h4></div> <div class="count">0</div> <div class="count">0</div> <div class="post"><a href="./?p=0" class="placeholder"></a>By <a style="color: " href="./?p=0"></a><br><span class="post_time">On Never</span></div> </li><li class="forum_item"> <div class="forum"><h4>child2</h4></div> <div class="count">0</div> <div class="count">0</div> <div class="post"><a href="./?p=0" class="placeholder"></a>By <a style="color: " href="./?p=0"></a><br><span class="post_time">On Never</span></div> </li><li class="forum_item"> <div class="forum"><h4>Blog</h4>My blog</div> <div class="count">10</div> <div class="count">2</div> <div class="post"><a href="./?p=52" class="placeholder">Re: nbmnbmnb</a>By <a style="color: #00CC00" href="./?p=38">User</a><br><span class="post_time">On 1970 Jan 01 16:05:21</span></div> </li><li class="forum_item"> <div style="min-height: 100px;" class="forum"><h4>Forum</h4>You Love Awesom-O But There Are Still Just A Few Things That Could Go Smoother, Or You Just Would Like To See Something New? Tell Us Here! </div> <div class="count">0</div> <div class="count">0</div> <div class="post"><a href="./?p=0" class="placeholder"></a>By <a style="color: " href="./?p=0"></a><br><span class="post_time">On Never</span></div> </li></ul></body>
  23. Hello. I am making a window with title bar and content. I want to make #wincontent to fill whole window, so I use height: 100%; but it doesn't take into account that #titlebar already uses some of available space. How do I tell it to be 100% - height of title bar? If possible I would prefer to do it with out JavaScript. <div class="ui-draggable ui-resizable" id="win" style="border: 1px solid rgb(48, 124, 153); position: fixed; left: 746px; top: 24px; width: 712px; height: 150px; background: rgb(219, 237, 255) none repeat scroll 0% 0%; right: auto; bottom: auto;"><div class="ui-draggable-handle" style="background:#9CF" id="titlebar">my window</div><div id="wincontent" style="height: 100%; width: 100%; overflow: auto;"><h2 style="color: #000;">fgdfsdg</h2><style>table .sortable{ border-top: 1px solid black; border-right: 1px solid black;}</style>gfdhgfhgf<br>dgfhgf<br>dfhgfh<br>fdghg<br>dfghgfdh<br>fgdhggfh<br>gfhgf<br><br></div><div style="z-index: 90;" class="ui-resizable-handle ui-resizable-e"></div><div style="z-index: 90;" class="ui-resizable-handle ui-resizable-s"></div><div style="z-index: 90;" class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se"></div></div>
×
×
  • Create New...