Daily Archives

Articles indexed Wednesday October 17 2012

Page 8/17 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Quaternion based rotation and pivot position

    - by Michael IV
    I can't figure out how to perform matrix rotation using Quaternion while taking into account pivot position in OpenGL.What I am currently getting is rotation of the object around some point in the space and not a local pivot which is what I want. Here is the code [Using Java] Quaternion rotation method: public void rotateTo3(float xr, float yr, float zr) { _rotation.x = xr; _rotation.y = yr; _rotation.z = zr; Quaternion xrotQ = Glm.angleAxis((xr), Vec3.X_AXIS); Quaternion yrotQ = Glm.angleAxis((yr), Vec3.Y_AXIS); Quaternion zrotQ = Glm.angleAxis((zr), Vec3.Z_AXIS); xrotQ = Glm.normalize(xrotQ); yrotQ = Glm.normalize(yrotQ); zrotQ = Glm.normalize(zrotQ); Quaternion acumQuat; acumQuat = Quaternion.mul(xrotQ, yrotQ); acumQuat = Quaternion.mul(acumQuat, zrotQ); Mat4 rotMat = Glm.matCast(acumQuat); _model = new Mat4(1); scaleTo(_scaleX, _scaleY, _scaleZ); _model = Glm.translate(_model, new Vec3(_pivot.x, _pivot.y, 0)); _model =rotMat.mul(_model);//_model.mul(rotMat); //rotMat.mul(_model); _model = Glm.translate(_model, new Vec3(-_pivot.x, -_pivot.y, 0)); translateTo(_x, _y, _z); notifyTranformChange(); } Model matrix scale method: public void scaleTo(float x, float y, float z) { _model.set(0, x); _model.set(5, y); _model.set(10, z); _scaleX = x; _scaleY = y; _scaleZ = z; notifyTranformChange(); } Translate method: public void translateTo(float x, float y, float z) { _x = x - _pivot.x; _y = y - _pivot.y; _z = z; _position.x = _x; _position.y = _y; _position.z = _z; _model.set(12, _x); _model.set(13, _y); _model.set(14, _z); notifyTranformChange(); } But this method in which I don't use Quaternion works fine: public void rotate(Vec3 axis, float angleDegr) { _rotation.add(axis.scale(angleDegr)); // change to GLM: Mat4 backTr = new Mat4(1.0f); backTr = Glm.translate(backTr, new Vec3(_pivot.x, _pivot.y, 0)); backTr = Glm.rotate(backTr, angleDegr, axis); backTr = Glm.translate(backTr, new Vec3(-_pivot.x, -_pivot.y, 0)); _model =_model.mul(backTr);///backTr.mul(_model); notifyTranformChange(); }

    Read the article

  • Drawing multiple triangles at once isn't working

    - by Deukalion
    I'm trying to draw multiple triangles at once to make up a "shape". I have a class that has an array of VertexPositionColor, an array of Indexes (rendered by this Triangulation class): http://www.xnawiki.com/index.php/Polygon_Triangulation So, my "shape" has multiple points of VertexPositionColor but I can't render each triangle in the shape to "fill" the shape. It only draws the first triangle. struct ShapeColor { // Properties (not all properties) VertexPositionColor[] Points; int[] Indexes; } First method that I've tried, this should work since I iterate through the index array that always are of "3s", so they always contain at least one triangle. //render = ShapeColor for (int i = 0; i < render.Indexes.Length; i += 3) { device.DrawUserIndexedPrimitives<VertexPositionColor> ( PrimitiveType.TriangleList, new VertexPositionColor[] { render.Points[render.Indexes[i]], render.Points[render.Indexes[i+1]], render.Points[render.Indexes[i+2]] }, 0, 3, new int[] { 0, 1, 2 }, 0, 1 ); } or the method that should work: device.DrawUserIndexedPrimitives<VertexPositionColor> ( PrimitiveType.TriangleList, render.Points, 0, render.Points.Length, render.Indexes, 0, render.Indexes.Length / 3, VertexPositionColor.VertexDeclaration ); No matter what method I use this is the "typical" result from my Editor (in Windows Forms with XNA) It should show a filled shape, because the indexes are right (I've checked a dozen of times) I simply click the screen (gets the world coordinates, adds a point from a color, when there are 3 points or more it should start filling out the shape, it only draws the lines (different method) and only 1 triangle). The Grid isn't rendered with "this" shape. Any ideas?

    Read the article

  • multipass shadow mapping renderer in XNA

    - by Nick
    I am wanting to implement a multipass renderer in XNA (additive blending combines the contributions from each light). I have the renderer working without any shadows, but when I try to add shadow mapping support I run into an issue with switching render targets to draw the shadow maps. When I switch render targets, I lose the contents of the backbuffer which ruins the whole additive blending idea. For example: Draw() { DrawAmbientLighting() foreach (DirectionalLight) { DrawDirectionalShadowMap() // <-- I lose all previous lighting contributions when I switch to the shadow map render target here DrawDirectionalLighting() } } Is there any way around my issue? (I could render all the shadow maps first, but then I have to make and hold onto a render target for each light that casts a shadow--is this the only way?)

    Read the article

  • how to label a cuboid using open gl?

    - by usha
    hi this is how my 3dcuboid looks ,i have attached complete code , i want to label this cuboid using different name across sides how is it possible using opengl in android...plz help me out public class MyGLRenderer implements Renderer { Context context; Cuboid rect; private float mCubeRotation; // private static float angleCube = 0; // Rotational angle in degree for cube (NEW) // private static float speedCube = -1.5f; // Rotational speed for cube (NEW) public MyGLRenderer(Context context) { rect = new Cuboid(); this.context = context; } public void onDrawFrame(GL10 gl) { // TODO Auto-generated method stub gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glLoadIdentity(); // Reset the model-view matrix gl.glTranslatef(0.2f, 0.0f, -8.0f); // Translate right and into the screen gl.glScalef(0.8f, 0.8f, 0.8f); // Scale down (NEW) gl.glRotatef(mCubeRotation, 1.0f, 1.0f, 1.0f); // gl.glRotatef(angleCube, 1.0f, 1.0f, 1.0f); // rotate about the axis (1,1,1) (NEW) rect.draw(gl); mCubeRotation -= 0.15f; //angleCube += speedCube; } public void onSurfaceChanged(GL10 gl, int width, int height) { // TODO Auto-generated method stub if (height == 0) height = 1; // To prevent divide by zero float aspect = (float)width / height; // Set the viewport (display area) to cover the entire window gl.glViewport(0, 0, width, height); // Setup perspective projection, with aspect ratio matches viewport gl.glMatrixMode(GL10.GL_PROJECTION); // Select projection matrix gl.glLoadIdentity(); // Reset projection matrix // Use perspective projection GLU.gluPerspective(gl, 45, aspect, 0.1f, 100.f); gl.glMatrixMode(GL10.GL_MODELVIEW); // Select model-view matrix gl.glLoadIdentity(); // Reset } public void onSurfaceCreated(GL10 gl, EGLConfig config) { // TODO Auto-generated method stub gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Set color's clear-value to black gl.glClearDepthf(1.0f); // Set depth's clear-value to farthest gl.glEnable(GL10.GL_DEPTH_TEST); // Enables depth-buffer for hidden surface removal gl.glDepthFunc(GL10.GL_LEQUAL); // The type of depth testing to do gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); // nice perspective view gl.glShadeModel(GL10.GL_SMOOTH); // Enable smooth shading of color gl.glDisable(GL10.GL_DITHER); // Disable dithering for better performance }} public class Cuboid{ private FloatBuffer mVertexBuffer; private FloatBuffer mColorBuffer; private ByteBuffer mIndexBuffer; private float vertices[] = { //width,height,depth -2.5f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -2.5f, 1.0f, -1.0f, -2.5f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -2.5f, 1.0f, 1.0f }; private float colors[] = { // R,G,B,A COLOR 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.5f, 0.0f, 1.0f, 1.0f, 0.5f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f }; private byte indices[] = { // VERTEX 0,1,2,3,4,5,6,7 REPRESENTATION FOR FACES 0, 4, 5, 0, 5, 1, 1, 5, 6, 1, 6, 2, 2, 6, 7, 2, 7, 3, 3, 7, 4, 3, 4, 0, 4, 7, 6, 4, 6, 5, 3, 0, 1, 3, 1, 2 }; public Cuboid() { ByteBuffer byteBuf = ByteBuffer.allocateDirect(vertices.length * 4); byteBuf.order(ByteOrder.nativeOrder()); mVertexBuffer = byteBuf.asFloatBuffer(); mVertexBuffer.put(vertices); mVertexBuffer.position(0); byteBuf = ByteBuffer.allocateDirect(colors.length * 4); byteBuf.order(ByteOrder.nativeOrder()); mColorBuffer = byteBuf.asFloatBuffer(); mColorBuffer.put(colors); mColorBuffer.position(0); mIndexBuffer = ByteBuffer.allocateDirect(indices.length); mIndexBuffer.put(indices); mIndexBuffer.position(0); } public void draw(GL10 gl) { gl.glFrontFace(GL10.GL_CW); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mVertexBuffer); gl.glColorPointer(4, GL10.GL_FLOAT, 0, mColorBuffer); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_COLOR_ARRAY); gl.glDrawElements(GL10.GL_TRIANGLES, 36, GL10.GL_UNSIGNED_BYTE, mIndexBuffer); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_COLOR_ARRAY); } } public class Draw3drect extends Activity { private GLSurfaceView glView; // Use GLSurfaceView // Call back when the activity is started, to initialize the view @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); glView = new GLSurfaceView(this); // Allocate a GLSurfaceView glView.setRenderer(new MyGLRenderer(this)); // Use a custom renderer this.setContentView(glView); // This activity sets to GLSurfaceView } // Call back when the activity is going into the background @Override protected void onPause() { super.onPause(); glView.onPause(); } // Call back after onPause() @Override protected void onResume() { super.onResume(); glView.onResume(); } }

    Read the article

  • JQuery+Java setting field value with val() + single quote

    - by Fabio K
    I have a problem setting the value of a textarea element with jquery's val(). Basically, I have a JSP file which receives a string parameter called 'text'. Java code: String text = (String) request.getParameter('text'); Now I want my textarea element to receive this text: Javascript code: $('#textarea_id').val('<%=text%>'); It works when my text doesnt contain quotes single quotes (and possibly other chars). For example, for text = test' this error happens: Uncaught SyntaxError: Unexpected token ILLEGAL $('#textarea_id').val('test''); I hope you guys understand. I need a way to encode this value... i tried using escape so the quote is replaced by %27, but after unescaping its replaced again and the error happens. Thanks!

    Read the article

  • fetchBatchSize to be same as fetchLimit

    - by user1730622
    What does it mean to have fetchBatchSize to be the same as fetchLimit, say both are set to be 5. My understanding is that, with the fetchLimit, then only 5 records will be in the fetch result set; and additionally with the fetchBatchSize, only the ids/identities of the records will be read to the memory, and then the full records won't be retrieved until they are accessed. Is that a correct understanding?

    Read the article

  • Custom punctuation function making script run over the php's 60s runtime limit

    - by webmasters
    I am importing allot of product data from an XML file (about 5000 products). When I run the script I can make it work in about 10-12 seconds. Now, when I add this punctuation function which makes sure each product description ends with a punctuation sign, the code runs until the php 60 seconds loadtime on my server but I'm not getting any errors. I have error reporting turned on. I just get a final error that the script could not load in 60 seconds. The question is, looking at this function, is it that resource consuming? What can I do to make it faster? function punctuation($string){ if(strlen($string) > 5){ // Get $last_char $desired_punctuation = array(".",",","?","!"); $last_char = substr($string, -1); // Check if $last_char is in the $desired_punctuation array if(!in_array($last_char, $desired_punctuation)){ // strip the $mytrim string and get only letters at the end; while(!preg_match("/^[a-zA-Z]$/", $last_char)){ $string = substr($string, 0, -1); $last_char = substr($string, -1); } // add "." to the string $string .= '.'; } } return $string; } If the function is ok, the long runtime must come from something else which I'll have to discover. I just want your input on this part.

    Read the article

  • How to prevent chrome from injecting content to webpage

    - by Nazariy
    Recently I have discovered that my application is misbehaving in Google Chrome. On a page with a form, after it was submitted, my application reloads page using simple method like this: header('Location: ' . $url); after that, page is rendered incorrectly and this content is injected to DOM <div id="sbi_camera_button" class="sbi_search" style="left: 0px; top: 0px; position: absolute; width: 29px; height: 27px; border: none; margin: 0px; padding: 0px; z-index: 2147483647; display: none; "></div> After manual page refresh everything works as expected. I'm not sure what causing this behavior, as I'm working in closed local environment and application works fine in Firefox. My application using following libraries (hosted locally): jQuery v1.7.1 jQuery UI 1.8.16 Bootstrap.js v 2.1.1 Can someone suggest me what can possibly cause this issue?

    Read the article

  • Using True and False to select items to print

    - by user1753915
    I have a workbook that contains rows of information that needs to printed to a seperate worksheet in excel. I am trying to utilize a checkbox to indicate which items need to print and which items need to be skipped. The checkbox is located in column "A" and once checked and the macro ran, I want it to pick up the data in each cell of that particular row, transfer it a seperate worksheet (form), prompt and save the worksheet to pdf, clear the form, and then return to the main worksheet to continue until all rows have been checked. However, right now, my code is only looping through the very first "TRUE" statement and not continuing to the rest. Here is the code: Private Sub CommandButton1_Click() On Error GoTo ErrHandler: Dim i As Integer For i = 1 To 10 If ActiveSheet.OLEObjects("CheckBox" & i).Object.Value = False Then Else If ActiveSheet.OLEObjects("CheckBox" & i).Object.Value = True Then Call PrintWO Else End If Do Until ActiveSheet.OLEObjects("CheckBox" & i).Object.Value = 10 MsgBox "Nothing Selected to Print" Exit Do Exit Sub Loop End If Next i ErrHandler: End Sub

    Read the article

  • Adding and altering multiple text items to a Canvas -- what approach?

    - by philologon
    I am attempting to use a Canvas to create a simple Cad application. I have been able to get lines to draw as I want. For now the only other thing I need is text. The user should be able to edit the text in place. ?Is one of these better to use for this over the others? Rich Text TextBlock TextBox Label A more important question, though, is once I have chosen which class to use for implementation, how do I set and get the text value in code? Since the app is in essence a cad application, text will be added, deleted, and altered often, so I am not attempting to put these in XAML, but code-behind. That is why I am asking about how to do this in code. If the answer is "use X.SetValue()" (or that family of methods), then please tell me what I am supposed to do with the required DependencyProperty reference? TIA. Paul

    Read the article

  • ios6 web app delete privacy setting

    - by Higgs Boson
    I'm developing a web app and testing on my iPhone 5 running iOS6. The app was running as a home screen app and during use requested access to the camera roll on the phone which I allowed, this has added a toggle in settings privacy photos on the phone for my web app. I've since abandoned this web app and deleted the home screen icon but the toggle still shows in the privacy settings, I'd like to remove this toggle but I can't seem to find a way to do so. Can anyone help?

    Read the article

  • it's not possible to loop .click function (To create multipple buttons)

    - by user1542680
    Im Trying to create multiple buttons that each one of them doing something else. It working great outside of the "each" loop, But in the moment I'm inserting the .click function in the .each function it doesn't work... Here is the Code: $.each(data.arr, function(i, s){ html += '<div id="mybtn'+s.id+'"><button class="first">Btn1</button><button class="second">Btn2</button></div>'; var btnclass="#mybtn"+s.id+" .first"; $(btnclass).click(function(){ //do something }); }); Please Let me know what is wrong... Thank you very much!!! Eran.

    Read the article

  • C appending char to char*

    - by Ostap Hnatyuk
    So I'm trying to append a char to a char*. For example I have char *word = " "; I also have char ch = 'x'; I do append(word, ch); Using this method.. void append(char* s, char c) { int len = strlen(s); s[len] = c; s[len+1] = '\0'; } It gives me a segmentation fault, and I understand why I suppose. Because s[len] is out of bounds. How do I make it so it works? I need to clear the char* a lot as well, if I were to use something like char word[500]; How would I clear that once it has some characters appended to it? Would the strlen of it always be 500? Thanks in advance.

    Read the article

  • Can't Use Path in ASP MVC Action

    - by user1477388
    I am trying to use Path() but it has a blue line under it and says, "local variable (path) cannot be referred to until it is declared." How can I use Path()? Imports System.Globalization Imports System.IO Public Class MessageController Inherits System.Web.Mvc.Controller <EmployeeAuthorize()> <HttpPost()> Function SendReply(ByVal id As Integer, ByVal message As String, ByVal files As IEnumerable(Of HttpPostedFileBase)) As JsonResult ' upload files For Each i In files If (i.ContentLength > 0) Then Dim fileName = path.GetFileName(i.FileName) Dim path = path.Combine(Server.MapPath("~/App_Data/uploads"), fileName) i.SaveAs(path) End If Next End Function End Class

    Read the article

  • Losing session after Login - Java

    - by Patrick Villela
    I'm building an application that needs to login to a certain page and make a navigation. I can login, provided that the response contains a string that identifies it. But, when I navigate to the second page, I can't see the page as a logged user, only as anonymous. I'll provide my code. import java.net.*; import java.security.*; import java.security.cert.*; import javax.net.ssl.*; import java.io.*; import java.util.*; public class PostTest { static HttpsURLConnection conn = null; private static class DefaultTrustManager implements X509TrustManager { @Override public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {} @Override public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {} @Override public X509Certificate[] getAcceptedIssuers() { return null; } } public static void main(String[] args) { try { SSLContext ctx = SSLContext.getInstance("TLS"); ctx.init(new KeyManager[0], new TrustManager[] {new DefaultTrustManager()}, new SecureRandom()); SSLContext.setDefault(ctx); String data = URLEncoder.encode("txtUserName", "UTF-8") + "=" + URLEncoder.encode(/*username*/, "UTF-8"); data += "&" + URLEncoder.encode("txtPassword", "UTF-8") + "=" + URLEncoder.encode(/*password*/", "UTF-8"); data += "&" + URLEncoder.encode("envia", "UTF-8") + "=" + URLEncoder.encode("1", "UTF-8"); connectToSSL(/*login url*/); conn.setDoOutput(true); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(data); wr.flush(); BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; String resposta = ""; while((line = rd.readLine()) != null) { resposta += line + "\n"; } System.out.println("valid login -> " + resposta.contains(/*string that assures me I'm looged in*/)); connectToSSL(/*first navigation page*/); rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); while((line = rd.readLine()) != null) { System.out.println(line); } } catch(Exception e) { e.printStackTrace(); } } private static void connectToSSL(String address) { try { URL url = new URL(address); conn = (HttpsURLConnection) url.openConnection(); conn.setHostnameVerifier(new HostnameVerifier() { @Override public boolean verify(String arg0, SSLSession arg1) { return true; } }); } catch(Exception ex) { ex.printStackTrace(); } } } Any further information, just ask. Thanks in advance.

    Read the article

  • Define thread in C++

    - by Vsevywniy
    How do I start a thread using _beginthreadex(), making it execute void myFunction(wchar_t *param);? I try to use this: _beginthread(NULL, 0, myFunction, L"someParam", 0, &ThreadID); but there is compilation error: error C2664: 'beginthreadex' : cannot convert parameter 3 from 'void (_cdecl *)(wchar_t *)' to 'unsigned int (__stdcall *)(void *)'. How I can resolve this error? I seem able to do _beginthread((void(*)(void*))myFunction, 0 , (void *)L"someParam");. But for _beginthreadex() these casts don't seem to work. What do I need to do?

    Read the article

  • jquery find() - how to exclude certain descendants, and their children?

    - by jammypeach
    I have markup similar to this: <div class='wrapper plugin'> //some content <div class='child-wrapper plugin'> //some more content <div> <ul> <li><div class='cliky'>clicky!</div></li> </ul> </div> </div> <div class='cliky'>clicky!</div> </div> I need to be able to select the first .clicky div only, not any .clicky divs inside a .plugin > .plugin div. The wrapper has .plugin class too - might seem counter-intuitive so another way to view it is this: I want to get the .clicky children of a given .plugin div, but not .plugin .plugin .clicky. Here's the problem - the depth of each .clicky element (or indeed, the number of them) is unknown and variable in relation to the wrappers. One could be immediately below the first wrapper, or inside 10 <ul>s. I've tried selectors like: $('.wrapper').find('.clicky').not('.plugin > .clicky'); But they still selected child .clicky. How would I be able to filter out .plugin and any children of .plugin from my selector before using find()?

    Read the article

  • Does collections type conversion util methods already exist in any API?

    - by Delta
    interface TypeConverter<T, E> { T convert(E e); } class CollectionUtil() { public static <E> List<T> convertToList(List<E> fromList, TypeConverter<T, E> conv) { { if(fromList== null) return null; List<T> newList = new ArrayList<T>(fromList.size()) for(E e : fromList) { newList.add(conv.convert(e)); } return newList; } } Above code explains converting from List of String to List of Integer by implementing TypeConverter interface for String, Integer. Are there already any collections conversion utility methods exists in any API like list to set and so on?

    Read the article

  • Cross domain ajax POST ie7 with jquery

    - by DickieBoy
    been having trouble with this script, ive managed to get it working in ie8, works on chrome fine. initilize: function(){ $('#my_form').submit(function(){ if ($.browser.msie && window.XDomainRequest) { var data = $('#my_form').serialize(); xdr=new XDomainRequest(); function after_xhr_load() { response = $.parseJSON(xdr.responseText); if(response.number =="incorrect format"){ $('#errors').html('error'); } else { $('#errors').html('worked'); } } xdr.onload = after_xhr_load; xdr.open("POST",$('#my_form').attr('action')+".json"); xdr.send(data); } else { $.ajax({ type: "POST", url: $('#my_form').attr('action')+".json", data: $('#my_form').serialize(), dataType: "json", complete: function(data) { if(data.statusText =="OK"){ $('#errors').html('error'); } if(data.statusText =="Created"){ response = $.parseJSON(data.responseText); $('#errors').html('Here is your code:' +response.code); } } }); } return false; }); } I understand that ie7 does not have the XDomainRequest() object. How can I replicate this in ie7. Thanks, in advance

    Read the article

  • How to access the value of the Label present inside Datagrid asp.net using jquery?

    - by vini
    <asp:DataGrid ID="datagrid1" runat="server" AutoGenerateColumns="False" Width="100%" DataKeyField="Expr1" OnItemCommand="datagrid1_ItemCommand" EmptyDataText="No Records Found" > <HeaderStyle BackColor="#2E882E" Font-Bold="True" ForeColor="#FFFFCC" HorizontalAlign="Left" /> <Columns> <asp:TemplateColumn HeaderText=""> <ItemTemplate> <table> <tr> <td class="style1"> <asp:Label ID="lblStatus" runat="server" Text='<%# Eval("Status") %>'></asp:Label> </td> </tr> </table> </ItemTemplate> </asp:TemplateColumn> </Columns> </asp:DataGrid> How can i access this Status Label value using jquery Please help var DataGrid1 = $("<%=datagrid1.ClientID %>"); var status = $(DataGrid1).children("lblStatus").get(0).innerHTML; Will the above code work?

    Read the article

  • Google Map + MarkerClusterer only takes place when map completely zooms out

    - by user415795
    The clustering works but somehow it only takes place at the maximum zoom out(the largest view with all nations), the moment I zoom in by 1 value, the clustering icon changes back to markers. I try with all kinds of values on the maxZoom and gridSize clusterer options with no help. Can someone please kindly advice. Thanks. <script language="javascript" type="text/javascript"> var markersArray = []; var mc = null; var markersArray = []; var mc = null; var map; var mapOptions; var geocoder; var infoWindow; var http_request = false; var lat = 0; var lng = 0; var startingZoom = 7; var lowestZoom = 1; // The lower the number, the more places can be seen on within the bounds. var highestZoom = 8; function mapLoad() { geocoder = new google.maps.Geocoder(); infoWindow = new google.maps.InfoWindow(); mapOptions = { zoomControl: true, zoom: 2, minZoom: lowestZoom, maxzoom: highestZoom, draggable: true, scrollwheel: true, disableDoubleClickZoom: true, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById('map'), mapOptions); } $(document).ready(function () { var searchUrl; var locations; // Place the user's current location marker on the map var Location = new google.maps.LatLng(1.340319, 103.743744); var Location2 = new google.maps.LatLng(1.322347, 103.757881); createMarker('1', Location, 'My Location', '', '', '', '/Images/home.png'); createMarker('1', Location2, 'My Location', '', '', '', '/Images/bb.png'); var bounds = new google.maps.LatLngBounds(); bounds.extend(gameLocation); map.fitBounds(bounds); }); // Create the marker with address information function createMarker(actId, point, address1, address2, town, postcode, icon) { var marker = new google.maps.Marker({ map: map, icon: icon, position: point, title: address1, animation: google.maps.Animation.DROP }); marker.metadata = { id: actId }; markersArray.push(marker); mc = new MarkerClusterer(map, markersArray); return marker; } </script>

    Read the article

  • mysql_fetch_row() not a valid result resource

    - by user1717305
    I am confused, I don't know what's wrong. I'm about to transfer all data from my first table to the other. Here is my code: $getdata = mysql_query("SELECT Quantity, Description, Total FROM ordercart"); while($row = mysql_fetch_row($getdata)) { foreach($row as $cell){ $query1 = mysql_query("INSERT INTO ordermem (Quantity, Description, Total) VALUES ($cell)",$connect); } mysql_free_result($getdata); } I get the error: Warning: mysql_fetch_row(): 5 is not a valid MySQL result resource.

    Read the article

  • A generic error has occurred in GDI+

    - by sysigy
    I know this has been asked a million times but I think I need to make it a million and one. I am getting "A generic error has occurred in GDI+" when trying to save a new bitmap. I have completely stripped down to the most basic lines of code and I still get the error with the following method: public class HomeController : Controller { public ActionResult Index() { return this.View(); } public void CreatePicture() { try { // THIS WORKS System.IO.File.Copy("C:\\copyTest.bmp", "C:\\test folder\\copyTest2.bmp"); // THIS WORKS System.IO.File.Delete("C:\\test folder\\deleteTest.bmp"); using (Bitmap newBitmap = new Bitmap(120, 120)) { // THIS FAILS newBitmap.Save("C:\\test folder\\test.bmp", ImageFormat.Bmp); } } catch (Exception ex) { throw ex; } } } The code is called from an html link on a blank page within an MVC 3.0 website using anonymous login. View: @Html.ActionLink("Create Picture", "CreatePicture", "Home", new { }) I have checked the folder permissions of "test folder" and have given full access to the following: ASPNET NETWORK SERVICE IUSR I still get the error... what have I missed / done wrong ?

    Read the article

  • Count seconds and minutes with MCU timer/interrupt?

    - by arynhard
    I am trying to figure out how to create a timer for my C8051F020 MCU. The following code uses the value passed to init_Timer2() with the following formula: 65535-(0.1 / (12/2000000)=48868. I set up the timer to count every time it executes and for every 10 counts, count one second. This is based on the above formula. 48868 when passed to init_Timer2 will produce a 0.1 second delay. It would take ten of them per second. However, when I test the timer it is a little fast. At ten seconds the timer reports 11 seconds, at 20 seconds the timer reports 22 seconds. I would like to get as close to a perfect second as I can. Here is my code: #include <compiler_defs.h> #include <C8051F020_defs.h> void init_Clock(void); void init_Watchdog(void); void init_Ports(void); void init_Timer2(unsigned int counts); void start_Timer2(void); void timer2_ISR(void); unsigned int timer2_Count; unsigned int seconds; unsigned int minutes; int main(void) { init_Clock(); init_Watchdog(); init_Ports(); start_Timer2(); P5 &= 0xFF; while (1); } //============================================================= //Functions //============================================================= void init_Clock(void) { OSCICN = 0x04; //2Mhz //OSCICN = 0x07; //16Mhz } void init_Watchdog(void) { //Disable watchdog timer WDTCN = 0xDE; WDTCN = 0xAD; } void init_Ports(void) { XBR0 = 0x00; XBR1 = 0x00; XBR2 = 0x40; P0 = 0x00; P0MDOUT = 0x00; P5 = 0x00; //Set P5 to 1111 P74OUT = 0x08; //Set P5 4 - 7 (LEDs) to push pull (Output) } void init_Timer2(unsigned int counts) { CKCON = 0x00; //Set all timers to system clock divided by 12 T2CON = 0x00; //Set timer 2 to timer mode RCAP2 = counts; T2 = 0xFFFF; //655535 IE |= 0x20; //Enable timer 2 T2CON |= 0x04; //Start timer 2 } void start_Timer2(void) { EA = 0; init_Timer2(48868); EA = 1; } void timer2_ISR(void) interrupt 5 { T2CON &= ~(0x80); P5 ^= 0xF0; timer2_Count++; if(timer2_Count % 10 == 0) { seconds++; } if(seconds % 60 == 0 && seconds != 0) { minutes++; } }

    Read the article

  • Modular enterprise architecture using MVC and Orchard CMS

    - by MrJD
    I'm making a large scale MVC application using Orchard. And I'm going to be separating my logic into modules. I'm also trying to heavily decouple the application for maximum extensibility and testability. I have a rudimentary understanding of IoC, Repository Pattern, Unit of Work pattern and Service Layer pattern. I've made myself a diagram. I'm wondering if it is correct and if there is anything I have missed regarding an extensible application. Note that each module is a separate project.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >