Search Results

Search found 4677 results on 188 pages for 'alternative'.

Page 126/188 | < Previous Page | 122 123 124 125 126 127 128 129 130 131 132 133  | Next Page >

  • How can I see a variable defined in another php-file?

    - by Roman
    I use the same constant in all my php files. I do not want to assign the value of this variable in all my files. So, I wanted to create one "parameters.php" file and to the assignment there. Then in all other files I include the "parameters.php" and use variables defined in the "parameters.php". It was the idea but it does not work. I also tried to make the variable global. It also does not work. Is there a way to do what I want? Or may be there some alternative approach?

    Read the article

  • Storing information in the DOM?

    - by John
    Im making a small private message application in the form of a phone. Ten messages are shown at the time. And the list of messages are scrolled up/down by hiding them. Just how bad is it to use the DOM to store information in this way. My main goal for doing this is to reduce calls to the database. And instead of making a new call all the time, it only checks if any new messages has arrived and ads the new message(s). Whats the alternative, cookies anyone? Thank you for the time

    Read the article

  • How to limit memory of a OS X program? ulimit -v neither -m are working

    - by hectorpal
    My programs run out of memory like half of the time I run them. Under Linux I can set a hard limit to the available memory using ulimit -v mem-in-kbytes. Actually, I use ulimit -S -v mem-in-kbytes, so I get a proper memory allocation problem in the program and I can abort. But... ulimit is not working in OSX 10.6. I've tried with -s and -m options, and they are not working. In 2008 there was some discussion about the same issue in MacRumors, but nobody proposed a good alternative. The should be a way a program can learn it's spending too much memory, or setting a limit through the OS.

    Read the article

  • Is it possible to *optionally* override a theme in Drupal 6?

    - by David Semeria
    I want to override the theming of only one (custom) menu. I can do this with phptemplate_menu_tree() but - of course - it overrides the rendering of all menus. I've tried returning FALSE (an obvious technique IMO) if the menu is not the specific one I want to override - but this doesn't cause the overridden theme function to be called. My only alternative (when the menu is anything other than the specific one) is to call the overridden function from within phptemplate_menu_tree() - but this seems to defeat the whole point of the override system, since the default rendering function will be hard-coded therein. I hope the explanation is clear, and any help is greatly appreciated - tks.

    Read the article

  • Commiting broken code to the repository for the purpose of backing it up

    - by Tim Merrifield
    I was just talking to another developer (more senior than I) and trying to convince him that we should implement continuous integration via Cruise Control. He told me that this will not work because he commits code that does not compile to the repository all the time for the purposes of backing it up. And that automated builds notifying us of failures would be just noise. Committing garbage to the repo sounds bad to me. But I was at a loss of words and didn't know what to say. What is the alternative? What's the best practice for backing up your code on another machine without adding a bunch of pointless revisions? BTW, our version control system is SVN and that probably won't change any time soon.

    Read the article

  • Is there a way to update a database when installing/upgrading an app?

    - by Adam
    I have a main application, and a bunch of sub-applications (they are separate apps, which do not appear on the android home dashboard). I was planning on having a SQLite DB which the main app maintains, and get a list of available sub-apps from. Is there a way to update this main database as the user installs the sub-apps? Two alternative I was thinking of include: User installs the sub-apps via the main app, which would then update the DB. Rather than use the DB to find all installed sub-apps, have each sub-app declare a category, and use intents to query for all applications which match that query (is this even possible? if so, advice is welcomed). Thanks!

    Read the article

  • Low-overhead way to access the memory space of a traced process?

    - by vovick
    Hello all. I'm looking for an efficient way to access(for both read and write operations) the memory space of my ptraced child process. The size of blocks being accessed may vary from several bytes up to several megabytes in size, so using the ptrace call with PTRACE_PEEKDATA and PTRACE_POKEDATA which read only one word at a time and switch context every time they're called seems like a pointless waste of resources. The only one alternative solution I could find, though, was the /proc/<pid>/mem file, but it has long since been made read only. Is there any other (relatively simple) way to do that job? The ideal solution would be to somehow share the address space of my child process with its parent and then use the simple memcpy call to copy data I need in both directions, but I have no clues how to do it and where to begin. Any ideas?

    Read the article

  • Finding all the URL requests from a firefox extension

    - by user303052
    I am building a firefox extension. In this extension, I want to see the URLs of any new webpage that the user visits. The webpage can be in a different tab or window than the current tab that the user is viewing (this should also catch the URL of pop-ups). Is there a way to find when firefox makes a GET or POST request and grab the URL? An alternative that I am trying to avoid is going through all the tabs and manually check to see if they have loaded a new page. Thanks

    Read the article

  • Language D compared to C++?

    - by Henrik
    Anyone here with experience of the language D? I was just reading through its presentation at http://www.d-programming-language.org/ and at Wikipedia and it seems like a good (better) alternative to C++. With good/better I mean that it seem simpler yet it has all the good stuff within C/C++. But without some of the difficulties that make C++ more difficult to learn and use in a good and efficient way. So anyone with comments/experience with the language D? Performance?

    Read the article

  • Executing a file not a project

    - by RPK
    I use Aptana Studio for my PHP projects. I have not learned it but just used with what I was able to do in it. Many features I still don't know how to use in it. At present, I have a HTML form and I want to write a .php script for the SEND button that it has. It is a submission script for the contact form. I want a simple PHP IDE with which I can execute a single PHP file or work with at least two or three files easily, without much mess. Please suggest a simple alternative to Aptana.

    Read the article

  • Finding employees specific to department in SQL SERVER 2000(SET BASED)

    - by xyz
    Suppose I have a table (tblEmp) whose structure is like as under Dept Emp d1 e1 d1 e2 d1 e3 d2 e4 d2 e5 d3 e6 If I need to bring the output as Dept DepartmentSpecificEmployees d1 e1,e2,e3 d2 e4,e5 d3 e6 I will write the query as select Dept, stuff((select Emp + ',' from tblEmp t2 where t1.Dept = t2.Dept for xml path(''),1,1,'')DepartmentSpecificEmployees from tblEmp t1 group by Dept But this will work in Sql Server 2005+. How can I achieve the same in Sql Server 2000 without any variable declaration or loop or cursor? If I use COALESCE as an alternative, then I need to use a variable which will defeat the purpose Please help

    Read the article

  • Converting a macro to an inline function

    - by Rob
    I am using some Qt code that adds a VERIFY macro that looks something like this: #define VERIFY(cond) \ { \ bool ok = cond; \ Q_ASSERT(ok); \ } The code can then use it whilst being certain the condition is actually evaluated, e.g.: Q_ASSERT(callSomeFunction()); // callSomeFunction not evaluated in release builds! VERIFY(callSomeFunction()); // callSomeFunction is always evaluated Disliking macros, I would instead like to turn this into an inline function: inline VERIFY(bool condition) { Q_ASSERT(condition); } However, in release builds I am worried that the compiler would optimise out all calls to this function (as Q_ASSERT wouldn't actually do anything.) I am I worrying unnecessarily or is this likely depending on the optimisation flags/compiler/etc.? I guess I could change it to: inline VERIFY(bool condition) { condition; Q_ASSERT(condition); } But, again, the compiler may be clever enough to ignore the call. Is this inline alternative safe for both debug and release builds?

    Read the article

  • jquery 1.3 not(:first) problem in IE

    - by sunil-mand99
    Hi, i have 3 div tags of same class, <div class="redc"> <p>sdfs</p> </div> <div class="redc"> <p>sdfs</p> </div> <div class="redc"> <p>sdfs</p> </div> to select div other than first ,$(".redc:not(:first)") works fine in mozilla,but not in IE Please suggest any alternative for IE Note: vesion jquery 1.3

    Read the article

  • Update query (access & vb.net)

    - by yae
    Hi: I have to update some fields of a table of access according to the value of parameter. If this paramter is "true" I need to update. Table idInvoice price percentageTax1 tax1 percentageTax2 tax2 total Example values: idinvoice: 12300 price: 100 € percentageTax1: 10 % tax1= 10€ percentageTax2: 5 % tax2: 5€ total: 115 € (result: 100€+10€+5€) Ok. If the parameter on that I have commented before is "true" I must update the percentages and then update the total. I need to replace the "old" percentages by new percent. Ok I can do it in 3 queries: update invocies set percentageTax1=20,tax1=price *(percentageTax1/100) where idInvoice=@number and percentageTax1=10 update invocies set percentageTax2=7,tax2=price *(percentageTax2/100) where idInvoice=@number and percentageTax2=5 update invocies set total=price+tax1+tax2 where idInvoice=@number . But my question is: is there any an alternative to do this in 1 query?

    Read the article

  • MySQL, select from different table... IF

    - by gubbfett
    I'm having a small trouble since it was a long time ago i studies databases and querys. For example i'll have two tables for cd:s, one with data and one with alternative translations. In the CD-table i have the original language, and it looks something like this Table for CDs (cds): id | name | language ----------------------- 1 | aaa | en 2 | bbb | en 3 | ccc | fi Table for languages (languages): cd_id | language | name ----------------------- 1 | fi | AAA 1 | de | AAACHTUNG 3 | en | CCC Now, i want to get all these cd:s in for example german, if there's no translation made i want it to be in the original language... How can i do this?

    Read the article

  • Parsing a string for dates in PHP

    - by nickf
    Given an arbitrary string, for example ("I'm going to play croquet next Friday" or "Gadzooks, is it 17th June already?"), how would you go about extracting the dates from there? If this is looking like a good candidate for the too-hard basket, perhaps you could suggest an alternative. I want to be able to parse Twitter messages for dates. The tweets I'd be looking at would be ones which users are directing at this service, so they could be coached into using an easier format, however I'd like it to be as transparent as possible. Is there a good middle ground you could think of?

    Read the article

  • Can i query a List? Java

    - by Nitesh Panchal
    Hello, Say i have List<SomeObject> objList = new ArrayList<SomeObject>(); If someObject contains a field named id. Can we find it through some query like objList.filter('id=2'); wihout looping through the list? If not, then why? This can be so useful method and used as an alternative to write tedious for loop? Just a question that came to my mind so i thought i must clear it here :) Thanks in advance :)

    Read the article

  • FastObjects.NET(is an OODB from Versant) performence in Real Scenerios?

    - by Lalit
    FastObjects.NET Saves the whole class object(if marked with attribute Persistent) at once in file system(using serilization or similar technology). They are promissing that it is even faster then normal SQL DB approach. My team also thought it is better and faster to save the whole object once instead of each field one by one. Defination of their website: FastObjects .NET 10.0 fully conforms to the Microsoft.NET 2.0 framework. Tightly integrated with Visual Studio 2005, it offers a developer-friendly, object-oriented alternative to a relational database for .NET persistence. I want to have your experiences of using FastObjects in production scenerio? They are promising for Indexing/Transaction/clustoring/replication.

    Read the article

  • rearrange Array according to values order of another Array

    - by Exception
    I have two arrays like below var arr = ["x", "y", "z", "a", "b", "c"]; var tgtArr = [{val:"a"}, {val:"b"}]; It does not need to be as lengthy as Array `arr` This is what I have tried var dest = new Array(arr.length); for(var i = 0; i < arr.length; i++){ for(var k = 0; k < tgtArr.length; k++){ dest[i] = dest[i] || []; if(tgtArr[k].val == arr[i]){ dest[i] = arr[i]; } } } console.log(dest); My Expected output is (for above tgtArr value) [{}, {}, {}, {val:"a"}, {val:"b"}, {}]; if tgtArr is empty Array [{},{},{},{},{},{}] Here is the fiddle. Any alternative for this, it seems not a good way to me as I am iterating through the entire array everytime.

    Read the article

  • How expensive is a call to java.util.HashMap.keySet()?

    - by fx42
    I implemented a sparse matrix as List<Map<Integer,Double>>. To get all entries of row i I call list.get(i).keySet(). How expensive is this call? I also used the trove library for an alternative implementation as List<TIntDoubleHashMap>. What's the cost of calling list.get(i).keys(), here? Do you have any further ideas of how to implement an efficient sparse matrix? Or can you provide a list of existing implementations in java?

    Read the article

  • Conditional Statements - If Then vs. Select Case

    - by cloyd800
    I'm a bit new to programming, and based on the few sources I've read both on the web and the books I'm learning to teach myself they are able to define what IF THEN and SELECT CASE conditional statements are, but have failed to give a comparison as to why I would use one over the other and what best practices decide this. If I'm understanding these conditional statements correctly, then both are based on a set of conditions with an outcome based around meeting these conditions, and if no conditions are met then an alternative outcome can be defined. I'm having trouble in understanding when I would use an IF THEN statement, and when I'd use a SELECT CASE statement, and what best practices are used to define this decision. Any insight on this would be greatly appreciated!

    Read the article

  • Why am I getting a MySQL error?

    - by John Hoffman
    Here is my query. Its intention is allow access to properties of the animals that constitute a match of two animals. The match table contains columns for animal1ID and animal2ID to store which animals constitute the match. SELECT id, (SELECT * FROM animals WHERE animals.id=matches.animal1ID) AS animal1, (SELECT * FROM users WHERE animals.id=matches.animalID) AS animal2 FROM matches WHERE id=5 However, MySQl returns this error: Operand should contain 1 column(s). Why? Is there an alternative way to do this, perhaps with a JOIN statement?

    Read the article

  • [WPF] When Should I Retrieve Values from Textbox?

    - by they_soft
    Suppose I have a Window with TextBoxes I want to use the values. Right now I'm thinking of either: 1) Updating each associated value once the cursor is out of focus, and once the user presses Ok I start the program 2) Once the user presses Ok, I retrieve all the values at once then start the program I'm not sure which one is better though. First alternative seems more modular, but there's more semantic coupling since I each new box is supposed to be updating its respective value. I realize this isn't all that important, but I'm trying to understand when to centralize and when not to. Other better approachers are appreciated too.

    Read the article

  • Member classes versus #includes

    - by ShallowThoughts
    I've recently discovered that it is bad form to have #includes in your header files because anyone who uses your code gets all those extra includes they won't necessarily want. However, for classes that have member variables defined as a type of another class, what's the alternative? For example, I was doing things the following way for the longest time: /* Header file for class myGrades */ #include <vector> //bad #include "classResult.h" //bad class myGrades { vector<classResult> grades; int average; int bestScore; } (Please excuse the fact that this is a highly artificial example) So, if I want to get rid of the #include lines, is there any way I can keep the vector or do I have to approach programming my code in an entirely different way?

    Read the article

  • Varnish "FetchError no backend connection" error

    - by clueless-anon
    Varnishlog: 0 CLI - Rd ping 0 CLI - Wr 200 19 PONG 1340829925 1.0 12 SessionOpen c 79.124.74.11 3063 :80 12 SessionClose c EOF 12 StatSess c 79.124.74.11 3063 0 1 0 0 0 0 0 0 0 CLI - Rd ping 0 CLI - Wr 200 19 PONG 1340829928 1.0 0 CLI - Rd ping 0 CLI - Wr 200 19 PONG 1340829931 1.0 12 SessionOpen c 108.62.115.226 46211 :80 12 ReqStart c 108.62.115.226 46211 467185881 12 RxRequest c GET 12 RxURL c / 12 RxProtocol c HTTP/1.0 12 RxHeader c User-Agent: Pingdom.com_bot_version_1.4_(http://www.pingdom.com/) 12 RxHeader c Host: www.mysite.com 12 VCL_call c recv lookup 12 VCL_call c hash 12 Hash c / 12 Hash c www.mysite.com 12 VCL_return c hash 12 VCL_call c miss fetch 12 FetchError c no backend connection 12 VCL_call c error deliver 12 VCL_call c deliver deliver 12 TxProtocol c HTTP/1.1 12 TxStatus c 503 12 TxResponse c Service Unavailable 12 TxHeader c Server: Varnish 12 TxHeader c Content-Type: text/html; charset=utf-8 12 TxHeader c Retry-After: 5 12 TxHeader c Content-Length: 418 12 TxHeader c Accept-Ranges: bytes 12 TxHeader c Date: Wed, 27 Jun 2012 20:45:31 GMT 12 TxHeader c X-Varnish: 467185881 12 TxHeader c Age: 1 12 TxHeader c Via: 1.1 varnish 12 TxHeader c Connection: close 12 Length c 418 12 ReqEnd c 467185881 1340829931.192433119 1340829931.891024113 0.000051022 0.698516846 0.000074035 12 SessionClose c error 12 StatSess c 108.62.115.226 46211 1 1 1 0 0 0 256 418 0 CLI - Rd ping 0 CLI - Wr 200 19 PONG 1340829934 1.0 0 CLI - Rd ping 0 CLI - Wr 200 19 PONG 1340829937 1.0 netstat -tlnp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 3086/nginx tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1915/varnishd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1279/sshd tcp 0 0 127.0.0.2:25 0.0.0.0:* LISTEN 3195/sendmail: MTA: tcp 0 0 127.0.0.2:6082 0.0.0.0:* LISTEN 1914/varnishd tcp 0 0 127.0.0.2:9000 0.0.0.0:* LISTEN 1317/php-fpm.conf) tcp 0 0 127.0.0.2:3306 0.0.0.0:* LISTEN 1192/mysqld tcp 0 0 127.0.0.2:587 0.0.0.0:* LISTEN 3195/sendmail: MTA: tcp 0 0 127.0.0.2:11211 0.0.0.0:* LISTEN 3072/memcached tcp6 0 0 :::8080 :::* LISTEN 3086/nginx tcp6 0 0 :::80 :::* LISTEN 1915/varnishd tcp6 0 0 :::22 :::* LISTEN 1279/sshd /etc/nginx/site-enabled/default server { listen 8080; ## listen for ipv4; this line is default and implied listen [::]:8080 default ipv6only=on; ## listen for ipv6 root /usr/share/nginx/www; index index.html index.htm index.php; # Make site accessible from http://localhost/ server_name localhost; location / { # First attempt to serve request as file, then # as directory, then fall back to index.html try_files $uri $uri/ /index.html; } location /doc { root /usr/share; autoindex on; allow 127.0.0.2; deny all; } location /images { root /usr/share; autoindex off; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # #error_page 500 502 503 504 /50x.html; #location = /50x.html { # root /usr/share/nginx/www; #} # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { fastcgi_pass 127.0.0.2:9000; fastcgi_index index.php; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } /etc/nginx/sites-enabled/www.mysite.com.vhost server { listen 8080; server_name www.mysite.com mysite.com.net; root /var/www/www.mysite.com/web; if ($http_host != "www.mysite.com") { rewrite ^ http://www.mysite.com$request_uri permanent; } index index.php index.html; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac). location ~ /\. { deny all; access_log off; log_not_found off; } location / { try_files $uri $uri/ /index.php?$args; } # Add trailing slash to */wp-admin requests. rewrite /wp-admin$ $scheme://$host$uri/ permanent; location ~* \.(jpg|jpeg|png|gif|css|js|ico)$ { expires max; log_not_found off; } location ~ \.php$ { try_files $uri =404; include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.2:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } include /var/www/www.mysite.com/web/nginx.conf; location ~ /nginx.conf { deny all; access_log off; log_not_found off; } } /etc/varnish/default.vcl # This is a basic VCL configuration file for varnish. See the vcl(7) # man page for details on VCL syntax and semantics. # # Default backend definition. Set this to point to your content # server. # backend default { .host = "127.0.0.2"; .port = "8080"; # .connect_timeout = 600s; #.first_byte_timeout = 600s; # .between_bytes_timeout = 600s; # .max_connections = 800; Note: uncommenting the last four options at default.vcl made no difference. cat /etc/default/varnish # Configuration file for varnish # # /etc/init.d/varnish expects the variables $DAEMON_OPTS, $NFILES and $MEMLOCK # to be set from this shell script fragment. # # Should we start varnishd at boot? Set to "yes" to enable. START=yes # Maximum number of open files (for ulimit -n) NFILES=131072 # Maximum locked memory size (for ulimit -l) # Used for locking the shared memory log in memory. If you increase log size, # you need to increase this number as well MEMLOCK=82000 # Default varnish instance name is the local nodename. Can be overridden with # the -n switch, to have more instances on a single server. INSTANCE=$(uname -n) # This file contains 4 alternatives, please use only one. ## Alternative 1, Minimal configuration, no VCL # # Listen on port 6081, administration on localhost:6082, and forward to # content server on localhost:8080. Use a 1GB fixed-size cache file. # # DAEMON_OPTS="-a :6081 \ # -T localhost:6082 \ # -b localhost:8080 \ # -u varnish -g varnish \ # -S /etc/varnish/secret \ # -s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G" ## Alternative 2, Configuration with VCL # # Listen on port 6081, administration on localhost:6082, and forward to # one content server selected by the vcl file, based on the request. Use a 1GB # fixed-size cache file. # DAEMON_OPTS="-a :80 \ -T 127.0.0.2:6082 \ -f /etc/varnish/default.vcl \ -S /etc/varnish/secret \ -s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G" If you need any other info let me know. I am all out of clue as to whats the problem.

    Read the article

< Previous Page | 122 123 124 125 126 127 128 129 130 131 132 133  | Next Page >