Daily Archives

Articles indexed Wednesday October 30 2013

Page 4/19 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Bad texture on model with different GPU

    - by Pacha
    I have some kind of distortion on the texture of my 3D model. It works perfectly well on an AMD GPU, but when testing on a integrated Intel HD graphics card it has a weird issue. I don't have a problem with the rest of my entities as they are not scaled. The models with the problems are scaled, as my engine supports different sizes for the platforms. I am using Ogre3D as rendering engine, and GLSL as shader language. Vertex shader: #version 120 varying vec2 UV; void main() { UV = gl_MultiTexCoord0; gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; } Fragment shader: #version 120 varying vec2 UV; uniform sampler2D diffuseMap; void main(void) { gl_FragColor = texture(diffuseMap, UV); } Screenshot (the error is on the right and left side, the top and bottom part are rendered perfectly well):

    Read the article

  • Physics don't apply on a unique body AndEngine

    - by Kanga
    I am developing a game in AndEngine so far I managed to create everything I wanted for my sprite that was connected to a BoxBody. I was rotating it moving it everything was great. I wanted my collision detection to be more precise so I changed from boxBody to unique irregular shaped body. I found all the vertices and I just replaced the newly created irregular shaped body with the boxbody everywhere in my code. Not only that the image of the sprite is not in place but all the physics and maths I was doing for movement and physics wont work. Please help me :(. Thanks in advance.

    Read the article

  • Texture errors in CubeMap

    - by shade4159
    I am trying to apply this texture as a cubemap. This is my result: Clearly I am doing something with my texture coordinates, but I cannot for the life of me figure out what. I don't even see a pattern to the texture fragments. They just seem like a jumble of different faces. Can anyone shed some light on this? Vertex shader: #version 400 in vec4 vPosition; in vec3 inTexCoord; smooth out vec3 texCoord; uniform mat4 projMatrix; void main() { texCoord = inTexCoord; gl_Position = projMatrix * vPosition; } My fragment shader: #version 400 smooth in vec3 texCoord; out vec4 fColor; uniform samplerCube textures void main() { fColor = texture(textures,texCoord); } Vertices of cube: point4 worldVerts[8] = { vec4( 15, 15, 15, 1 ), vec4( -15, 15, 15, 1 ), vec4( -15, 15, -15, 1 ), vec4( 15, 15, -15, 1 ), vec4( -15, -15, 15, 1 ), vec4( 15, -15, 15, 1 ), vec4( 15, -15, -15, 1 ), vec4( -15, -15, -15, 1 ) }; Cube rendering: void worldCube(point4* verts, int& Index, point4* points, vec3* texVerts) { quadInv( verts[0], verts[1], verts[2], verts[3], 1, Index, points, texVerts); quadInv( verts[6], verts[3], verts[2], verts[7], 2, Index, points, texVerts); quadInv( verts[4], verts[5], verts[6], verts[7], 3, Index, points, texVerts); quadInv( verts[4], verts[1], verts[0], verts[5], 4, Index, points, texVerts); quadInv( verts[5], verts[0], verts[3], verts[6], 5, Index, points, texVerts); quadInv( verts[4], verts[7], verts[2], verts[1], 6, Index, points, texVerts); } Backface function (since this is the inside of the cube): void quadInv( const point4& a, const point4& b, const point4& c, const point4& d , int& Index, point4* points, vec3* texVerts) { quad( a, d, c, b, Index, points, texVerts, a.to_3(), b.to_3(), c.to_3(), d.to_3()); } And the quad drawing function: void quad( const point4& a, const point4& b, const point4& c, const point4& d, int& Index, point4* points, vec3* texVerts, const vec3& tex_a, const vec3& tex_b, const vec3& tex_c, const vec3& tex_d) { texVerts[Index] = tex_a.normalized(); points[Index] = a; Index++; texVerts[Index] = tex_b.normalized(); points[Index] = b; Index++; texVerts[Index] = tex_c.normalized(); points[Index] = c; Index++; texVerts[Index] = tex_a.normalized(); points[Index] = a; Index++; texVerts[Index] = tex_c.normalized(); points[Index] = c; Index++; texVerts[Index] = tex_d.normalized(); points[Index] = d; Index++; } Edit: I forgot to mention, in the image, the camera is pointed directly at the back face of the cube. You can kind of see the diagonals leading out of the corners, if you squint.

    Read the article

  • Diagonal line of sight with two corners

    - by Ash Blue
    Right now I'm using Bresenham's line algorithm for line of sight. The problem is I've found an edge case where players can look through walls. Occurs when the player looks between two corners of a wall with a gap on the other side at specific angles. The result I want is for the tile between two walls to be marked invalid as so. What is the fastest way to modify Bresenham's line algorithm to solve this? If there isn't a good solution, is there a better suited algorithm? Any ideas are welcome. Please note the solution should also be capable of supporting 3d. Edit: For the working source code and an interactive demo of the completed product please see http://ashblue.github.io/javascript-pathfinding/

    Read the article

  • What Happens if i create a byte array continuously in a while loop with different size and add read an stream into it?

    - by SajidKhan
    I want to read an audio file into multiple byte arrays , with different size . And then add into a shared memory. What will happen if use below code. Does the byte array gets over written. I understand it will creat multiple byte array , how do i erase those byte arrays after my code does what it needs to do. int TotalBuffer = 10; while (TotalBuffer !=0){ bufferData = new byte[AClipTextFileHandler.BufferSize.get(j)]; input.read(bufferData); Sharedbuffer.put(bufferData); i++; j++; TotalBuffer--; }

    Read the article

  • Displaying a collection of controls in a specific way in WPF

    - by Alvaro
    I have a collection of controls "MyCollection" wich changes in the Runtime. And I have to follow some constraints for that, for example: If my parameter "MyCollection.Count = 4" the property "NumberOfcolumns" will have the value 2, in order to create new Lines, and show the controls Two per Two. This is how I'm displaying my collection : <ItemsControl ItemsSource="{Binding MyCollection}" BorderThickness="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" > <ItemsControl.ItemsPanel> <ItemsPanelTemplate > <UniformGrid Columns="{Binding NumberOfColumns}" VerticalAlignment="Center" HorizontalAlignment="Center" Background="Transparent"/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> </ItemsControl> The problem is that my controls have different sizes, and as In UniformGrids, Cells are uniform... My design is not really pretty, because I have little controls shown in big Cells !! Can someone help me to solve this problem ? NB: Please give me a detailled solution if possible, not something like : "Use WrapPanel..."

    Read the article

  • How to create custom omniauth provider (how to return data)

    - by user2803917
    I searched all around the net, how to create a custom provider for omniauth.. and i succedded partly.. I created a gem, and it worked perfectly, except the part, that i cant understand how to return the gathered data to sessions controller, like other providers do.. here is the code in auth gem: require 'multi_json' require 'digest/md5' require 'rest-client' module OmniAuth module Strategies class Providername < OmniAuth::Strategies::OAuth attr_accessor :app_id, :api_key, :auth def initialize(app, app_id = nil, api_key = nil, options = {}) super(app, :providername) @app_id = app_id @api_key = api_key end protected def request_phase redirect "http://valid_url" end def callback_phase if request.params['code'] && request.params['status'] == 'ok' response = RestClient.get("http://valid_url2/?code=#{request.params['auth_code']}") auth = MultiJson.decode(response.to_s) unless auth['error'] @auth_data = auth if @auth_data @return_data = OmniAuth::Utils.deep_merge(super, { 'uid' => @auth_data['uid'], 'nickname' => @auth_data['nick'], 'user_info' => { 'first_name' => @auth_data['name'], 'last_name' => @auth_data['surname'], 'location' => @auth_data['place'], }, 'credentials' => { 'apikey' => @auth_data['apikey'] }, 'extra' => {'user_hash' => @auth_data} }) end end else fail!(:invalid_request) end rescue Exception => e fail!(:invalid_response, e) end end end end and here i call it in my initializers: Rails.application.config.middleware.use OmniAuth::Builder do provider "providername", Settings.providers.providername.app_id, Settings.providers.providername.app_secret end in this code, everything works fine so far, the provider gets called, i get the info from provider, i create a hash (@auth_data) with info, but how do i return it

    Read the article

  • Set Recurring payment with different initial payment in Paypal

    - by www.sapnaedu.in
    I am developing a payment option in a PHP based application. The user can choose Paypal or Paypal recurring method to make a payment. However, the user would pay $50 for the first time and $40 starting from next month. However, when the user chooses the Paypal recurring option and he pays $50, Paypal automatically chooses $50 from the next month onwards. Is it possible to set the different initial payment and recurring payment ? Here is the part of the code : echo "<input type=\"hidden\" name=\"no_shipping\" value=\"1\"/>\n"; echo "<input type=\"hidden\" name=\"a3\" value=\"".$amt."\"/>\n"; echo "<input type=\"hidden\" name=\"p3\" value=\"1\"/>\n"; echo "<input type=\"hidden\" name=\"t3\" value=\"M\"/>\n"; echo "<input type=\"hidden\" name=\"src\" value=\"1\"/>\n"; echo "<input type=\"hidden\" name=\"sra\" value=\"1\"/>\n"; echo "<input type=\"hidden\" name=\"no_note\" value=\"1\"/>\n"; Thanks Kiran

    Read the article

  • include_once error : failed to open stream in Boonex Dolphin v7.0.9

    - by Guillaume Pierre
    first let me say I'm a beginner in PHP, specifically PHP Object-oriented programming. I'm working on a V7.0.9 dolphin version.http://www.boonex.com/dolphin While I'm trying to include a class.php from a 3rd-part developer I work with <?php include_once ('modules/developer/configure/classes/class.php'); I get this error : Warning: include_once(modules/developer/configure/classes/ClassExample.php): failed to open stream: No such file or directory in /var/www/vhosts/mysite.com/httpdocs/dolphin/inc/classes/BxDolPageView.php(612) : eval()'d code on line 2 Warning: include_once(): Failed opening 'modules/developer/configure/classes/ClassExample.php' for inclusion (include_path='.:') in /var/www/vhosts/mysite.com/httpdocs/dolphin/inc/classes/BxDolPageView.php(612) : eval()'d code on line 2 Fatal error: Class 'ClassExample' not found in /var/www/vhosts/mysite.com/httpdocs/dolphin/inc/classes/BxDolPageView.php(612) : eval()'d code on line 6 I'm trying to figure out where is the problem... does it comes from Boonex? or is it linked to my server configuration? I really don't know where to begin to resolve... Thx in advance for your kind help if you get knowledge on it

    Read the article

  • xslt check for alpha numeric character

    - by Newcoma
    I want to check if a string contains only alphanumeric characters OR '.' This is my code. But it only works if $value matches $allowed-characters exactly. I use xslt 1.0. <xsl:template name="GetLastSegment"> <xsl:param name="value" /> <xsl:param name="separator" select="'.'" /> <xsl:variable name="allowed-characters">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.</xsl:variable> <xsl:choose> <xsl:when test="contains($value, $allowed-characters)"> <xsl:call-template name="GetLastSegment"> <xsl:with-param name="value" select="substring-after($value, $separator)" /> <xsl:with-param name="separator" select="$separator" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$value" /> </xsl:otherwise> </xsl:choose> </xsl:template>

    Read the article

  • SQL Server, Generate scripts, unencrypted stored procedures only

    - by PeterO
    I have a SQL Server database with 3195 stored procedures. Most (approx 90%) of the stored procedures are encrypted (it's a 3rd party app) but there are many that are not encrypted (added by consultants later). I need to get an overview of the unencrypted stored procedures created by consultants and then apply fixes so that they can work with UTC time. I use Generate Scripts and select only stored procedures but that fails. I assume that is because the first stored procedure that it tries to write out is encrypted. Is there a way to write out the approx 300 stored procedures that are not encrypted?

    Read the article

  • Call an member function implementing the {{#linkTo ...}} helper from javascript code

    - by gonvaled
    I am trying to replace this navigation menu: <nav> {{#linkTo "nodes" }}<i class="icon-fixed-width icon-cloud icon-2x"></i>&nbsp;&nbsp;{{t generic.nodes}} {{grayOut "(temporal)"}}{{/linkTo}} {{#linkTo "services" }}<i class="icon-fixed-width icon-phone icon-2x"></i>&nbsp;&nbsp;{{t generic.services}}{{/linkTo}} {{#linkTo "agents" }}<i class="icon-fixed-width icon-headphones icon-2x"></i>&nbsp;&nbsp;{{t generic.agents}}{{/linkTo}} {{#linkTo "extensions" }}<i class="icon-fixed-width icon-random icon-2x"></i>&nbsp;&nbsp;{{t generic.extensions}}{{/linkTo}} {{#linkTo "voiceMenus" }}<i class="icon-fixed-width icon-sitemap icon-2x"></i>&nbsp;&nbsp;{{t generic.voicemenus}}{{/linkTo}} {{#linkTo "queues" }}<i class="icon-fixed-width icon-tasks icon-2x"></i>&nbsp;&nbsp;{{t generic.queues}}{{/linkTo}} {{#linkTo "contacts" }}<i class="icon-fixed-width icon-user icon-2x"></i>&nbsp;&nbsp;{{t generic.contacts}}{{/linkTo}} {{#linkTo "accounts" }}<i class="icon-fixed-width icon-building icon-2x"></i>&nbsp;&nbsp;{{t generic.accounts}}{{/linkTo}} {{#linkTo "locators" }}<i class="icon-fixed-width icon-phone-sign icon-2x"></i>&nbsp;&nbsp;{{t generic.locators}}{{/linkTo}} {{#linkTo "phonelocations" }}<i class="icon-fixed-width icon-globe icon-2x"></i>&nbsp;&nbsp;{{t generic.phonelocations}}{{/linkTo}} {{#linkTo "billing" }}<i class="icon-fixed-width icon-euro icon-2x"></i>&nbsp;&nbsp;{{t generic.billing}}{{/linkTo}} {{#linkTo "profile" }}<i class="icon-fixed-width icon-cogs icon-2x"></i>&nbsp;&nbsp;{{t generic.profile}}{{/linkTo}} {{#linkTo "audio" }}<i class="icon-fixed-width icon-music icon-2x"></i>&nbsp;&nbsp;{{t generic.audio}}{{/linkTo}} {{#linkTo "editor" }}<i class="icon-fixed-width icon-puzzle-piece icon-2x"></i>&nbsp;&nbsp;{{t generic.node_editor}}{{/linkTo}} </nav> With a more dynamic version. What I am trying to do is to reproduce the html inside Ember.View.render, but I would like to reuse as much Ember functionality as possible. Specifically, I would like to reuse the {{#linkTo ...}} helper, with two goals: Reuse existing html rendering implemented in the {{#linkTo ...}} helper Get the same routing support that using the {{#linkTo ...}} in a template provides. How can I call this helper from within javascript code? This is my first (incomplete) attempt. The template: {{view SettingsApp.NavigationView}} And the view: var trans = Ember.I18n.t; var MAIN_MENU = [ { 'linkTo' : 'nodes', 'i-class' : 'icon-cloud', 'txt' : trans('generic.nodes') }, { 'linkTo' : 'services', 'i-class' : 'icon-phone', 'txt' : trans('generic.services') }, ]; function getNavIcon (data) { var linkTo = data.linkTo, i_class = data['i-class'], txt = data.txt; var html = '<i class="icon-fixed-width icon-2x ' + i_class + '"></i>&nbsp;&nbsp;' + txt; return html; } SettingsApp.NavigationView = Ember.View.extend({ menu : MAIN_MENU, render: function(buffer) { for (var i=0, l=this.menu.length; i<l; i++) { var data = this.menu[i]; // TODO: call the ember function implementing the {{#linkTo ...}} helper buffer.push(getNavIcon(data)); } return buffer; } });

    Read the article

  • How to Convert Date(from date time input field) to another date format in C#?

    - by Saeed Khan
    I have Date time input field from where I am taking date and converting it to another format, my code for that try { DateTime dt = dtiFrom.Value.Date; string format = "DD-MM-YYYY"; // Use this format MessageBox.Show(dt.ToString(format)); // here its shows result as DD-10-YYYY DateTime dt1 = Convert.ToDateTime(dt.ToString(format)); // here Error "The string was not recognized as a valid DateTime. There is an unknown word starting at index 0." } catch (Exception ee) { MessageBox.Show(ee.Message, "Error Message!"); } I am not able to convert date according to my format. please could any body help me in code or suggest me some code. thanks in advance

    Read the article

  • Cannot login to Activeadmin after gem update

    - by user1883793
    After bundle update I cannot login to my Activeadmin, here is the log. Is it because the unpermitted params? do I need to config strong parameter to make admin login work? I already have this code for devise: def configure_permitted_parameters devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:email, :password, :remember_me) } devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password) } end Started POST "/admin/login" for 127.0.0.1 at 2013-10-30 22:33:25 +1300 Processing by ActiveAdmin::Devise::SessionsController#create as HTML Parameters: {"utf8"=>"?", "authenticity_token"=>"MhoM/R/oVfad/iiov2zpqfoJ5XOSLda6rTl/V2cMIZE=", "admin_user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Login"} Completed 401 Unauthorized in 0.6ms Processing by ActiveAdmin::Devise::SessionsController#new as HTML Parameters: {"utf8"=>"?", "authenticity_token"=>"MhoM/R/oVfad/iiov2zpqfoJ5XOSLda6rTl/V2cMIZE=", "admin_user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Login"} Unpermitted parameters: email, password, remember_me Rendered /home/jcui/.rvm/gems/ruby-1.9.3-p194/gems/activeadmin-0.6.2/app/views/active_admin/devise/shared/_links.erb (0.6ms) Rendered /home/jcui/.rvm/gems/ruby-1.9.3-p194/gems/activeadmin-0.6.2/app/views/active_admin/devise/sessions/new.html.erb within layouts/active_admin_logged_out (118.2ms) Completed 200 OK in 130.7ms (Views: 129.9ms | ActiveRecord: 0.0ms | Solr: 0.0ms)

    Read the article

  • BitmapFactory.decodeFile out of memory with images 2400x2400

    - by alasarr
    I need to send an image from a file to a server. The server request the image in a resolution of 2400x2400. What I'm trying to do is: 1) Get a Bitmap using BitmapFactory.decodeFile using the correct inSampleSize. 2) Compress the image in JPEG with a quality of 40% 3) Encode the image in base64 4) Sent to the server I cannot achieve the first step, it throws an out of memory exception. I'm sure the inSampleSize is correct but I suppose even with inSampleSize the Bitmap is huge (around 30 MB in DDMS). Any ideas how can do it? Can I do these steps without created a bitmap object? I mean doing it on filesystem instead of RAM memory. This is the current code: // The following function calculate the correct inSampleSize Bitmap image = Util.decodeSampledBitmapFromFile(imagePath, width,height); // compressing the image ByteArrayOutputStream baos = new ByteArrayOutputStream(); image.compress(Bitmap.CompressFormat.JPEG, 40, baos); // encode image String encodedImage = Base64.encodeToString(baos.toByteArray(),Base64.DEFAULT));

    Read the article

  • passing dynamic values in callback method

    - by swastican
    is there a way to pass dynamic values to callback function in js or jquery or nodejs. for(var i = 0; i < 10; i++) { filename = 'file'+i+'.html'; request(url, function(error, response, body) { test(error, response, body, filename); }); function test(error, response, body, filename) { console.log('file name ' + filename); if(response.statusCode == 200){ console.log('done'); } } I refered this so article for passing values to callback function. link: [JavaScript: Passing parameters to a callback function the output always seems to be 9 How can i pass values dynamically? The callback function always refers the last value of filename.

    Read the article

  • How to split row into multiple rows from the MySQL?

    - by user2818537
    I have a MySQL data table, in which I have more than 2 columns. First column has a unique value clinical trial value whereas second column has disease information. There are, in most of the cases, more than 2 disease names in one cell for a single id. I want to spilt those rows which cell contains two or more than two diseases. There is a pattern for searching also, i.e. small character is immediately followed by capital character., e.g. MalariaDengueTuberculosis like this. Suppose for these three diseases there is unique id, it should show like the following: NCT-ID disease 4534343654 Maleria 4534343654 Dengue 4534343654 Tubercoulsosis

    Read the article

  • Angularjs: addition of integers even after I parse the variable as integer

    - by Shiv Kumar
    I really have a weird problem in adding two numbers. Here is my code, in the first controller everything is working fine, but in the second controller instead of 0 if I add 10, the output is completely weird Here is html code <div ng-app=""> <div ng-controller="Controller1"> <br/>**** Controller-1 <br/>Add 0 : {{update1(0)}} <br/>Add 10 : {{update1(10)}} <br/>Add 50 : {{update1(50)}} <br/>Add -60 : {{update1(-60)}}</div> <div ng-controller="Controller2"> <br/>**** Controller-2 <br/>Add 10 : {{update2(10)}} <br/>Add 10 : {{update2(10)}} <br/>Add 50 : {{update2(50)}} <br/>Add -60 : {{update2(-60)}}</div> </div> Here is my javascript function Controller1($scope) { var x = 0; $scope.update1 = function (smValue) { x += parseInt(smValue); return x; } } function Controller2($scope) { var y = 0; $scope.update2 = function (smValue) { y += parseInt(smValue); return y; } } and here is the output **** Controller-1 Add 0 : 0 Add 10 : 10 Add 50 : 60 Add -60 : 0 **** Controller-2 Add 0 : 110 Add 10 : 120 Add 50 : 170 Add -60 : 110 here is the link to try: http://jsfiddle.net/6VqqN/ can anyone please explain me why it is behaving like that. Even if I add a 3or4 digit number, output is completely different then what I expected.

    Read the article

  • asses resouces from another apk for widget(like theme apk)

    - by Diljeet
    asses resouces from another apk for widget(like theme apk) Hello i made a theme with drawables and strings, i can access the theme's resources by following commands String packagename="com....."; Resources res = context.getPackageManager().getResourcesForApplication(packagename); int strid = res.getIdentifier(packagename+":string/"+name, "string", packagename); int drawableid = res.getIdentifier(packagename+":drawable/"+name, "drawable", packagename); String name = res.getString(resid); Bitmap bmp = BitmapFactory.decodeResource(res, resid); //or Drawable dr=res.getDrawable(resid); I can get the drawables, but i don't know how to set the drawables in xml to a widget. I only can set setImageViewResource(int viewid, int resId); So i am asking that how to access xml resources from another apk and set widget drawables from it. I want to access a resource like this from another theme apk, but i can only access the drawable(so can't use it for widgets) <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/wplayh" /> <item android:drawable="@drawable/wplay" /> </selector>

    Read the article

  • How to get the text with in the datatemplate?

    - by rakish
    I have used below code <DataTemplate x:Key="myTemplate"> <TextBlock Text="Hi"></TextBlock> </DataTemplate> in this case i can able to get the textblock text by using below code DataTemplate myTemplate = this.Resources["myTemplate"] as DataTemplate; TextBlock rootElement = myTemplate.LoadContent() as TextBlock; //I can get the text "rootElement.text " but when i use binding means i cant able to get the text <DataTemplate x:Key="myTemplate"> <TextBlock Text="{Binding EmployeeName}"></TextBlock> </DataTemplate>

    Read the article

  • How to save a HTMLElement (Table) in localStorage?

    - by Hagbart Celine
    I've been trying this for a while now and could not find anything online... I have a project, where tablerows get added to a table. Works fine. Now I want to save the Table in the localStorage, so I can load it again. (overwrite the existing table). function saveProject(){ //TODO: Implement Save functionality var projects = []; projects.push($('#tubes table')[0].innerHTML); localStorage.setItem('projects', projects); //console.log(localStorage.getItem('projects')); The problem is the Array "projects" has (after one save) 2000+ elements. But all I want is the whole table to be saved to the first (or appending later) index. In the end I want the different Saves to be listed on a Option element: function loadSaveStates(){ alert('loading saved states...'); var projects = localStorage.getItem('projects'); select = document.getElementById('selectSave'); //my Dropdown var length = projects.length, element = null; console.log(length); for (var i = 0; i < length; i++) { element = projects[i]; var opt = document.createElement('option'); opt.value = i; opt.innerHTML = 'project ' + i; select.appendChild(opt); } } Can anyone tell me what I am doing wrong?

    Read the article

  • making query from different related tables using codeigniter

    - by fatemeh karam
    I'm using codeigniter as i mentioned this is a part of my view code foreach($projects_query as $row)// $row indicates the projects { ?> <tr><td><h3><button type="submit" class="button red-gradient glossy" name = "project_click" > <?php echo $row->txtTaskName; ?></button></h3></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr> <?php foreach($tasks_query as $row2) { // if( $row->txtTaskName == "TestProject") if($row->intTaskID == $row2->intInside)// intInside indicades that the current task($row2) is the subset of which task (system , subsystem or project) { if($row2->intSummary == 0)//if the task(the system) is an executable task & doesn't have any subtask: { $query_team_user_id = $this->admin_in_out_model->get_user_team_task_query($row2->intTaskID);//runs the function and generates a query from tbl_userteamtask where intTaskID equals to the selected row's intTaskID foreach($query_team_user_id as $row_teamid) { $query_teamname = $this->admin_in_out_model->get_team_name($row_teamid->intTeamID); $query_fn_ln = $this->admin_in_out_model->get_fn_ln_from_userid($row_teamid->intUserID); foreach($query_teamname as $row_teamname) {?> <tr><td></td><td></td><td><h4> <?php echo $row2->txtTaskName;?></h4></td> <td><b><font color='#F33558'><?php echo $row_teamname->txtTeamName;?></font></b></td> <?php } foreach($query_fn_ln as $row_f_l_name) {?> <td> <?php echo $row_f_l_name->txtFirstname." ".$row_f_l_name->txtLastname;?></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td> <?php }?> </tr> <?php } } else{ ?> <tr><td></td><td></td><td><h4> <?php echo $row2->txtTaskName;?></h4></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><?php } foreach($tasks_query as $row_subsystems) { if($row_subsystems->intInside == $row2->intTaskID )//if the task is the subtask of a system(it means the task is a subsystem) { if($row_subsystems->intSummary == 0)//if the task is an executable task & doesn't have any subtask: { $query_team_user_id = $this->admin_in_out_model->get_user_team_task_query($row_subsystems->intTaskID); foreach($query_team_user_id as $row_teamid) {?> <tr><?php $query_teamname = $this->admin_in_out_model->get_team_name($row_teamid->intTeamID); $query_fn_ln = $this->admin_in_out_model->get_fn_ln_from_userid($row_teamid->intUserID); foreach($query_teamname as $row_teamname) {?> <td></td><td></td><td><h5><?php echo $row_subsystems->txtTaskName?></h5><br/></td> <td><b><font color='#F33558'><?php echo $row_teamname->txtTeamName;?></font></b></td><?php } foreach($query_fn_ln as $row_f_l_name) {?> <td><?php echo $row_f_l_name->txtFirstname." ".$row_f_l_name->txtLastname;?></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><?php }?> </tr><?php } } else{ ?><tr><td></td><td></td><td><h5><?php echo $row_subsystems->txtTaskName?></h5></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><?php } foreach($tasks_query as $row_tasks) { if($row_tasks->intInside == $row_subsystems->intTaskID )//if the task is the subtask of a subsystem { if($row_tasks->intSummary == 0)//if the task is an executable task & doesn't have any subtask: { $query_team_user_id = $this->admin_in_out_model->get_user_team_task_query($row_tasks->intTaskID); foreach($query_team_user_id as $row_teamid) {?> <tr><?php $query_teamname = $this->admin_in_out_model->get_team_name($row_teamid->intTeamID); $query_fn_ln = $this->admin_in_out_model->get_fn_ln_from_userid($row_teamid->intUserID); foreach($query_teamname as $row_teamname) {?> <td></td><td></td><td><b><?php echo $row_tasks->txtTaskName;?></b></td> <td><b><font color='#F33558'><?php echo $row_teamname->txtTeamName;?></font></b></td><?php } foreach($query_fn_ln as $row_f_l_name) {?> <td><?php echo $row_f_l_name->txtFirstname." ".$row_f_l_name->txtLastname;?></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><?php }?> </tr><?php } } } } } } } } }?> and in controller i have $projects_query = $this->admin_in_out_model->get_projects(); $tasks_query = $this->admin_in_out_model->get_systems(); $userteamtask = $this->admin_in_out_model->get_user_team_task(); $data['tasks_query'] = $tasks_query; $data['projects_query'] = $projects_query; $this->load->view('project_view',$data); but as you see I'm calling my model functions within the view how can i do something else to do this i mean not calling my model function in my view I have to add that, my model function have parameters these are the model functions: function get_projects() { $this -> db -> select('*'); $this -> db -> from('tbl_task'); $this -> db -> where('intInside','0'); $query = $this->db->get(); return $query->result(); } function get_systems() { $this -> db -> select('*'); $this -> db -> from('tbl_task '); $this -> db -> where('intInside <> ','0'); $query = $this->db->get(); return $query->result(); } function get_user_team_task_query($task_id)//gets information from tbl_userteamtask where the field intTaskID is equal to $task_id { $this -> db -> select('*'); $this -> db -> from('tbl_userteamtask'); $this -> db -> where('intTaskID',$task_id); $query_teamid = $this->db->get(); return $query_teamid->result(); } function get_user_team_task()//gets information from tbl_userteamtask where the field intTaskID is equal to $task_id { $this -> db -> select('*'); $this -> db -> from('tbl_userteamtask'); // $this -> db -> where('intTaskID',$task_id); $query_teamid = $this->db->get(); return $query_teamid->result(); } function get_team_name($query_teamid) { $this -> db -> select('*'); $this -> db -> from('tbl_team'); $this -> db -> where('intTeamID',$query_teamid); $query_teamname = $this->db->get(); return $query_teamname->result(); } function get_user_name($query_userid) { $this -> db -> select('*'); $this -> db -> from('tbl_user'); $this -> db -> where('intUserID',$query_userid); $query_username = $this->db->get(); return $query_username->result(); } function get_fn_ln_from_userid($selected_id) { $this -> db -> select('tbl_user.intUserID, tbl_user.intPersonID,tbl_person.intPersonID,tbl_person.txtFirstname, tbl_person.txtLastname'); $this -> db -> from('tbl_user , tbl_person'); $where = "tbl_user.intPersonID = tbl_person.intPersonID "; $this -> db -> where($where); $this -> db -> where('tbl_user.intUserID', $selected_id); $query = $this -> db -> get();//makes query from DB return $query->result(); } do I have to use subquery ? is this true? i mean can i do this? foreach( $data as $key => $each ) { $data[$key]['team_id'] = $this->get_user_team_task_query( $each['intTaskID'] ); foreach($data[$key]['team_id'] as $key_teamname => $each) { $data[$key_teamname]['team_name'] = $this->get_team_name( $each['intTeamID'] ); } } the model code: foreach( $data as $key => $each ) { $data[$key]['intTaskID'] = $each['intTaskID']; $data[$key]['team_id'] = $this->get_user_team_task_query( $each['intTaskID'] ); foreach($data[$key]['team_id'] as $key => $each) { $data[$key]['team_name'] = $this->get_team_name( $each['intTeamID'] ); #fetching of the teamname and saving in the array $data[$key]['user_name'] = $this->get_fn_ln_from_userid( $each['intUserID'] ); foreach($data[$key]['user_name'] as $key => $each) { $data[$key]['first_name'] = $each['txtFirstname'] ; $data[$key]['last_name'] = $each['txtLastname'] ; } $data[$key]['first_name'] = $data[$key]['first_name']; $data[$key]['last_name'] = $data[$key]['last_name']; } }

    Read the article

  • Git submodules not updating?

    - by DavidYell
    I have a project in which I've included some libraries as submodules. They work fine on the machine that you add them on, but when I get home and checkout the repo, I get the folders for the submodules but they are empty. .gitmodules Neon@Neon-PC /cygdrive/c/xampp/htdocs/learning-lithium $ cat .gitmodules [submodule "libraries/lithium"] path = libraries/lithium url = git://github.com/UnionOfRAD/lithium.git [submodule "app/webroot/css/elements"] path = app/webroot/css/elements url = https://github.com/dmitryf/elements.git [submodule "app/libraries/li3_markdown"] path = app/libraries/li3_markdown url = https://github.com/sandelius/li3_markdown.git [submodule "app/webroot/markitup"] path = app/webroot/markitup url = https://github.com/markitup/1.x.git Config and status commands Neon@Neon-PC /cygdrive/c/xampp/htdocs/learning-lithium $ git submodule -af14f48b419310935446176290e1f9dc641400e0 app/libraries/li3_markdown -ebdcd8ca09c874f5e2ef81ec198cc441f37a4f74 app/webroot/css/elements -328291e49a3c7e1fb76b3342f112734864836205 app/webroot/markitup -4980010526d05c556c496ff63951da31828c5943 libraries/lithium Neon@Neon-PC /cygdrive/c/xampp/htdocs/learning-lithium $ git submodule update Neon@Neon-PC /cygdrive/c/xampp/htdocs/learning-lithium $ git submodule status -af14f48b419310935446176290e1f9dc641400e0 app/libraries/li3_markdown -ebdcd8ca09c874f5e2ef81ec198cc441f37a4f74 app/webroot/css/elements -328291e49a3c7e1fb76b3342f112734864836205 app/webroot/markitup -4980010526d05c556c496ff63951da31828c5943 libraries/lithium I added these as you would normally with, git submodule add <repo> <path> git submodule init The submodules are hosted on Github and my repo is hosted on Bitbucket, although I'm not sure if this is relevant.

    Read the article

  • Assign two static IP addresses to one mac address

    - by Timo Ylikännö
    Can Isc-dhcp-server give two static ip addresses to one mac address? I have several home terminals in my network. Each terminal have two interfaces. One for public traffic and one for a management traffic. Both interfaces have same mac address. DHCP server can detect interfaces via dhcp option field and dhcp class declarations. Every terminal have to have static ip address instead of dynamic address. With dynamic address and dynamic pools this would be an easy task. Or is there any dhcp server that can do this?

    Read the article

  • Updating WordPress 3.6 to 3.7 via admin area on Nginx VPS hangs and fails

    - by harryg
    So I have a few WordPress sites running on my VPS (Ubuntu 12.10, Nginx, php-fpm 5.4) The sites are all on seperate vhosts and use their own config files (albeit similar to each other) and vary in complexity. One is very simple and uses minimal plugins. When I try to update core on any site via the admin area I click the "Update Now" button (which should run the script in wp-admin/update-core.php the page hangs for a minute or two before going to a blank admin page (i.e. the wp-admin menu bars and header bar are there but there is no content in the body of the page). Visiting another admin page via the still menu bar reveals that the core has not been updated. Checking the error log I see this entry: 2013/10/29 23:20:48 [error] 9384#0: *5318248 upstream timed out (110: Connection timed out) while reading upstream, client: --.---.--.---, server: www.mysite.com, request: "POST /wp-admin/update-core.php?action=do-core-upgrade HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/wp-admin/update-core.php" This didn't happen in the past on older updates and the rest of the site including updating plugins works fine. Any ideas? Could it be as simple as a time-out error? I find that unlikely as the server should munch though a wp upgrade in seconds.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >