Search Results

Search found 4882 results on 196 pages for 'odd behaviour'.

Page 19/196 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • ASP.MVC ModelBinding Behaviour

    - by OldBoy
    This one has me stumped, despite the numerous posts on here. The scenario is a basic MVC(2) web application with simple CRUD operations. Whenever the edit form is submitted and the UpdateModel() called, an exception is thrown: System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException was unhandled by user code This occurs against a DropDownList value which is a foreign key on the entity table. However, there is another DropDownList list on the form, representing another foreign key, which does not throw the error (unsurprisingly). Changing the property values manually inside the Edit Action: Recipe recipe = repository.GetRecipe(int.Parse(formValues["recipeid"])); recipe.CategoryId = Convert.ToInt32(formValues["CategoryId"].ToString()); recipe.Page = int.Parse(formValues["Page"].ToString()); recipe.PublicationId=Convert.ToInt32(formValues["PublicationId"].ToString()); Allows the CategoryId and Page properties to be updated, and then the error is thrown on the PublicationId. All of the referential integrity is checked an the same in the db and the dbml. Any light shed on this would be most welcome.

    Read the article

  • Using AsyncTask, but experiencing unexpected behaviour

    - by capcom
    Please refer to the following code which continuously calls a new AsyncTask. The purpose of the AsyncTask is to make an HTTP request, and update the string result. package room.temperature; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.concurrent.ExecutionException; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class RoomTemperatureActivity extends Activity { String result = null; StringBuilder sb=null; TextView TemperatureText, DateText; ArrayList<NameValuePair> nameValuePairs; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TemperatureText = (TextView) findViewById(R.id.temperature); DateText = (TextView) findViewById(R.id.date); nameValuePairs = new ArrayList<NameValuePair>(); for (int i = 0; i < 10; i++) { RefreshValuesTask task = new RefreshValuesTask(); task.execute(""); } } // The definition of our task class private class RefreshValuesTask extends AsyncTask<String, Integer, String> { @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected String doInBackground(String... params) { InputStream is = null; try { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://mywebsite.com/roomtemp/tempscript.php"); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = entity.getContent(); } catch(Exception e) { Log.e("log_tag", "Error in http connection" + e.toString()); } try { BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8); sb = new StringBuilder(); sb.append(reader.readLine()); is.close(); result=sb.toString(); } catch(Exception e) { Log.e("log_tag", "Error converting result " + e.toString()); } return result; } @Override protected void onProgressUpdate(Integer... values) { super.onProgressUpdate(values); } @Override protected void onPostExecute(String result) { super.onPostExecute(result); //System.out.println(result); setValues(result); } } public void setValues(String resultValue) { System.out.println(resultValue); String[] values = resultValue.split("&"); TemperatureText.setText(values[0]); DateText.setText(values[1]); } } The problem I am experiencing relates to the AsyncTask in some way or the function setValues(), but I am not sure how. Essentially, I want each call to the AsyncTask to run, eventually in an infinite while loop, and update the TextView fields as I have attempted in setValues. I have tried since yesterday after asking a question which led to this code, for reference. Oh yes, I did try using the AsyncTask get() method, but that didn't work either as I found out that it is actually a synchronous call, and renders the whole point of AsyncTask useless.

    Read the article

  • Cannot understand the behaviour of dotnet compiler while instantiating a class thru interface(C#)

    - by Newbie
    I have a class that impelemnts an interface. The interface is public interface IRiskFactory { void StartService(); void StopService(); } The class that implements the interface is public class RiskFactoryService : IRiskFactory { } Now I have a console application and one window service. From the console application if I write the following code static void Main(string[] args) { IRiskFactory objIRiskFactory = new RiskFactoryService(); objIRiskFactory.StartService(); Console.ReadLine(); objIRiskFactory.StopService(); } It is working fine. However, when I mwrite the same piece of code in Window service public partial class RiskFactoryService : ServiceBase { IRiskFactory objIRiskFactory = null; public RiskFactoryService() { InitializeComponent(); objIRiskFactory = new RiskFactoryService(); <- ERROR } /// <summary> /// Starts the service /// </summary> /// <param name="args"></param> protected override void OnStart(string[] args) { objIRiskFactory.StartService(); } /// <summary> /// Stops the service /// </summary> protected override void OnStop() { objIRiskFactory.StopService(); } } It throws error: Cannot implicitly convert type 'RiskFactoryService' to 'IRiskFactory'. An explicit conversion exists (are you missing a cast?) When I type casted to the interface type, it started working objIRiskFactory = (IRiskFactory)new RiskFactoryService(); My question is why so? Thanks.(C#)

    Read the article

  • Strange behaviour of DataTable with DataGridView

    - by Paul
    Please explain me what is happening. I have created a WinForms .NET application which has DataGridView on a form and should update database when DataGridView inline editing is used. Form has SqlDataAdapter _da with four SqlCommands bound to it. DataGridView is bound directly to DataTable _names. Such a CellValueChanged handler: private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { _da.Update(_names); } does not update database state although _names DataTable is updated. All the rows of _names have RowState == DataRowState.Unchanged Ok, I modified the handler: private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { DataRow row = _names.Rows[e.RowIndex]; row.BeginEdit(); row.EndEdit(); _da.Update(_names); } this variant really writes modified cell to database, but when I attempt to insert new row into grid, I get an error about an absence of row with index e.RowIndex So, I decided to improve the handler further: private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (_names.Rows.Count<e.RowIndex) { DataRow row = _names.Rows[e.RowIndex]; row.BeginEdit(); row.EndEdit(); } else { DataRow row = _names.NewRow(); row["NameText"] = dataGridView1["NameText", e.RowIndex].Value; _names.Rows.Add(row); } _da.Update(_names); } Now the really strange things happen when I insert new row to grid: the grid remains what it was until _names.Rows.Add(row); After this line THREE rows are inserted into table - two rows with the same value and one with Null value. The slightly modified code: DataRow row = _names.NewRow(); row["NameText"] = "--------------" _names.Rows.Add(row); inserts three rows with three different values: one as entered into the grid, the second with "--------------" value and third - with Null value. I really got stuck in guessing what is happening.

    Read the article

  • Strange code behaviour?

    - by goldenmean
    Hi, I have a C code in which i have a structure declaration which has an array of int[576] declared in it. For some reason, i had to remove this array from the structure, So i replaced this array with a pointer as int *ptr; declared some global array of same type, somewhere else in the code, and initialized this pointer by assigning the global array to this pointer. So i did not have to change the way i was accessing this array, from other parts of my code. But it works fine/gives desired output when i have the array declared in the structure, but it gives junk output when i declare it as a pointer in the structure and assign a global array to this pointer, as a part of the pointer initialization. All this code is being run on MS-VC 6.0/Windows setup/Intel-x86. I tried below things: 1)Suspected structure padding/alignment but could not get any leads? If at all structure alignment could be a culprit how can i proceed to narrow it down and confirm it? 2) I have made sure that in both cases the array is initialized to some default values, say 0 before its first use, and its not being used before initialization. 3)I tried using global array as well as malloc based memory for this newly declared array. Same result, junk output. Am i missing something? How can i zero down the problem. Any pointers would be helpful. Thanks, -AD.

    Read the article

  • Strange behaviour of mb_detect_order() in PHP

    - by termopro
    I would like to detect encoding of some text (using PHP). For that purpose i use mb_detect_encoding() function. The problem is that the function returns different results if i change the order of possible encodings with mb_detect_order() function. Consider the following example $html = <<< STR ????????????????????????????????????????????????????????????????????????????????????????????????????????? STR; mb_detect_order(array('UTF-8','EUC-JP', 'SJIS', 'eucJP-win', 'SJIS-win', 'JIS', 'ISO-2022-JP','ISO-8859-1','ISO-8859-2')); $originalEncoding = mb_detect_encoding($str); die($originalEncoding); // $originalEncoding = 'UTF-8' However if you change the order of encodings in mb_detect_order() the results will be different: mb_detect_order(array('EUC-JP','UTF-8', 'SJIS', 'eucJP-win', 'SJIS-win', 'JIS', 'ISO-2022-JP','ISO-8859-1','ISO-8859-2')); die($originalEncoding); // $originalEncoding = 'EUC-JP' So my questions are: Why is that happening ? Is there a way in PHP to correctly and unambiguously detect encoding of text ?

    Read the article

  • Django - Weird behaviour of sessions variables with Apache

    - by Étienne Loks
    In a Menu class with Section children, each Section has an available attribute. This attribute is initialized during the instance creation. The process of getting the availability is not trivial, so I stock a Menu instance for each user in a session variable. With the Django embedded webserver this works well. But when I deploy the application on an Apache webserver I can observe a very weird behavior. Once authentified, a click on a link or a refreshment of the page and the availability of each Section seems to be forgotten (empty menu but in the log file I can see that all Sections are here) then a new refresh on the page the availability is back, a new refresh the menu disappears once again, etc. There is no cache activated on the web server. The menu is initialized in a context processor. def get_base_context(request): if 'MENU' not in request.session or \ not request.session['MENU'].childs or\ request.session['MENU'].user != request.user: _menu = Menu(request.user) _menu.init() request.session['MENU'] = _menu (...) I have no idea what could cause such a behavior. Any clue?

    Read the article

  • Strange Locking Behaviour in SQL Server 2005

    - by SQL Learner
    Can anyone please tell me why does the following statement inside a given stored procedure returns repeated results even with locks on the rows used by the first SELECT statement? BEGIN TRANSACTION DECLARE @Temp TABLE ( ID INT ) INSERT INTO @Temp SELECT ID FROM SomeTable WITH (ROWLOCK, UPDLOCK, READPAST) WHERE SomeValue <= 10 INSERT INTO @Temp SELECT ID FROM SomeTable WITH (ROWLOCK, UPDLOCK, READPAST) WHERE SomeValue >= 5 SELECT * FROM @Temp COMMIT TRANSACTION Any values in SomeTable for which SomeValue is between 5 and 10 will be returned twice, even though they were locked in the first SELECT. I thought that locks were in place for the whole transaction, and so I wasn't expecting the query to return repeated results. Why is this happening?

    Read the article

  • Asp.net static object behaviour

    - by Circadian
    I have the following class as part of an asp.net application. public sealed class SomeClass { private static string appId = Guid.NewGuid().ToString(); public static ReadSomethingFromDb(){} public static WriteSomethingToDb(){} } There are more than one application instances in the same application pool, and they all access the same database. I want the operations performed by the above class to be uniquely tied to the instance that performed it, hence the use of the appId. So adding a record to the database would for example contain a name, address and appId. This has been simplified for discussion purposes. Assuming that I have two instances running at mysite.a and mysite.b the above class would generate two different guids. My problem is that mysite.a sometimes produces more than one guid, which is unexpected. Thank you in advance

    Read the article

  • Cannot understand the behaviour of C# compiler while instantiating a class thru interface

    - by Newbie
    I have a class that implements an interface. The interface is public interface IRiskFactory { void StartService(); void StopService(); } The class that implements the interface is public class RiskFactoryService : IRiskFactory { } Now I have a console application and one window service. From the console application if I write the following code static void Main(string[] args) { IRiskFactory objIRiskFactory = new RiskFactoryService(); objIRiskFactory.StartService(); Console.ReadLine(); objIRiskFactory.StopService(); } It is working fine. However, when I mwrite the same piece of code in Window service public partial class RiskFactoryService : ServiceBase { IRiskFactory objIRiskFactory = null; public RiskFactoryService() { InitializeComponent(); objIRiskFactory = new RiskFactoryService(); <- ERROR } /// <summary> /// Starts the service /// </summary> /// <param name="args"></param> protected override void OnStart(string[] args) { objIRiskFactory.StartService(); } /// <summary> /// Stops the service /// </summary> protected override void OnStop() { objIRiskFactory.StopService(); } } It throws error: Cannot implicitly convert type 'RiskFactoryService' to 'IRiskFactory'. An explicit conversion exists (are you missing a cast?) When I type cast to the interface type, it started working objIRiskFactory = (IRiskFactory)new RiskFactoryService(); My question is why so?

    Read the article

  • Understanding behaviour of read() and write()

    - by neo730
    hi i am a student and just start learning low level c programming.i tried to understand read() and write() methods with this program. #include <unistd.h> #include <stdlib.h> main() { char *st; st=calloc(sizeof(char),2);//allocate memory for 2 char read(0,st,2); write(1,st,2); } i was expecting that it would give segmentation fault when i would try to input more than 2 input characters.but when i execute program and enter " asdf " after giving " as " as output it executes "df" command. i want to know why it doesn't give segmentation fault when we assign more than 2 char to a string of size 2.and why is it executing rest(after 2 char)of input as command instead of giving it as output only? also reading man page of read() i found read() should give EFAULT error,but it doesn't. I am using linux.

    Read the article

  • java swing, simulate JTable terminateEditOnFocusLost behaviour

    - by blow
    Hi all, i'm using putClientProperty("terminateEditOnFocusLost", Boolean); to make jtable end editing and clear current selected rows when it lose focus or when simply click over an other GUI component. This is very useful, but with "terminateEditOnFocusLost" there are some strange behaviours if it is used with editCellAt and changeSelection. There are also some undesiderable TableModelEvents fired for some fake table updates. So, im looking for an hack to simulate "terminateEditOnFocusLost without using it, is this possibile? Thanks all.

    Read the article

  • JQuery animate behaviour with inline-block elements

    - by IlludiumPu36
    I'm using JQuery to animate two divs, one on top of the other, inside a another div. The effect is like a button with the top and bottom halves opening up and down to reveal some contents. The idea is to have a number of these 'buttons' in line using float:left When a button is clicked, the script checks if another button is open, if so, closes that button and opens the clicked button. This works fine, except I want to change float:left to display:inline-block on the container div class (to prevent wrapping of a number of buttons if the browser is resized). The problem is the layout of buttons breaks as JQuery animate seems to be changing the vertical position of the button containers while animating. See fiddle

    Read the article

  • Strange behaviour of CUDA kernel

    - by username_4567
    I'm writing code for calculating prefix sum. Here is my kernel __global__ void prescan(int *indata,int *outdata,int n,long int *sums) { extern __shared__ int temp[]; int tid=threadIdx.x; int offset=1,start_id,end_id; int *global_sum=&temp[n+2]; if(tid==0) { temp[n]=blockDim.x*blockIdx.x; temp[n+1]=blockDim.x*(blockIdx.x+1)-1; start_id=temp[n]; end_id=temp[n+1]; //cuPrintf("Value of start %d and end %d\n",start_id,end_id); } __syncthreads(); start_id=temp[n]; end_id=temp[n+1]; temp[tid]=indata[start_id+tid]; temp[tid+1]=indata[start_id+tid+1]; for(int d=n>>1;d>0;d>>=1) { __syncthreads(); if(tid<d) { int ai=offset*(2*tid+1)-1; int bi=offset*(2*tid+2)-1; temp[bi]+=temp[ai]; } offset*=2; } if(tid==0) { sums[blockIdx.x]=temp[n-1]; temp[n-1]=0; cuPrintf("sums %d\n",sums[blockIdx.x]); } for(int d=1;d<n;d*=2) { offset>>=1; __syncthreads(); if(tid<d) { int ai=offset*(2*tid+1)-1; int bi=offset*(2*tid+2)-1; int t=temp[ai]; temp[ai]=temp[bi]; temp[bi]+=t; } } __syncthreads(); if(tid==0) { outdata[start_id]=0; } __threadfence_block(); __syncthreads(); outdata[start_id+tid]=temp[tid]; outdata[start_id+tid+1]=temp[tid+1]; __syncthreads(); if(tid==0) { temp[0]=0; outdata[start_id]=0; } __threadfence_block(); __syncthreads(); if(blockIdx.x==0 && threadIdx.x==0) { for(int i=1;i<gridDim.x;i++) { sums[i]=sums[i]+sums[i-1]; } } __syncthreads(); __threadfence(); if(blockIdx.x==0 && threadIdx.x==0) { for(int i=0;i<gridDim.x;i++) { cuPrintf("****sums[%d]=%d ",i,sums[i]); } } __syncthreads(); __threadfence(); if(blockIdx.x!=gridDim.x-1) { int tid=(blockIdx.x+1)*blockDim.x+threadIdx.x; if(threadIdx.x==0) cuPrintf("Adding %d \n",sums[blockIdx.x]); outdata[tid]+=sums[blockIdx.x]; } __syncthreads(); } In above kernel, sums array will accumulate prefix sum per block and and then first thread will calculate prefix sum of this sum array. Now if I print this sum array from device side it'll show correct results while in cuPrintf("Adding %d \n",sums[blockIdx.x]); this line it prints that it is taking old value. What could be the reason?

    Read the article

  • Inconsistent behaviour from SDL_BlitSurface

    - by bardes
    Here is an example code: #include <SDL/SDL.h> #include <SDL/SDL_image.h> #include <stdio.h> int main() { if(SDL_Init(SDL_INIT_EVERYTHING) == -1) { printf("SDL ERROR: %s", SDL_GetError()); return 1; } SDL_Surface *screen; screen = SDL_SetVideoMode(128, 128, 32, SDL_SWSURFACE); SDL_Surface *img; img = IMG_Load("./debug.png"); SDL_BlitSurface(img, NULL, screen, NULL); SDL_Flip(screen); SDL_Delay(1000); SDL_FreeSurface(img); SDL_Quit(); return 0; } It compiles fine, but when I run it sometimes it works and most times only part of the image is displayed. I really can't imagine what's causing that... EDIT: This is the image I'm using to test the program: http://img140.imageshack.us/img140/3858/debugi.png

    Read the article

  • iPhone GameKit Picker Fundamental Connection Issues

    - by Kyle
    Hello.. This is one of the more interesting things I've seen in iPhone development. The following question has nothing to do with code because I'm using an SDK Example from Apple (Tanks example). I have a 3GS iPhone, and a 3G iPhone both showing the GameKit picker screen. Both will eventually show the other phone in range just fine (It does take about 25 seconds, though). If I pick the 3G iPhone with my 3GS, the 3G will get a connection request and a connection can be made. However, it will ABSOLUTELY not work in the vice versa. Both phones have bluetooth switched on, and both phones are running the latest OS version. The simple fact is I'm using the SDK example, and it's just not working for the 3G trying to issue the connection. Is there any way to explain this extremely odd behavior? Thanks alot for reading!

    Read the article

  • Lua: Why changing value on one variable changes value on an other one too?

    - by user474563
    I think that running this code you will get excactly what I mean. I want to register 5 names to a register(people). I loop 5 times and in each loop I have a variable newPerson which is supposed to save all information about a person and then be added to the people register. In this example only the names of the people are being registered for simplicity. The problem is that in the end all people turn to have the same name: "Petra". I playied a bit with this but can't get a reasonable reason for this behaviour. Help appreciated! local people={} local person={ name="Johan", lastName="Seferidis", class="B" } local names={"Markus", "Eva", "Nikol", "Adam", "Petra"} --people to register for i=1, 5 do --register 5 people local newPerson=person local name=names[i] for field=1, 3 do --for each field(name, lastname, class) if field==1 then newPerson["name"]=name end --register name end people[i]=newPerson end print("First person name: " ..people[1]["name"]) print("Second person name: "..people[2]["name"]) print("Third person name: " ..people[3]["name"])

    Read the article

  • what is the best way to add avoidance behaviour to an AI framework?

    - by SirYakalot
    I have a small AI framework for a shooting based game. Although this is rarely needed, as when agents are close to each other they are usually fighting, I would none the less like some way of implementing avoidance behaviour. For example, if in the future I wanted to take away their weapons and have many of them wonder around in a crowd, how would I make them not hit / pass through each other, but instead avoid each other? two ideas I had would be to add steering behaviour and allow that to deviate from their path, or to use a dynamic pathfinding technique. Are there better ways? What is the more respected practice?

    Read the article

  • Weird RecordStore behavior when RecordStoreFullException occurs

    - by Michael P
    Hello everyone! I'm developing a small J2ME application that displays bus stops timetables - they are stored as records in MIDP RecordStores. Sometimes records can not fit a single RecordStore, especially on record update - using setRecord method - a RecordStoreFullException occurs. I catch the exception, and try to write the record to a new RecordStore along with deleting the previous one in the old RecordStore. Everything works fine except of deleting record from RecordStore where the RecordStoreFullException occurs. If I make an attempt to delete record that could not be updated, another Exception of type InvalidRecordIDException is thrown. This is weird and undocumented in MIDP javadoc. I have tested it on Sun WTK 2.5.2, MicroEdition SDK 3.0 and Nokia Series 40 SDK. Furthermore I created a code that reproduces this strange behaviour: RecordStore rms = null; int id = 0; try { rms = RecordStore.openRecordStore("Test", true); byte[] raw = new byte[192*10024]; //Big enough to cause RecordStoreFullException id = rms.addRecord(raw, 0, 160); rms.setRecord(id, raw, 0, raw.length); } catch (Exception e) { try { int count = rms.getNumRecords(); RecordEnumeration en = rms.enumerateRecords(null, null, true); count = en.numRecords(); while(en.hasNextElement()){ System.out.println("NextID: "+en.nextRecordId()); } rms.deleteRecord(id); //this won't work! rms.setRecord(id, new byte[5], 0, 5); //this won't work too! } catch (Exception ex) { ex.printStackTrace(); } } I added extra enumeration code to produce other weird behavior - when RecordStoreFullException occurs, count variable will be set to 1 (if RMS was empty) by both methods - getNumRecords and numRecords. System.out.println will produce NextID: 0! It is not acceptable because record ID can not be 0! Could someone explain this strange behavior? Sorry for my bad English.

    Read the article

  • Why do I get an error 'Cannot resolve symbol <symbolname>' in ReSharper?

    - by drachenstern
    Using VS2008 and R# 5 I'm running into an odd situation, where on an aspx page I keep getting Cannot resolve symbol 'symbolname' But the code compiles and runs fine. While having a fix for this would be great, I'm just trying to figure out if I'm losing my mind. The CodeFile directive and Inherits directives are fine. If I compile the app or just let devenv sit for a bit it'll go away, but as soon as I save the aspx [via ctrl+s] R# suddenly has trouble with the Inherits attribute and flips out on every method in the page (OnClick etc). // Anonymized of course but otherwise intact <%@ Page AutoEventWireup="true" CodeFile="TestPage.aspx.cs" Inherits="TestPage" Language="C#" MasterPageFile="~/MasterPage.master" Title="Test Page Title" %> This is mostly just a grievance, because since the code compiles it doesn't stop me from doing what I need. I would post a bug report to the JetBrains site but first I would like to know I'm not alone. It could be my machine. Maybe when I roll to VS2010 in a couple weeks this will go away?

    Read the article

  • OpenGL behaving strangely

    - by Mk12
    OpenGL is acting very strangely for some reason. In my subclass of NSOpenGLView, I have the following code in -prepareOpenGL: - (void)prepareOpenGL { GLfloat lightAmbient[] = { 0.5f, 0.5f, 0.5f, 1.0f }; GLfloat lightDiffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f }; GLfloat lightPosition[] = { 0.0f, 0.0f, 2.0f }; quality = 0; zCoord = -6; [self loadTextures]; glEnable(GL_LIGHTING); glEnable(GL_TEXTURE_2D); glShadeModel(GL_SMOOTH); glClearColor(0.2f, 0.2f, 0.2f, 0.0f); glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glLightfv(GL_LIGHT1, GL_AMBIENT, lightAmbient); glLightfv(GL_LIGHT1, GL_DIFFUSE, lightDiffuse); glLightfv(GL_LIGHT1, GL_POSITION, lightPosition); glEnable(GL_LIGHT1); gameState = kGameStateRunning; int i = 0; // HERE ******** [NSTimer scheduledTimerWithTimeInterval:0.03f target:self selector:@selector(processKeys) userInfo:nil repeats:YES]; // Synchronize buffer swaps with vertical refresh rate GLint swapInt = 1; [[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval]; // Setup and start displayLink [self setupDisplayLink]; } I wanted to assign the timer that processes key input to an ivar so that I could invalidate it when the game is paused (and reinstantiate it on resume), however when I did that (as apposed to leaving it at [NSTimer scheduledTimer…), OpenGL doesn't display the cube I draw. When I take it away, it's fine. So i tried just adding a harmless statement, int i = 0; (maked // HERE *******), and that makes the lighting not work! When I take it away, everything is fine, but when I put it back, everything is dark. Can someone come up with a rational explanation for this? Thanks.

    Read the article

  • A maximum character limit on the preg functions?

    - by animuson
    On my site I use output buffering to grab all the output and then run it through a process function before sending it out to the browser (I don't replace anything, just break it into more manageable pieces). In this particular case, there is a massive amount of output because it is listing out a label for every country in the database (around 240 countries). The problem is that in full, my preg_match functions seems to get skipped over, it does absolutely nothing and returns no matches. However, if I remove parts of the labels (no particular part, just random pieces to reduce characters) then the preg_match functions works again. It doesn't seem to matter what I remove from the label, it just seems to be that as long as I remove so many characters. Is there some sort of cap on what the preg functions can handle or will it time out if there is too much data to be scanned over?

    Read the article

  • Very strange client/browser issue

    - by Jeriko
    One of our clients has logged a very strange issue with us- We launched a preview for their website, but when it's viewed on their main PC, peculiar things start to happen... At first, the stylesheet wasn't being found, and so accessing any page resulted in one void of all styles. We sent them a direct link to the stylesheet, which was viewable from all our computers in the office - but gave a "File Not Found" error on their side. I then deleted the file, and replaced it with a new blank file, which he could then access. Copy-pasted screen.css contents into this file, and he could then view it fine, and stylesheets magically worked on the site again. Now, he can view styles, but not the referenced header images. The strange thing is that this problem doesn't exist on any other PC we've tested, or on any other site on the problem computer, but obviously we'd like our client's site to work for them. The strange thing is, they can view other sites of ours, hosted on the same server, built on top of the same CMS (and so most of the files are the same) without problem - but are getting 404s for files that most definitely do exist. Stylesheets are not turned off, nor is anything specifically deactivated on their browser (as other sites are fine) Reloading with CTRL+F5 doesn't help The client is using the latest version of firefox Any ideas here on what to try / how to narrow the problem down?

    Read the article

  • How to avoid automatic renaming of sub signature parameters in visual basic 6.

    - by systempuntoout
    In Visual basic 6, i declare a sub like this: Private Sub test1(ByRef XmlFooOutput As String) ... End Sub after that, i declare another sub like the following one: Private Sub test2(ByRef xmlFooOutput As String) ... End Sub automagically, the first method is transformed in: Private Sub test1(ByVal xmlFooOutput As String) ... End Sub so the XmlFooOutput parameter is transformed in xmlFooOutput. This is a pretty dangerous feature because, method like those could be mapped to different XSL presentation files that read XML values through Xpath. So when test1 parameter is renamed, XSL bound to test1 method goes broken because Xpath point to XmlFooOuput but the correct value is now in xmlFooOutput. Is it possible to remove this weird feature? I'm using microsoft visual basic 6.0 (SP6). This question has some duplicate: http://stackoverflow.com/questions/1064858/stop-visual-basic-6-from-changing-my-casing http://stackoverflow.com/questions/248760/vb6-editor-changing-case-of-variable-names from what i see, there's no practical solution to disable this Intellisense evil feature.

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >