Daily Archives

Articles indexed Tuesday June 15 2010

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

  • Passing values for method

    - by Kasun
    I beginner for programming. So can you please show me how to pass values for your compile() method. class CL { private const string clexe = @"cl.exe"; private const string exe = "Test.exe", file = "test.cpp"; private string args; public CL(String[] args) { this.args = String.Join(" ", args); this.args += (args.Length > 0 ? " " : "") + "/Fe" + exe + " " + file; } public Boolean Compile(String content, ref string errors) { //remove any old copies if (File.Exists(exe)) File.Delete(exe); if (File.Exists(file)) File.Delete(file); File.WriteAllText(file, content); Process proc = new Process(); proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.RedirectStandardError = true; proc.StartInfo.FileName = clexe; proc.StartInfo.Arguments = this.args; proc.StartInfo.CreateNoWindow = true; proc.Start(); //errors += proc.StandardError.ReadToEnd(); errors += proc.StandardOutput.ReadToEnd(); proc.WaitForExit(); bool success = File.Exists(exe); return success; } }

    Read the article

  • ActionLink Problem with Client Template Telerik MVC grid

    - by Tassadaque
    Hi, i m using Telerik grid to present memos received by user below is the code <%Html.Telerik().Grid<UserManagement.Models.SentMemos>() .Name("ReceivedMemos") .Sortable(sorting => sorting .OrderBy(sortOrder => sortOrder.Add(o => o.MemoDate).Descending())) .DataBinding(dataBinding => dataBinding //Ajax binding .Ajax() //The action method which will return JSON .Select("_AjaxBindingReceivedMemos", "OA" ) ). Columns(colums => { colums.Bound(o => o.MemoID).ClientTemplate(Html.ActionLink("Reply", "ReplyMemo", "OA", new { MemoID = "<#=MemoID#>"}, null).ToString()).Title("Reply").Filterable(false).Sortable(false); colums.Bound(o => o.MemoID).ClientTemplate(Html.ActionLink("Acknowledge", "PreviewMemo", "OA", new { id = "<#=MemoID#>"}, null).ToString()).Title("Acknowledge").Filterable(false).Sortable(false); colums.Bound(o => o.Subject).ClientTemplate(Html.ActionLink("<%#=Subject#>", "PreviewMemo", "OA", new { id = "<#=MemoID#>" }, null).ToString()).Title("Subject"); //colums.Bound(o => Html.ActionLink(o.Subject,"PreviewMemo","OA",new{id=o.MemoID},null).ToString()).Title("Subject"); colums.Bound(o => o.FromEmployeeName); colums.Bound(o => o.MemoDate); }) .Sortable() .Filterable() .RowAction((row) => { row.HtmlAttributes.Add("style", "background:#321211;"); }) .Pageable(pager=>pager.PageSize(6)) .PrefixUrlParameters(false) //.ClientEvents(events => events.OnRowDataBound("onRowDataBound")) .Render(); %> where i m binding third column (Subject) my intention is to make an ActionLink where subject is the display text and i want a dynamic ID coming from <#=MemoID#. memo id is working fine and gives me a link with dynamic Memo IDs. the problem is with the subject i.e ("<#=Subject#") is rendered as it is on the screen without mapping to the actual subject of the memo. i have also tried ("<%#=Subject%") but to no gain. any help is highly appriciated regards

    Read the article

  • WPF Binding issues

    - by Nitin Chaudhari
    I have WPF window which binds a local Dependency property to a property of my usercontrol. So now I see the value which the window gave me in my usercontrol. I achieve this by setting DataContext of window to the window itself Now once the window is loaded i set the DataContext of usercontrol to a ViewModel class, and at some point of time(based on user action) the control changes values in the control. All fine so far. But now the changed value is not reflected in Windows dependency property. How I can resolve this issue?

    Read the article

  • jQuery select number of tags

    - by ninumedia
    I have multiple comment ids I want to reset to a default value. Ex: <a id="comments_inner_toggle_45">example 1</a> <a id="comments_inner_toggle_608">example 2</a> <a id="comments_inner_toggle_28">example 3</a> ... How can I write the correct tag in jQuery to select every tag with an id of "comments_inner_toggle_" and perform some operation on it? I think it's something similar to: $('a[id|=comments_inner_toggle_]').whatever This is wrong however because the code above will only match the tag with "comments_inner_toggle_" and not with a number appended at the end. How can I fix this? thanks for the help! :)

    Read the article

  • Core data and special characters (UTF-8)

    - by MW
    I have an iPhone application using Core Data with an SQLite database in the bottom. I'm writing some text content from the database to a file, but special characters such as Å, Ä and Ö are corrupted in the file (they show up just fine in the application). When creating and inserting data, I am not using any special encoding. I'm just taking the NSString (entered by the user in a UITextField) and putting it in my persistent objects. When saving the file, I use the following code: [csvString writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:&error]; I tried adding a BOM to the beginning of the text ("\xef\xbb\xbf") but it is still corrupted. Anyone has any ideas where the problem might be? Examples of corrupted characters: å becomes ö, ä becomes ä

    Read the article

  • PostgreSQL - fetch the row which has the Max value for a column

    - by Joshua Berry
    I'm dealing with a Postgres table (called "lives") that contains records with columns for time_stamp, usr_id, transaction_id, and lives_remaining. I need a query that will give me the most recent lives_remaining total for each usr_id There are multiple users (distinct usr_id's) time_stamp is not a unique identifier: sometimes user events (one by row in the table) will occur with the same time_stamp. trans_id is unique only for very small time ranges: over time it repeats remaining_lives (for a given user) can both increase and decrease over time example: time_stamp|lives_remaining|usr_id|trans_id ----------------------------------------- 07:00 | 1 | 1 | 1 09:00 | 4 | 2 | 2 10:00 | 2 | 3 | 3 10:00 | 1 | 2 | 4 11:00 | 4 | 1 | 5 11:00 | 3 | 1 | 6 13:00 | 3 | 3 | 1 As I will need to access other columns of the row with the latest data for each given usr_id, I need a query that gives a result like this: time_stamp|lives_remaining|usr_id|trans_id ----------------------------------------- 11:00 | 3 | 1 | 6 10:00 | 1 | 2 | 4 13:00 | 3 | 3 | 1 As mentioned, each usr_id can gain or lose lives, and sometimes these timestamped events occur so close together that they have the same timestamp! Therefore this query won't work: SELECT b.time_stamp,b.lives_remaining,b.usr_id,b.trans_id FROM (SELECT usr_id, max(time_stamp) AS max_timestamp FROM lives GROUP BY usr_id ORDER BY usr_id) a JOIN lives b ON a.max_timestamp = b.time_stamp Instead, I need to use both time_stamp (first) and trans_id (second) to identify the correct row. I also then need to pass that information from the subquery to the main query that will provide the data for the other columns of the appropriate rows. This is the hacked up query that I've gotten to work: SELECT b.time_stamp,b.lives_remaining,b.usr_id,b.trans_id FROM (SELECT usr_id, max(time_stamp || '*' || trans_id) AS max_timestamp_transid FROM lives GROUP BY usr_id ORDER BY usr_id) a JOIN lives b ON a.max_timestamp_transid = b.time_stamp || '*' || b.trans_id ORDER BY b.usr_id Okay, so this works, but I don't like it. It requires a query within a query, a self join, and it seems to me that it could be much simpler by grabbing the row that MAX found to have the largest timestamp and trans_id. The table "lives" has tens of millions of rows to parse, so I'd like this query to be as fast and efficient as possible. I'm new to RDBM and Postgres in particular, so I know that I need to make effective use of the proper indexes. I'm a bit lost on how to optimize. I found a similar discussion here. Can I perform some type of Postgres equivalent to an Oracle analytic function? Any advice on accessing related column information used by an aggregate function (like MAX), creating indexes, and creating better queries would be much appreciated! P.S. You can use the following to create my example case: create TABLE lives (time_stamp timestamp, lives_remaining integer, usr_id integer, trans_id integer); insert into lives values ('2000-01-01 07:00', 1, 1, 1); insert into lives values ('2000-01-01 09:00', 4, 2, 2); insert into lives values ('2000-01-01 10:00', 2, 3, 3); insert into lives values ('2000-01-01 10:00', 1, 2, 4); insert into lives values ('2000-01-01 11:00', 4, 1, 5); insert into lives values ('2000-01-01 11:00', 3, 1, 6); insert into lives values ('2000-01-01 13:00', 3, 3, 1);

    Read the article

  • What is DEFAULT_CC in function declaration?

    - by humoeba
    I'm relatively new to C, and am curious what this syntax means in a function declaration: int DEFAULT_CC foo(void) where DEFAULT_CC is probably defined somewhere else as: #define DEFAULT_CC "cc" Is this a direction to use a certain compiler or something?

    Read the article

  • How do you debug why Windows is slow?

    - by aaron
    I've got Vista Biz and when my machine chugs I think it is because of paging, but I never know how to verify this. Procexp doesn't seem to provide useful information because it appears that nothing is going on when the chugs happen. perfmon seems like it has the counters I need, but I'm never sure what counters I should add to cover the information I want. For perfmon, I prefer numbers that are percents, so I can gauge load. Here are the counters I have up, but they don't always seem to correlate to chugs: - % disk time (logical) - page faults/sec (an indicator of lots of paging activity) - processor/%priviliged time

    Read the article

  • no pg_hba.conf entry for host

    - by Priya
    Hi All I am new to Perl as well as Postgresql I get following error when i try to connect using DBI DBI connect('database=chaosLRdb;host=192.168.0.1;port=5433','postgres',...) failed: FATAL: no pg_hba.conf entry for host "192.168.0.1", user "postgres", database "chaosLRdb", SSL off Here is my pg_hba.conf file: # "local" is for Unix domain socket connections only local all all md5 # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5 host all postgres 127.0.0.1/32 trust host all postgres 192.168.0.1/32 trust host all all 192.168.0.1/32 trust host all all 192.168.0.1/128 trust host all all 192.168.0.1/32 md5 host chaosLRdb postgres 192.168.0.1/32 md5 local all all 192.168.0.1/32 trust My perl code is #!/usr/bin/perl-w use DBI; use FileHandle; print "Start connecting to the DB...\n"; @ary = DBI->available_drivers(true); %drivers = DBI->installed_drivers(); my $dbh = DBI->connect("DBI:PgPP:database=chaosLRdb;host=192.168.0.1;port=5433", "postgres", "chaos123"); May I know what i miss here?

    Read the article

  • Resizing FileReference image then reuploading, only reuploads original image.

    - by pfunc
    I can;t figure out how to do this. Someone selects and image after calling FileReference.browse(). I take that image and make a thumbnail in flash. Then I upload that image like so: var newFileReq:URLRequest = new URLRequest(FILE_UPLOAD_TEMP); newFileReq.contentType = "application/octet-stream"; var fileReqVars:URLVariables = new URLVariables(); fileReqVars.image = myThumbImage; fileReqVars.folder = "Thumbs"; newFileReq.data = fileReqVars; newFileReq.method = URLRequestMethod.POST; //upload the first image fileRef.addEventListener(Event.COMPLETE, onFirstFileUp); fileRef.upload(newFileReq, "Filedata"); All this does it upload the original image. How do I change the fileRef to upload the new thumb? I have traced out the size of the "myThumbImage" and it is correct. I have placed it visually on the stage after creating the thumb, and it seems like it works. But when I upload it to an aspx page (that basically just throws it into a folder), it uploads the original larger image.

    Read the article

  • Faulty to use memcache together with a php web-browser-game in this way?

    - by Crowye
    Background We are currently working on a strategy web-browser game based on php, html and javascript. The plan is to have 10,000+ users playing within the same world. Currently we are using memcached to: store json static data, language files store changeable serialized php class objects (such as armies, inventorys, unit-containers, buildings, etc) In the back we have a mysql server running and holding all the game data aswell. When a object is loaded through our ObjectLoader it loads in this order: checks a static hashmap in the script for the object checks memcache if it has already been loaded into it otherwise loads from database, and saves it into memcache and the static temp hashmap We have built the whole game using a class-object-oriented approach where functionality is always made between objects. Beause of this we think we have managed to get a nice structure, and with the help of memcached we have received good request times from client-server when interacting with the game. I'm aware that memcache is not synchronized, and also is not commonly used for holding a full game in memory. In the beginning after a server's startup the load times when loading objects into memcache for the first time will be high, but after the server's been online for a while and most loads are from memcache, the loads will be well reduced. Currently we are saving changed objects into memcache and database at the same time. Earlier we had an idea to save objects into db only after a certain time or at intervals, but due to risk inconsistency if the memcache/server went down, we skipped it for now. Client requests to server often return object's status simple json-format without changing the object, which in turn is represented in the browser visually with images and javascript. But from time to time depending on when an object was last updated, it updates them with new information (e.g. a build-queue holding planned buildings time-progress is increased, and/or planned-queue-items-array has changed). Questions: Do you see how this could work or are we walking in blindness here? Do you expect us to have a lot of inconsistency issues if someone loads and updates the a memcache objects while someone else does the same? Is it even doable to do it in the way he have done it? Seems to be working fine atm, but so far we have only been 4 people online at the same time.. Is some other cache program more fit for this class-object approach than memcached? Is there any other tips you have for this situation? UPDATE Since it is simply a "normal webpage" (no applet, flash, etc), we are implementing the game so that the server is the only one holding a "real game-state".. the state of the different javascript-objects on the client is more like a approximative version of the server's game state. From time to time and before you do certain things important things, the client's visual state is updated to the server's state (e.g. the client things he can afford a barracks, asks the server to build a barracks, server updates current resources according to income-data on server and then tries to build a barracks or casts an error-message, and then sends the current server-state on resources, buildings back to the client).. It is not a fast-paced game lika real strategy game. More like a quite slow 3-4 months playtime game, where buildings can take +1 minute up to several days to complete.

    Read the article

  • Question about rights for svn

    - by diadiora
    I have a web application written in asp.net mvc. I have in MyApp.Web assembly the list of views and and the content files(images, scripts, css, and so on). In MyApp.WebBase I have the rest of fonctionality(Controllers, domain(entities, repositories, services)). Now the question is the following: I want to give to third party html coder access only to MyApp.Web source code in order he to be able to compile the application locally and see the results. By other hand the developer team shoul have access to full source code. The problem is that in order the html coder to be able to compile the application locally he need in his project the references to the MyApp.WebBase.dll Can anyone help me? Thanks.

    Read the article

  • Get data on the basis of conditions in entity framework 3.5 with include

    - by Ashwani K
    Hello All: I am using entity framework 3.5 for my application. I want load data based on some condition e.g. var data = from e in context.Employee.Include("Employee.Projects") where e.IsActive select e; Using this, I will get all the Employees which are active with their project details. But I want to load only those projects which are active. So, how to load only active projects using the query? Thanks Ashwani

    Read the article

  • Getting data from the next row in Oracle cursor

    - by Chaotic_one
    Hi, I'm building nested tree and I need to get data for the next row in cursor, using Oracle. And I still need current row, so looping forward is not a solution. Example: OPEN emp_cv FOR sql_stmt; LOOP FETCH emp_cv INTO v_rcod,v_rname,v_level; EXIT WHEN emp_cv%NOTFOUND; /*here lies the code for getting v_next_level*/ if v_next_level > v_level then /*code here*/ elsif v_next_level < v_level then /*code here*/ else /*code here*/ end if; END LOOP; CLOSE emp_cv;

    Read the article

  • rails + compass: advantages vs using haml + blueprint directly

    - by egarcia
    I've got some experience using haml (+sass) on rails projects. I recently started using them with blueprintcss - the only thing I did was transform blueprint.css into a sass file, and started coding from there. I even have a rails generator that includes all this by default. It seems that Compass does what I do, and other things. I'm trying to understand what those other things are - but the documentation/tutorials weren't very clear. These are my conclusions: Compass comes with built-in sass mixins that implement common CSS idioms, such as links with icons or horizontal lists. My solution doesn't provide anything like that. (1 point for Compass). Compass has several command-line options: you can create a rails project, but you can also "install" it on an existing rails project. A rails generator could be personalized to do the same thing, I guess. (Tie). Compass has two modes of working with blueprint: "basic" and "semantic" usage. I'm not clear about the differences between those. With my rails generator I only have one mode, but it seems enough. (Tie) Apparently, Compass is prepared to use other frameworks, besides blueprint (e.g. YUI). I could not find much documentation about this, and I'm not interested on it anyway - blueprint is ok for me (Tie). Compass' learning curve seems a bit stiff and the documentation seems sparse. Learning could be a bit difficult. On the other hand, I know the ins and outs of my own system and can use it right away. (1 point for my system). With this analysis, I'm hesitant to give Compass a try. Is my analysis correct? Are Am I missing any key points, or have I evaluated any of these points wrongly?

    Read the article

  • how to get right offset of an element? - jQuery

    - by Alex
    This is probably a really simple question, but how do I go about getting the right offset of an element in jQuery? I can do: $("#whatever").offset().left; and it is valid. But it seems that: $("#whatever").offset().right is undefined. So how does one accomplish this in jQuery? Thanks!!

    Read the article

  • Deploying my flex application

    - by Vatsala
    Hi, I am doing some trial testing awith Amazon ec2 boxes, deploying flex apps running on top of restlet powered webservices. I have this problem - Everytime i deploy the app to the cloud, I'm having to hardcode the IP address of the server into the ActionScript/MXML files (http://72.93.48.39:8080/xxx/abc/) and for certain reasons, i am forced to choose a different IP everytime. and i think its really not the right way to deploy the application. I would like to know what other people do in such scenarios? On thinking about it, i thought i could make it pickup values from the HTMLVars of the HTML wrapper. but that again has to be edited everytime again and again. will it be possible to be able to supply these values : server's ip address, server's port number(in case its not 8080 on some machine) at build time? if so can anyone give me a barbones sample build.xml just as an example?

    Read the article

  • Load balancing and shedulling algorithms .NET

    - by Lukas Šalkauskas
    Hello there, so here is my problem: I have several different configuarion servers. I have different calculations (jobs), I can predict how long approx. each job will take to be caclulated. Also I have priorities. My question is how to keep all machines loaded 99-100% and shedule the jobs in the best way. Each machine can do several calculations at the time. Jobs are pushed to the machine. Central machine knows current load of each machine. Also I would like to to assign some king of machine learning here, because I will know statistics of each job (started, finished, cpu load etc.). How to distribute jobs(calculations) in the best possible way, also keep in mind priority. Any suggestions ? Ideas ? Algorithms ?

    Read the article

  • How to restructure ASP.NET application

    - by Ram
    Hi, I have a sample ASP.NET application. The appliaction was developed as POC and not following any design and architectural standards. Now I want to restructure the application. I can see some of the business logic and controls can be reused in future, such as login control. I have two options for restructuring I create a Utility DLL that will contain all such resusable code and another DLL that will contain all controls that can be reused. I will create a separeate DLL for each type which can be reused e.g. Login control. Which option is more better. Although I feel option 1 is good, but I need suggestion from experts.

    Read the article

  • iReport ejbql connection

    - by Nayan Wadekar
    I want to create ejbql connection in iReport, i have added all the related jars. Set the classpath to include the META-INF directory containing persistence.xml & jars. On testing connection it shows nothing, but in console it prints "java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.ejb.event.EJB3PersistEventListener null". Jar containing this class I have already added. persistence.xml content : persistence-unit name="hrmsPU" transaction-type="JTA" provider org.hibernate.ejb.HibernatePersistence provider jta-data-source java:hrmsDS jta-data-source persistence-unit

    Read the article

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