Search Results

Search found 8776 results on 352 pages for 'boolean logic'.

Page 27/352 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • Logic to mirror byte value around 128

    - by Kazar
    Hey, I have a need to mirror a byte's value around the centre of 128. So, example outputs of this function include: In 0 Out 255 In 255 Out 0 In 128 Out 128 In 127 Out 1 In 30 Out 225 In 225 Out 30 I'm driving myself nuts with this, I'm sure I'll kick myself when I read the answers. Cheers

    Read the article

  • How add logic to Views? Ruby on Rails

    - by Gotjosh
    Right now I'm building a project management app in rails, here is some background info: Right now i have 2 models, one is User and the other one is Client. Clients and Users have a one-to-one relationship (client - has_one and user - belongs_to which means that the foreign key it's in the users table) So what I'm trying to do it's once you add a client you can actually add credentials (add an user) to that client, in order to do so all the clients are being displayed with a link next to that client's name meaning that you can actually create credentials for that client. What i can't figure it out how to do is, that if you actually have credentials in the database (meaning that there's a record in the users table with your client id) then don't display that link. Here's what i thought that would work <% for client in @client%> <h5> <h4><%= client.id %></h4> <a href="/clients/<%= client.id %>"><%= client.name %></a> <% for user in @user %> <% if user.client_id = client.id %> <a href="/clients/<%= client.id %>/user/new">Credentials</a> <%end%> <% end %> </h5> <% end %> And here's the controller: def index @client = Client.find_all_by_admin(0) @user = User.find(:all) end but instead it just puts the link the amount of times per records in the user table. Any help?

    Read the article

  • Custom bean instantiation logic in Spring MVC

    - by Michal Bachman
    I have a Spring MVC application trying to use a rich domain model, with the following mapping in the Controller class: @RequestMapping(value = "/entity", method = RequestMethod.POST) public String create(@Valid Entity entity, BindingResult result, ModelMap modelMap) { if (entity== null) throw new IllegalArgumentException("An entity is required"); if (result.hasErrors()) { modelMap.addAttribute("entity", entity); return "entity/create"; } entity.persist(); return "redirect:/entity/" + entity.getId(); } Before this method gets executed, Spring uses BeanUtils to instantiate a new Entity and populate its fields. It uses this: ... ReflectionUtils.makeAccessible(ctor); return ctor.newInstance(args); Here's the problem: My entities are Spring managed beans. The reason for this is to inject DAOs on them. Instead of calling new, I use EntityFactory.createEntity(). When they're retrieved from the database, I have an interceptor that overrides the public Object instantiate(String entityName, EntityMode entityMode, Serializable id) method and hooks the factories into that. So the last piece of the puzzle missing here is how to force Spring to use the factory rather than its own BeanUtils reflective approach? Any suggestions for a clean solution? Thanks very much in advance.

    Read the article

  • Are workflows good for web service business logic?

    - by JL
    I have a series of complex web services that are getting used in my SOA application. I am generally happy with the overall design of the application, but as the complexity grows, I was wondering if Windows Workflow might be the way to go. My motivations for this are that you can get a graphic representation of the applications functionality, so it would be easier to maintain the code by its business function, rather than what I have now ( a standard 3 tier class library structure). My concerns are: I would be inducing an abstraction in my code, and I don't want to spend time having to deal with possible WF quirks or bugs. I've never worked with WF, is it a solid technology? I don't want to hit any WF limitations that prevent me from developing my solution. Is a WF even the right solution for the task? Simply put I am considering writing my next web service in this app to call a WF, and in this work flow manage the tasks the web service needs to carry out. I think it will be much neater and easier to maintain than a regular c# class library (maintainable by namespaces, classes ). Do you think this is the right thing to do? I'm hoping for positive feedback on WF (.net 4), but brutal honestly at the end of the day would help more. Thanks

    Read the article

  • where should this check logic go?

    - by Benny
    I have a function that draw a string on graphics: private void DrawSmallImage(Graphics g) { if (this.SmallImage == null) return; var smallPicHeight = this.Height / 5; var x = this.ClientSize.Width - smallPicHeight; var y = this.ClientSize.Height - smallPicHeight; g.DrawImage(this.SmallImage, x, y, smallPicHeight, smallPicHeight); } the check if (this.SmallImage == null) return; should be in the function DrawSmallImage or should be in the caller? which is better?

    Read the article

  • Logic: Best way to sample & count bytes of a 100MB+ file

    - by Jami
    Let's say I have this 170mb file (roughly 180 million bytes). What I need to do is to create a table that lists: all 4096 byte combinations found [column 'bytes'], and the number of times each byte combination appeared in it [column 'occurrences'] Assume two things: I can save data very fast, but I can update my saved data very slow. How should I sample the file and save the needed information? Here're some suggestions that are (extremely) slow: Go through each 4096 byte combinations in the file, save each data, but search the table first for existing combinations and update it's values. this is unbelievably slow Go through each 4096 byte combinations in the file, save until 1 million rows of data in a temporary table. Go through that table and fix the entries (combine repeating byte combinations), then copy to the big table. Repeat going through another 1 million rows of data and repeat the process. this is faster by a bit, but still unbelievably slow This is kind of like taking the statistics of the file. NOTE: I know that sampling the file can generate tons of data (around 22Gb from experience), and I know that any solution posted would take a bit of time to finish. I need the most efficient saving process

    Read the article

  • database logic for tracking each and every operation in my web application

    - by ripa
    I am developing an Web application. In my application, I need to keep track of each and every operation for every logged in user. I have planned following for achieving this task:- I will create stored procedure in mysql. I will trigger this procedure on each table's insert , update delete. This is an tough job for me. Will anybody direct me in the right way? I am using PHP based Codeigniter framework and mysql database.

    Read the article

  • programing logic and design plzzzzzzzzz help [closed]

    - by alex
    `*the midvile park maintains records containing info about players on it's soccer teams . each record contain a players first name,last name,and team number . the team are team number team name 1 goal getters 2 the force 3 top gun 4 shooting stars 5 midfield monsters design a proggram that accept player data and creates a report that lists each player along with his or her team number and team name

    Read the article

  • Where to place logic in a rich domain model

    - by Fino
    I have a model "news item" which contains text, image etc to display as latest news on several pages in a website. This "news item" can also be posted to Twitter or Facebook. Is it clean to implement a method post inside the news item model and inject the different post implementations as a strategy? Or is it better to have a separate application service for this? Thanks

    Read the article

  • [MVC] logic before dispatcher + controller?

    - by Spoonface
    I believe for a typical MVC web application the router / dispatcher routine is used to decide which controller is loaded based primarily on the area requested in the url by the user. However, in addition to checking the url query string, I also like to use the dispatcher to check whether the user is currently logged in or not to decide which controller is loaded. For example if they are logged in and request the login page, the dispatcher would load their account instead. But is this a fairly non-standard design? Would it violate MVC in any way? I only ask as the examples I've read through this weekend have had no major calculations performed before the dispatcher routine, and commonly check whether the user is logged in or not per controller, and then redirect where necessary. But to me it seems odd to redirect a logged in user from the login area to account area if you could just load the account controller in the first place? I hope I've explained my consternation well enough, but could anyone offer some details on how they handle logged in users, and similar session data?

    Read the article

  • Create multiple columns on one sheet from 1 column on another with logic

    - by user450252
    I am new to VBA and I am struggling trying to make this work. I am in need of a macro that will process each cell\column on Sheet1 and put the results on Sheet2. I'm sure this is pretty easy for those who are more advanced with VB code. It contains many columns.. Anytime we encounter a — or an empty cell, we populate the cell with -999 (see the example on Sheet2) on the first column, which contains "0-2". Then we create 2 new columns and populate them with 0 on the first column and 2 on second column (see example on Sheet2). If a value is found on only one side, we then populate both sides with the same number. As each column is being process in Sheet1 and Sheet1: A B Column1 Column2 Title Title2 0–2 0–4 3 — — 5 — — — 10–23 11—29 And the results should look like this on Sheet2 Sheet2 A B C D Column1 Column1 Column2 Column2 Title-A Title-B Title-A Title-B 0 2 0 4 3 3 -999 -999 -999 -999 5 5 -999 -999 -999 -999 —999 -999 -999 -999 10 23 11 29

    Read the article

  • simple query Delete records in a table based on count logic

    - by user1905941
    a table with a pk and status column which is having values as 'Y','N','NULL' Query: get the count of records with status column as 'Y', if this count exceeds 1% of total count of records then dont delete , else delete the records in the table. i tried like this Declare v_count Number; v_count1 Number; BEGIN v_count := select count(*) from temp; v_count1 := select count(*) from temp where status = 'Y' ; v_count := v_count + ((0.1) * (v_count)) if (v_count1 > v_count) { insert into temp1 values(pk,status) } else { Delete from temp ; } END;

    Read the article

  • jQuery if and logic

    - by danit
    I have a simple jQuery toolbar, the basic functionality is: Hover: Background change to defined value & add .active class OnClick: Move the icon down 4px, and change background of the toolbar to that of the element What I would like to do move the icon down 4px when it has the class 'active' applied, however also remove the onclick event? Somehow I need an 'IF' statement in my jQuery for the Onclick event.

    Read the article

  • How to filter rows in JTable based on boolean valued columns?

    - by vinny
    Im trying to filter rows based on a column say c1 that contains boolean values. I want to show only rows that have 'true' in c1. I looked up the examples in http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#sorting. The example uses a regex filter. Is there any way I can use boolean values to filter rows? Following is the code Im using (borrowed from the example) private void filter(boolean show) { RowFilter<TableModel, Object> filter = null; TableModel model = jTb.getModel(); boolean value = (Boolean) model.getValueAt(0,1); //If current expression doesn't parse, don't update. try { // I need to used 'value' to filter instead of filterText. filter =RowFilter.regexFilter(filterText, 0); } catch (java.util.regex.PatternSyntaxException e) { return; } sorter.setRowFilter(filter); } thank you.

    Read the article

  • How to define clock input in Xilinx

    - by seventeen
    Hey, I have almost no experience with Xilinx. I have a group project for a Digital Logic course that is due soon, where my partner, who was supposed to take care of the Xilinx simulations decided to bail on me. So here I am trying to figure it out last minute. I have designed a synchronous counter using a few JK Flip Flops and I need to define the CLK input for the FJKCs. I have drawn up the correct schematic, but I cannot figure out how to define a clock input. Any help appreciated, and yes, this is homework. I just can't find any basic xilinx documentation/tutorials online and I honestly don't have time to learn the whole IDE.

    Read the article

  • How to handle BL cache for multiple web applications?

    - by Eran Betzalel
    I recently received a project that contains multiple web applications with no MVC structure. For starters I've created a library (DLL) that will contain the main Business Logic. The problem is with Caching - If I use the current web context cache object than I might end up with duplicate caching (as the web context will be different for every application). I'm currently thinking about implementing a simple caching mechanism with a singleton pattern that will allow the different web sites (aka different application domains) to share their "caching wisdom". I'd like to know what is the best way to solve this problem.

    Read the article

  • Inverse Logistic Function / Reverse Sigmoid Function

    - by Chanq
    I am currently coding up a fuzzy logic library in java. I have found the equations for all the standard functions - Grade, inverseGrade, Triangle, Trapezoid, Gaussian. However, I can't find the inverse of the sigmoid/ logistic function. The way I have written the logistic function is java is : //f(x) = 1/(1+e(-x)) public double logistic(double x){ return (1/(1+(Math.exp(-x))); } But I can't work out or find the inverse anywhere. My algebraic/calculus abilities are fairly limited, hence why I haven't been able to work out the inverse of the function. Any hints or pointers would be a big help. Thanks

    Read the article

  • Creating many new instances vs reusing them?

    - by Hugo Riley
    I have multiple business entities in VB.NET Windows Forms application. Right now they are instanced on application startup and used when needed. They hold descriptions of business entities and methods for storing and retrieving data. To cut the long story short, they are somewhat heavy objects to construct (they have some internal dictionaries and references to other objects) created and held in one big global variable called "BLogic". Should I refactor this so that each object is created when needed and released when out of scope? Then every event on UI will probably create a few of this objects. Should I strive to minimize creation of new objects or to minimize number of static and global objects? Generally I am trying to minimize the scope of every variable but should I treat this business logic objects specially?

    Read the article

  • What free expert system can You recommend (with higher functionality then CLIPS)?

    - by Martin
    Hi, I'm trying to find best free expert system, with the highest functionality. I know about CLIPS, but is there another system, for example being able to accept percent of confidence for each rule (fuzzy logic). I need it to know will I be able to do fast a short project using expert system, with highest functionality. But anyways, it's interesting is there an open source program that aims to gather different AI methods (whitch there are plenty of), and use them together. So I would be extremely thankeful for any info about more robust CLIPS, or similar programs. Thanks!

    Read the article

  • Passing HttpFileCollectionBase to the Business Layer - Bad?

    - by Terry_Brown
    hopefully there's an easy solution to this one. I have my MVC2 project which allows uploads of files on certain forms. I'm trying to keep my controllers lean, and handle the processing within the business layer of this sort of thing. That said, HttpFileCollectionBase is obviously in the System.Web assembly. Ideally I want to call to something like: UserService.SaveEvidenceFiles(MyUser user, HttpFileCollectionBase files); or something similar and have my business layer handle the logic of how and where these things are saved. But, it feels a little icky to have my models layer with a reference to System.Web in terms of separation of concerns etc. So, we have (that I'm aware of) a few options: the web project handling this, and my controllers getting fatter mapping the HttpFileCollectionBase to something my business layer likes passing the collection through, and accepting that I reference System.Web from my business project Would love some feedback here on best practice approaches to this sort of thing - even if not specifically within the context of the above.

    Read the article

  • SQL finding overlapping of times pass midnight (across 2 days)

    - by janechii
    Hi everyone, I know there are lots of these types of questions, but i didn't see one that was similar enough to my criteria. So i'd like to ask for your help please. The fields i have are just start and end which are of time types. I cannot involve any specific dates in this. If the time ranges don't go pass midnight across day, i'd just compare two tuples as such: end1 > start2 AND start1 < end2 (end points touching are not considered overlapped here.) But when I involve time range that pass (or at) midnight, this obviously doesn't work. For example, given: start | end --------+-------- 06:00PM | 01:00AM 03:00PM | 09:00PM Without involving dates, how can i achieve this, please. My assumption is, if end is less than start, then we're involving 2 days. I'm trying to do this in plain standard SQL, so just a simple and concise logic in the WHERE clause. Thank you everyone!

    Read the article

  • Need help replicating directory structure with ColdFusion and jsTree

    - by Derek
    I am using this new jQuery plugin called jsTree www.jstree.com and using the HTML datasource. I am also using ColdFusion 7 with cfdirectory and filtering out files, so just dirs. I need to recreate the directory structure in the image, well any dir structure I give it actually. I am having a heck of a time with the logic. variables.imageDirectoriesLen = 8 in this scenario cause I am outputting from the middle of the actual file path, not from begining. Thanks for the help. Derek this is what I have so far <cfoutput query="clientImageDirsFilter"> <cfset nextLen = 0 /> <cfset nextDir = "" /> <cfset nextRowCnt = currentRow+1 /> <cfset nextDir = clientImageDirsFilter.directory[nextRowCnt] & "\" & clientImageDirsFilter.name[nextRowCnt] /> <cfset nextLen = listLen(nextDir, "\") /> <cfset currLen = listLen(clientImageDirsFilter.directory & "\" & clientImageDirsFilter.name,"\") /> <cfif currLen eq nextLen> <li rel="folder" id="node_#randRange(1,99999)#"><a href="##"><ins>&nbsp;</ins>#clientImageDirsFilter.name#</a></li> <cfelseif nextLen lt currLen> <cfif nextLen eq 0> #repeatString("</li></ul>",(currLen-nextLen-variables.imageDirectoriesLen))# </cfif> <cfelse> <ul> <li rel="folder" id="node_#randRange(1,99999)#"><a href="##"><ins>&nbsp;</ins>#clientImageDirsFilter.name#</a> <ul> </cfif>

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >