Search Results

Search found 9082 results on 364 pages for 'c functions'.

Page 81/364 | < Previous Page | 77 78 79 80 81 82 83 84 85 86 87 88  | Next Page >

  • How to clean and simplify this code?

    - by alkalim
    After thinking about This Question and giving an answer to it I wanted to do more about that to train myself. So I wrote a function which will calc the length of an given function. Th given php-file has to start at the beginning of the needed function. Example: If the function is in a big phpfile with lots of functions, like /* lots of functions */ function f_interesting($arg) { /* function */ } /* lots of other functions */ then $part3 of my function will require to begin like that (after the starting-{ of the interesting function): /* function */ } /* lots of other functions */ Now that's not the problem, but I would like to know if there are an cleaner or simplier ways to do this. Here's my function: (I already cleaned a lot of testing-echo-commands) (The idea behind it is explained here) function f_analysis ($part3) { if(isset($part3)) { $char_array = str_split($part3); //get array of chars $end_key = false; //length of function $depth = 0; //How much of unclosed '{' $in_sstr = false; //is next char inside in ''-String? $in_dstr = false; //is nect char inside an ""-String? $in_sl_comment = false; //inside an //-comment? $in_ml_comment = false; //inside an /* */-comment? $may_comment = false; //was the last char an '/' which can start a comment? $may_ml_comment_end = false; //was the last char an '*' which may end a /**/-comment? foreach($char_array as $key=>$char) { if($in_sstr) { if ($char == "'") { $in_sstr = false; } } else if($in_dstr) { if($char == '"') { $in_dstr = false; } } else if($in_sl_comment) { if($char == "\n") { $in_sl_comment = false; } } else if($in_ml_comment) { if($may_ml_comment_end) { $may_ml_comment_end = false; if($char == '/') { $in_ml_comment = false; } } if($char == '*') { $may_ml_comment_end = true; } } else if ($may_comment) { if($char == '/') { $in_sl_comment = true; } else if($char == '*') { $in_ml_comment = true; } $may_comment = false; } else { switch ($char) { case '{': $depth++; break; case '}': $depth--; break; case '/': $may_comment = true; break; case '"': $in_dstr = true; break; case "'": $in_sstr = true; break; } } if($depth < 0) { $last_key = $key; break; } } } else echo '<br>$part3 of f_analysis not set!'; return ($last_key===false) ? false : $last_key+1; //will be false or the length of the function }

    Read the article

  • Android files manipulation

    - by klaus-vlad
    Hi, Through the housekeeping stuff my android application has to do is to read and write some files and sometimes to delete others and create new ones. The files in cause have all "sdcard/" as root. Is it safe if I perform all this task using Java style functions ? To me it is very handy to do it this way but I've read that not always the java functions can be applied when it comes to files in Android.

    Read the article

  • Merging Codeignitor with Wordpress

    - by matthewb
    I'm trying to utilize the power of wordpress to set up a blog on my site. I got it to install fine, but when trying to use wordpress's functions in a CI view the functions are undefined. http://codeigniter.com/forums/viewthread/48347/ I am following this. I put the require('blog/wp-blog-header.php') in my index.php file(ci) on the root. Any idea where I am messing up?

    Read the article

  • write javascript function

    - by sunglim
    I used to write javascript functions Utility = function (){}; Utility.SwapMember = function(name,id){ return ... }; Utility.GetCommnaNo = function(originalNo){ return ... }; .. alert(Utility.GetCommnaNo(totalCnt)); it's quite a bit nice way to make functions get together. But I think there must be better way. do you have any better way?

    Read the article

  • Can a math intensive application cause a crash?

    - by philcolbourn
    I have been messing with hash functions and functions to generate primes etc. I had 3 lock-ups in a short period. This was odd since my macbook rarely locks-up and usually only when I run out of memory - which does not happen often. But in this case, I had three in a row and none since (but I also am not generating as much load as before).

    Read the article

  • Activation Function, Initializer function, etc, effects on neural networks for face detection

    - by harry
    There's various activation functions: sigmoid, tanh, etc. And there's also a few initializer functions: Nguyen and Widrow, random, normalized, constant, zero, etc. So do these have much effect on the outcome of a neural network specialising in face detection? Right now I'm using the Tanh activation function and just randomising all the weights from -0.5 to 0.5. I have no idea if this is the best approach though, and with 4 hours to train the network each time, I'd rather ask on here than experiment!

    Read the article

  • What are All the Ways a Programmer Could use PHP to Send an Email?

    - by Alan Storm
    I'm looking for a list of built in PHP functions that a programmer could use to send an email. The obvious answer here is mail(), but I'm also looking for a list of functions someone might use to manually open a connection to an MTA, or spawn a process on the local machine which might in turn send an email using sendmail, postfix, etc. The context here is I want to scan a large, unknown codebase for code that's sending out email (because we already located a call to mail(), and that's not doing it)

    Read the article

  • SQL SERVER Project

    - by Saif Omari
    My Application Database Without Project and without Source safe, i planned to make my DB to be as project and add it to TFS, but I have no idea how to script the stored procedures, Triggers, Views, Functions, and what is the best practice to Make Update Script for All My stored procedures, Triggers, Views, and Functions to My customers DB.

    Read the article

  • c++ object sizes

    - by anon
    Suppose I have: struct Foo: public Bar { .... } Foo introduces no new member varaibles. Foo only introduces a bunch of member functions & static functions. Does any part of the C++ standard now guarantee me that: sizeof(Foo) == sizeof(Bar) ? Thanks!

    Read the article

  • What is the closest thing MATLAB has to namespaces?

    - by rlbond
    We have a lot of MATLAB code in my lab. The problem is there's really no way to organize it. Since all the functions have to be in the same folder to be called (or you have to add a bunch of folders to MATLAB's path environment variable), it seems that we're doomed have loads of files in the same folder, all in the global namespace. Is there a better way to organize our files and functions? I really wish there were some sort of module system...

    Read the article

  • Netbeans PHP autocomplete

    - by poru
    Hello, how could I add an autocomplete for PHP build-in functions like htmlentities or var_dump? The autocompleter work for my classes but there's not autocompletion for functions like mentioned above.

    Read the article

  • PL/SQL execption and Java programs

    - by edwards
    Hi Business logic is coded in pl/sql paackages procedures and functions. Java programs call pl/sql packages procedures and functions to do database work. Issue now is pl/sql programs store excpetions into Oracle tables whenever a execption is raised. How would my java programs get the execptions since the exception instead of being propogated from pl/sql to java is getting persisted to a oracle table.

    Read the article

  • Boost BGL thread safety

    - by Budzoli
    Hi! I'd like multiple threads to use the dijkstra_shortest_paths and astar_search functions of the BGL, and then read the property maps of the result vertices and edges. I'm wondering wether I should use mutexes to ensure thread-safety. So here are my questions: 1., Are the dijkstra_shortest_paths and astar_search functions of the Boost.Graph thread safe? 2., If I only try to read the property maps of the graph from multiple threads, do I need to worry about thread safety?

    Read the article

  • small scale web site - global javascript file style/format/pattern - improving maintainability

    - by yaya3
    I frequently create (and inherit) small to medium websites where I have the following sort of code in a single file (normally named global.js or application.js or projectname.js). If functions get big, I normally put them in a seperate file, and call them at the bottom of the file below in the $(document).ready() section. If I have a few functions that are unique to certain pages, I normally have another switch statement for the body class inside the $(document).ready() section. How could I restructure this code to make it more maintainable? Note: I am less interested in the functions innards, more so the structure, and how different types of functions should be dealt with. I've also posted the code here - http://pastie.org/999932 in case it makes it any easier var ProjectNameEnvironment = {}; function someFunctionUniqueToTheHomepageNotWorthMakingConfigurable () { $('.foo').hide(); $('.bar').click(function(){ $('.foo').show(); }); } function functionThatIsWorthMakingConfigurable(config) { var foo = config.foo || 700; var bar = 200; return foo * bar; } function globallyRequiredJqueryPluginTrigger (tooltip_string) { var tooltipTrigger = $(tooltip_string); tooltipTrigger.tooltip({ showURL: false ... }); } function minorUtilityOneLiner (selector) { $(selector).find('li:even').not('li ul li').addClass('even'); } var Lightbox = {}; Lightbox.setup = function(){ $('li#foo a').attr('href','#alpha'); $('li#bar a').attr('href','#beta'); } Lightbox.init = function (config){ if (typeof $.fn.fancybox =='function') { Lightbox.setup(); var fade_in_speed = config.fade_in_speed || 1000; var frame_height = config.frame_height || 1700; $(config.selector).fancybox({ frameHeight : frame_height, callbackOnShow: function() { var content_to_load = config.content_to_load; ... }, callbackOnClose : function(){ $('body').height($('body').height()); } }); } else { if (ProjectNameEnvironment.debug) { alert('the fancybox plugin has not been loaded'); } } } // ---------- order of execution ----------- $(document).ready(function () { urls = urlConfig(); (function globalFunctions() { $('.tooltip-trigger').each(function(){ globallyRequiredJqueryPluginTrigger(this); }); minorUtilityOneLiner('ul.foo') Lightbox.init({ selector : 'a#a-lightbox-trigger-js', ... }); Lightbox.init({ selector : 'a#another-lightbox-trigger-js', ... }); })(); if ( $('body').attr('id') == 'home-page' ) { (function homeFunctions() { someFunctionUniqueToTheHomepageNotWorthMakingConfigurable (); })(); } });

    Read the article

  • urgent..haskell mini interpreter

    - by mohamed elshikh
    i'm asked to implement this project and i have problems in part b which is the eval function this is the full describtion of the project You are required to implement an interpreter for mini-Haskell language. An interpreter is dened in Wikipedia as a computer program that executes, i.e. performs, instructions written in a programming language. The interpreter should be able to evaluate functions written in a special notation, which you will dene. A function is dened by: Function name Input Parameters : dened as a list of variables. The body of the function. The body of the function can be any of the following statements: a) Variable: The function may return any of the input variables. b) Arithmetic Expressions: The arithmetic expressions include input variables and addition, sub- traction, multiplication, division and modulus operations on arithmetic expressions. c) Boolean Expressions: The Boolean expressions include the ordering of arithmetic expressions (applying the relationships: <, =<, , = or =) and the anding, oring and negation of Boolean expressions. d) If-then-else statements: where the if keyword is followed by a Boolean expression. The then and else parts may be followed by any of the statements described here. e) Guarded expressions: where each case consists of a boolean expression and any of the statements described here. The expression consists of any number of cases. The rst case whose condition is true, its body should be evaluated. The guarded expression has to terminate with an otherwise case. f) Function calls: the body of the function may have a call to another function. Note that all inputs passed to the function will be of type Int. The output of the function can be of type Int or Bool. To implement the interpreter, you are required to implement the following: a) Dene a datatype for the following expressions: Variables Arithmetic expressions Boolean expressions If-then-else statements Guarded expressions Functions b) Implement the function eval which evaluates a function. It takes 3 inputs: The name of a function to be evaluated represented as a string. A list of inputs to that function. The arguments will always be of datatype Int. A list of functions. Each function is represented as instance of the datatype that you have created for functions. c) Implement the function get_type that returns the type of the function (as a string). The input to this function is the same as in part b. here is what i've done data Variable = v(char) data Arth= va Variable | Add Arth Arth | Sub Arth Arth | Times Arth Arth | Divide Arth Arth data Bol= Great Arth Arth | Small Arth Arth | Geq Arth Arth | Seq Arth Arth | And Bol Bol | Or Bol Bol | Neg Bol data Cond = data Guard = data Fun =cons String [Variable] Body data Body= bodycons(String) |Bol |Cond |Guard |Arth

    Read the article

  • How to call user define function when excel sheet being opened

    - by Nimo
    Hi, I'm trying to call a function when a workbook is being opened. I used workbook_open() event. But I notice that before calling function which is inside workbook_open(), all the functions that already exists in the workbook are being called. How can I call my function to execute before calling any of functions in the workbook? Thank you

    Read the article

  • Opening and snooping DLLs

    - by Russel
    Is there a way you can open and snoop DLLs? Like, see what functions are inside, etc? Is there some sort of header in them with tables of functions, information embedded by the maker of the dll, etc? Also, how do you find/view that information? Thanks! Russel

    Read the article

  • F# mutual recursion between modules

    - by rwallace
    For recursion in F#, existing documentation is clear about how to do it in the special case where it's just one function calling itself, or a group of physically adjacent functions calling each other. But in the general case where a group of functions in different modules need to call each other, how do you do it?

    Read the article

  • Access DLL without instantiating

    - by user330635
    I wrote a simple dll with only 2 functions in it. Is there a way to access these functions without having to instantiate them on every page? Can't I add them to the web.config somehow as assemblies thus giving me access to them?

    Read the article

  • What does 'engine' refer to in Drupal Theming?

    - by Nick Lowman
    I've been reading about Drupal theming and preprocess functions and noticed they listed engineName_engine_preprocess & engineName_engine_preprocess_hook in the order of preprocess functions but I'm not entirely sure what the engine layer is? I understand about the core, includes, modules and themes. Many thanks

    Read the article

  • Time Calculation in Python

    - by user343934
    Hi everyone, I have two python cgi pages (index, display), what i need to do is calculate time frame between the execution. Work flow: Index.py (submit) After submit it redirect to display.py page display.py page has got class with execute(),display() &init_main() functions In init_main() i have created class object which access to above functions I need to calculate time interval between the submit (index.py) to execute() end, so i can show user how much time does different weighted file takes on real time. Hoping to see your suggestions Thanks

    Read the article

  • Good JavaScript IDE with JQuery support ?

    - by Pop Catalin
    I'm planing to start learning JQuery (among other things), so I'm looking for a good Javascript editor that can preferably provide some of the following features: Syntax coloring Contextual help for standard JS functions, JQuery functions and possibly custom ones. Some code completion. (optional) JS debugging Is there such and editor out here? or any that come close to this?

    Read the article

< Previous Page | 77 78 79 80 81 82 83 84 85 86 87 88  | Next Page >