Search Results

Search found 203 results on 9 pages for 'hardcode'.

Page 1/9 | 1 2 3 4 5 6 7 8 9  | Next Page >

  • A good architecture is evil? Hardcode forever?

    - by igor
    I have worked in many companies. Most of all reached a big success in their field. Some times I found the code was written by owner or co-owner or the first developer of this company. It was strange from architectural point of view code or awful code styled, or hardcoded and so on. I know a couple of startups, that were grown up and were started from the "one night" code. Is it only way to get success to write code in this way? Why does a code written "on knee" but in time is better than delayed well thought-out one? What about future? Which way is the best: to write a good architecture, code and spend some more time at the startup or to write "fast" and hardcoded one that would be completely (partially) throw out (or maybe wouldn't) after some period of time (or never)?

    Read the article

  • How can I hardcode input with the "select" system call in C?

    - by Archer
    If I understand this system call "select" correctly, it will loop waiting for user input from the keyboard or from an outside server. Every time I call "message_loop", I'm going to type in the same few lines of input each time. Is there a way to hard code this in so I don't have to type it in each time? void message_loop(FILE* fpin, FILE* fpout, Socket sock) { fd_set readfds, readfds_bak ; int in, max_fd, n, ret ; char buf[MAXMESG]; in = fileno(fpin) ; FD_ZERO(&readfds) ; FD_SET(in, &readfds) ; FD_SET(sock.socketfd, &readfds) ; readfds_bak = readfds ; max_fd = ((in > sock.socketfd) ? in : sock.socketfd) + 1 ; while(1){ readfds = readfds_bak ; /* select function */ if((ret = select(max_fd, &readfds, NULL, NULL, NULL)) < 0){ perror("select") ; break ; } else if (ret != 0) { if(FD_ISSET(in, &readfds)){ /* keyboard input */ fgets(buf, MAXMESG, fpin) ; if(send_message(buf, sock) == -1) break ; } if(FD_ISSET(sock.socketfd, &readfds)){ /* messages from server */ n = receive_message(buf, MAXMESG, &sock) ; if(n == -1) break ; else if(n > 0){ fputs(buf, fpout) ; fputc('\n', fpout) ; } fflush(stdout) ; } } } }

    Read the article

  • DataReader - hardcode ordinals?

    - by David Neale
    When returning data from a DataReader I would typically use the ordinal reference on the DataReader to grab the relevant column: if (dr.HasRows) Console.WriteLine(dr[0].ToString()); (OR dr.GetString(0); OR (string)dr[0];)... I have always done this because I was advised at an early stage that using dr["ColumnName"] or a more elegant way of indexing causes a performance hit. However, whilst everything is becoming increasingly strongly-typed I feel more uncomfortable with this. I'm also aware that the above does not check for DBNull. How should data be returned from a DataReader?

    Read the article

  • How to embed/hardcode SRT subtitles into mp4 videos with VLC?

    - by Jens Bannmann
    I'm looking for a way to "burn in" or render/rembed/hardcode subtitles (from an SRT file) into an MP4 video with VLC. But no matter what options I use, it never works properly. I get a file that plays video way too fast (audio is normal), or one that plays normally, but actually does not have embedded subtitles. Also, with some options (like the one below) it does not play in QuickTime, only in VLC. So the main question is: how can I make this work in VLC? Secondary questions are: How do I decide which options I should set? Which settings are best if I want to leave the file bitrate etc. the same as much as possible, only embed subtitles? It seems I cannot leave the field empty or Video/Audio unchecked, so I guess I would first need to figure out the original audio and video bitrate. What do the "Scale" and "Channels" options mean? ... none of which are answered within the VLC documentation. For example, this is one set of options I used in the "Advanced Open File…" dialog: Advanced Open File… myFileName.mp4 [ ] Treat as a pipe rather than as a file [x] Load subtitles file: mySubtitleFileName.srt [ ] Play another media synchronously [x] Streaming/Saving Streaming and Transcoding Options [ ] Display the stream locally (o) File [outputFileName.mp4 ] [ ] Dump raw input Encapsulation Method: (MPEG 4 ) Transcoding options [x] Video (mp4v ) Bitrate (kb/s) [256 ] Scale [1 ] [x] Audio (mp3 ) Bitrate (kb/s) [128 ] Channels [1 ]

    Read the article

  • Is it ok to hardcode dynamic links in a permanent view?

    - by meder
    Let's say I wanted to showcase 2-3 clickable buttons on my homepage which will be there permanently. These are links to the css, html, and javascript tag listing pages. Is it fine to just hardcode href=/tags/css and href=/tags/html right in my django templates/view? I won't change them for at least a year or so, meaning I don't think I need to add a column to the tags table to distinguish them - is this common or should I try to make it somewhat dynamic? These tags are in a table but so are 1000 other tags.

    Read the article

  • Change Data Capture or Change Tracking - Same as Traditional Audit Trail Table?

    - by HardCode
    Before I delve into the abyss of Microsoft documentation any deeper, I'd like to know if someone experienced with Change Data Capture and Change Tracking know if one or both of these can be used to replace the traditional ... "Audit trail table copy of the 'real table' (all of the fields of the original table, plus date/time, user ID, and DML action field) inserted into by Triggers" ... setup for a database table audit trail, where the trigger populates the audit trail table (which is all manual work). The MSDN overview documentation explains at a high level what Change Data Capture and Change Tracking are, but it isn't clear enough to me, and doesn't state outright, that these tools can be used to replace the traditional audit trail tables we've made so often. Can someone with any experience using Change Data Capture and Change Tracking save me a lot of time, or confirm that I am spending time looking at the right tool? The critical part of our audit trail is capturing all changes to a table's fields (on INSERT, UPDATE, DELETE), when it happened, and who did it. These changes are commonly provided to an end user chronologically via an audit trail report. Which is another question ... Change Data Capture or Change Tracking is the solution, I'd assume that this data can be queried just like data from a normal table? EDIT: I need a permanent audit trail, irregardless of time. I see that Change Data Capture has to do with the transaction logs, so this sounds finite to me.

    Read the article

  • Am I Leaking ADO.NET Connections?

    - by HardCode
    Here is an example of my code in a DAL. All calls to the database's Stored Procedures are structured this way, and there is no in-line SQL. Friend Shared Function Save(ByVal s As MyClass) As Boolean Dim cn As SqlClient.SqlConnection = Dal.Connections.MyAppConnection Dim cmd As New SqlClient.SqlCommand Try cmd.Connection = cn cmd.CommandType = CommandType.StoredProcedure cmd.CommandText = "proc_save_my_class" cmd.Parameters.AddWithValue("@param1", s.Foo) cmd.Parameters.AddWithValue("@param2", s.Bar) Return True Finally Dal.Utility.CleanupAdoObjects(cmd, cn) End Try End Function Here is the Connection factory (if I am using the correct term): Friend Shared Function MyAppConnection() As SqlClient.SqlConnection Dim cn As New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("MyConnectionString").ToString) cn.Open() If cn.State <> ConnectionState.Open Then ' CriticalException is a custom object inheriting from Exception. Throw New CriticalException("Could not connect to the database.") Else Return cn End If End Function Here is the Dal.Utility.CleaupAdoObjects() function: Friend Shared Sub CleanupAdoObjects(ByVal cmd As SqlCommand, ByVal cn As SqlConnection) If cmd IsNot Nothing Then cmd.Dispose() If cn IsNot Nothing AndAlso cn.State <> ConnectionState.Closed Then cn.Close() End Sub I am getting a lot of "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding." error messages reported by the users. The application's DAL opens a connection, reads or saves data, and closes it. No connections are ever left open - intentionally! There is nothing obvious on the Windows 2000 Server hosting the SQL Server 2000 that would indicate a problem. Nothing in the Event Logs and nothing in the SQL Server logs. The timeouts happen randomly - I cannot reproduce. It happens early in the day with only 1 to 5 users in the system. It also happens with around 50 users in the system. The most connections to SQL Server via Performance Monitor, for all databases, has been about 74. The timeouts happen in code that both saves to, and reads from, the database in different parts of the application. The stack trace does not point to one or two offending DAL functions. It's happened in many different places. Does my ADO.NET code appear to be able to leak connections? I've goolged around a bit, and I've read that if the connection pool fills up, this can happen. However, I'm not explicitly setting any connection pooling. I've even tried to increase the Connection Timeout in the connection string, but timeouts happen long before the 300 second (5 minute) value: <add name="MyConnectionString" connectionString="Data Source=MyServer;Initial Catalog=MyDatabase;Integrated Security=SSPI;Connection Timeout=300;"/> I'm at a total loss already as to what is causing these Timeout issues. Any ideas are appreciated.

    Read the article

  • mod_rewrite capturing domain and tld

    - by sameold
    I'm using mod_write to rewrite this www.variabledomain.variableext to http://my.com/variabledomain.variableext Note that variabledomain and variableext are really variable, so I can't hardcode them. I'm not an expert at mod_rewrite, but I thought something like would work, but it isn't. Any ideas what I should be doing instead. RewriteRule ^(.*)\.(.*)\.(.*)$ http://my.com/$2\.$3 [R=301,L]

    Read the article

  • Are there solutions for streamlining the update of legacy code in multiple places?

    - by ccomet
    I'm working in some old code which was originally designed for handling two different kinds of files. I was recently tasked with adding a new kind of file to this code. Most of my problems were solved by filling out an extensive XML file with a new entry that handled everything from what lists were named to how the file is written in plural lower case. But this ended up being insufficient, as there were maybe 50 different places in 24 different code files where I had to update hardcoded switch-statements that only branched for the original two file types. Unfortunately there is no consistency in this; there are methods which operate half from the XML file, and half off of hardcode. Some of the files which look like they would operate off of the XML file don't, and some that I would expect that I'd need to update the hardcode don't need it. So the only way to find the majority of these is to run through testing the whole system when only part of it is operational, finding that one step to fix (when I'm lucky that error logging actually tells me what is going on), and then running the whole thing again. This wastes time testing the parts of the code which are already confirmed to work, time better spent testing the new parts I have to add on top of it all. It's a hassle and a half, and to my luck I can expect that I will have to add yet another new kind of file in the near future. Are there any solutions out there which can aid in this kind of endeavour? Something which I can input some parameters of current features, document what points in a whole code project actually need to be updated, and run something nice the next time I need to add a new feature to the code. It needn't even be fully automated, something that'll help me navigate straight to the specific points in everything and maybe even record what kind of parameters need to be loaded. Doubt it matters specifically, but the code is comprised of ASP.NET pages, some ASP.NET controls, hundreds of C# code files, and a handful of additional XML files. It's all currently in a couple big Visual Studio 2008 projects.

    Read the article

  • Compare Long values Struts2

    - by Marquinio
    Hi everyone I'm trying to compare two values using struts2 s:if tag but its not working. If I hardcode the values it works but I want it to be dynamic. The variable stringValue is of type String. The variable currentLongValue is of type Long. <s:set var="stringValue" value="order"/> <s:iterator value="listTest"> <s:set var="currentLongValue" value="value"/> <s:if test="#currentLongValue.toString() == #stringValue" > //Do something </s:if> <s:else> //Do something else </s:else> </s:iterator> For the s:if I have tried toString and also the equals(). It only works if I hardcode the values. Example: <s:if test="#currentLongValue == 1234"> Any clues? Thank you.

    Read the article

  • Protecting PDF files and XDO.CFG

    - by Greg Kelly
    Protecting PDF files and XDO.CFG Security related properties can be overridden at runtime through PeopleCode as all other XMLP properties using the SetRuntimeProperties() method on the ReportDefn class. This is documented in PeopleBooks. Basically this method need to be called right before calling the processReport() method: . . &asPropName = CreateArrayRept("", 0); &asPropValue = CreateArrayRept("", 0); &asPropName.Push("pdf-open-password"); &asPropValue.Push("test"); &oRptDefn.SetRuntimeProperties(&asPropName, &asPropValue); &oRptDefn.ProcessReport(&sTemplateId, %Language_User, &dAsOfDate, &sOutputFormat); Of course users should not hardcode the password value in the code, instead, if password is stored encrypted in the database or somewhere else, they can use Decrypt() api

    Read the article

  • Keeping an enum and a table in sync

    - by MPelletier
    I'm making a program that will post data to a database, and I've run into a pattern that I'm sure is familiar: A short table of most-likely (very strongly likely) fixed values that serve as an enum. So suppose the following table called Status: Status Id Description -------------- 0 Unprocessed 1 Pending 2 Processed 3 Error In my program I need to determine a status Id for another table, or possibly update a record with a new status Id. I could hardcode the status Id's in an enum and hope no one ever changes the database. Or I could pre-fetch the values based on the description (thus hardcoding that instead). What would be the correct approach to keep these two, enum and table, synced?

    Read the article

  • Buddypress with bbpress: Showing latest topics on front page

    - by MadsMadsDk
    I'm doing a wordpress solution with BuddyPress and bbPress, where I need to display the five newest topics on the homepage, as if it was blog-entries, but it seems kind of hard to accomplish. I'm figuring I gotta do something with the activity stream, but it seems like the stream is based on the user who is currently logged in, which is not what I want. So what should I do? Use a nifty plugin that does the trick (maybe someone knows a plugin I don't know of, as I've already tried the bbPress Latest Discussion plugin) Hardcode a forum-activity loop into the page-template file, using the is_front_page() function? Is there a forum-activity hook, that display the latest forum topics sitewide? Thanks in advance

    Read the article

  • Directory paths for resources and assets

    - by The Communist Duck
    If I have a file stucture for my final, released game something like: Main folder Media Images Other assets Sounds Executable List item And a different one for my 'in development' project, with the same Media folder but: Main Source and .obj, etc. Media with everything Bin folder with executable I obviously cannot hardcode file pathnames into this, like: "../Media/Image/evilguy.png" or "Media/Image/foo.jpg" because they wouldn't work with one of the builds and would require a lot of switching names. Instead, does it make sense for my resource manager, that loads everything, to have some kind of prefix path? Then, I can just do Get("foo.jpg") or Get("Sounds/boom.ogg") And simply switch out, for the final release, the ctr argument from the relative path for the development build to the release layout? If not, how have other people sorted these sorts of things out?

    Read the article

  • Is there an easier way to implement 301 redirects when converting a site to WordPress

    - by Amanda
    I have just converted a website to WordPress. The old site has hundreds of hard-coded html files, and the new site does not match the old site's directory structure or file naming system (bad SEO in the original site), so I can't place any "blanket" 301 redirects. Its been at least 2 months, and the old links are still appearing in Google searches, despite a google-friendly sitemap.xml. Do I need to hardcode a 301 for every individual page in my htaccess file, or am I just misunderstanding 301s and apache? Is there some other way I can update Google about the fact that my entire site structure has changed?

    Read the article

  • HDMI Audio stops after TV turned off

    - by Ryan
    After the 12.04 Update my HDMI audio stops working anytime I turn off my 2nd monitor(plasma TV). Graphics card is a Radeon 6800 which has DVI out to 1st monitor, HDMI out to receiver which the TV gets it's Audio/Video. Audio is always via my receiver sound. Things work fine as long as it boots with the TV and Receiver on. Turn off the TV and BART's HDMI audio will go away, and the HDMI option vanishes from the sound menu. I had an occasional HDMI issue with 11.10 but turning on/off the TV would fix the sound. How can I hardcode things so that it always uses HDMI out of audio? I suspect the TV is sending a signal upon that 12.04 is now listening for. Turning the TV back on does NOT resolve this, and I'd suggest having the ability to override this new "feature" via sound menu.

    Read the article

  • Searching global catalog

    - by Will I Am
    If I do a query (I plan to use SDS.P) against the global catalog, what should the starting path be so I can search the entire GC? I want to enumerate all users in GC, for example. Let's say my gc has users for 3 domains (one parent, two children): TEST.COM ONE.TEST.COM TWO.TEST.COM and i'm on a computer in ONE.TEST.COM. I do not want to hardcode DC=XXX,DC=yyy, I would like to determine that at runtime. TIA! -Will

    Read the article

  • Windows Batch Scripting Issue - Quoting Variables containing spaces

    - by Rick
    So here's my issue: I want to use %cd% so a user can execute a script anywhere they want to place it, but if %cd% contains spaces, then it will fail (regardless of quotes). If I hardcode the path, it will function with quotes, but if it is a variable, it will fail. Fails: (if %cd% contains spaces) "%cd%\Testing.bat" Works: "C:\Program Files\Testing.bat" Any ideas?

    Read the article

  • DRY URL's in Django Javascript

    - by Noio
    I'm using Django on Appengine. I'm using the django reverse() function everywhere, keeping everything as DRY as possible. However, I'm having trouble applying this to my client-side javascript. There is a JS class that loads some data depending on a passed-in ID. Is there a standard way to not-hardcode the URL that this data should come from? var rq = new Request.HTML({ 'update':this.element, }).get('/template/'+template_id+'/preview'); //The part that bothers me.

    Read the article

  • Fullcalendar event rendering

    - by Stian
    I would like to render an event to take up the entire space in a cell. For instance in the month view. Out of the box, the date is displayed on top, and then the event underneath. I want to ignore the date text and display the event over the intire cell, I don't want to hardcode the height of the event. Hope to get some pointers, I have looked everywhere in the javascript and css.

    Read the article

  • Python logger dynamic filename

    - by sharjeel
    I want to configure my Python logger in such a way so that each instance of logger should log in a file having the same name as the name of the logger itself. e.g.: log_hm = logging.getLogger('healthmonitor') log_hm.info("Testing Log") # Should log to /some/path/healthmonitor.log log_sc = logging.getLogger('scripts') log_sc.debug("Testing Scripts") # Should log to /some/path/scripts.log log_cr = logging.getLogger('cron') log_cr.info("Testing cron") # Should log to /some/path/cron.log I want to keep it generic and dont want to hardcode all kind of logger names I can have. Is that possible?

    Read the article

1 2 3 4 5 6 7 8 9  | Next Page >