Daily Archives

Articles indexed Wednesday November 13 2013

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

  • OpenGL texture on sphere

    - by Cilenco
    I want to create a rolling, textured ball in OpenGL ES 1.0 for Android. With this function I can create a sphere: public Ball(GL10 gl, float radius) { ByteBuffer bb = ByteBuffer.allocateDirect(40000); bb.order(ByteOrder.nativeOrder()); sphereVertex = bb.asFloatBuffer(); points = build(); } private int build() { double dTheta = STEP * Math.PI / 180; double dPhi = dTheta; int points = 0; for(double phi = -(Math.PI/2); phi <= Math.PI/2; phi+=dPhi) { for(double theta = 0.0; theta <= (Math.PI * 2); theta+=dTheta) { sphereVertex.put((float) (raduis * Math.sin(phi) * Math.cos(theta))); sphereVertex.put((float) (raduis * Math.sin(phi) * Math.sin(theta))); sphereVertex.put((float) (raduis * Math.cos(phi))); points++; } } sphereVertex.position(0); return points; } public void draw() { texture.bind(); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, sphereVertex); gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, points); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); } My problem now is that I want to use this texture for the sphere but then only a black ball is created (of course because the top right corner s black). I use this texture coordinates because I want to use the whole texture: 0|0 0|1 1|1 1|0 That's what I learned from texturing a triangle. Is that incorrect if I want to use it with a sphere? What do I have to do to use the texture correctly?

    Read the article

  • Load different levels in XML

    - by Anearion
    my question is more about a theoretical gener than a pratical way to make things happen. I'm about start developing a game for android, text based so i won't need sprites or animation, nor a game engine. Let's say is similar to a sudoku game, where each level is an harder version of sudoku and each level has some question to be asnwered over the sudoku itself. I was wondering if the better way is to have only one XML and then inside all the different levels, each one with his meta-tags, or if the different approach of making n xml files where each one is a level is preferred. At the moment a level should have those tags: <level> <question>Question_1</question> <hint1>what does it do?</hint1> <hint2>where...</hint2> .... <hintN>how...</hintN> </level> So each level could have some items to read and that's what made me think that maybe different files are better cuz if i have to load lvl 10 i can read only the 10.xml file. I hope my question isn't too stupind. Thanks in advance

    Read the article

  • scaling point sprites with distance

    - by Will
    How can you scale a point sprite by its distance from the camera? GLSL fragment shader: gl_PointSize = size / gl_Position.w; seems along the right tracks; for any given scene all sprites seem nicely scaled by distance. Is this correct? How do you compute the proper scaling for my vertex attribute size? I want each sprite to be scaled by the modelview matrix. I had played with arbitrary values and it seems that size is the radius in pixels at the camera, and is not in modelview scale. I've also tried: gl_Position = pMatrix * mvMatrix * vec4(vertex,1.0); vec4 v2 = pMatrix * mvMatrix * vec4(vertex.x,vertex.y+0.5*size,vertex.z,1.0); gl_PointSize = length(gl_Position.xyz-v2.xyz) * gl_Position.w; But this makes the sprites be bigger in the distance, rather than smaller:

    Read the article

  • Collision detection - Smooth wall sliding, no bounce effect

    - by Joey
    I'm working on a basic collision detection system that provides point - OBB collision detection. I have around 200 cubes in my environment and I check (for now) each of them in turn and see if it collides. If it does I return the colliding face's normal, save the old player position and do some trigonometry to return a new player position for my wall sliding. edit I'll define my meaning of wall sliding: If a player walks in a vertical slope and has a slight horizontal rotation to the left or the right and keeps walking forward in the wall the player should slide a little to the right/left while continually walking towards the wall till he left the wall. Thus, sliding along the wall. Everything works fine and with multiple objects as well but I still have one problem I can't seem to figure out: smooth wall sliding. In my current implementation sliding along the walls make my player bounce like a mad man (especially noticable with gravity on and moving forward). I have a velocity/direction vector, a normal vector from the collided plane and an old and new player position. First I negate the normal vector and get my new velocity vector by substracting the inverted normal from my direction vector (which is the vector to slide along the wall) and I add this vector to my new Player position and recalculate the direction vector (in case I have multiple collisions). I know I am missing some step but I can't seem to figure it out. Here is my code for the collision detection (run every frame): Vector direction; Vector newPos(camera.GetOriginX(), camera.GetOriginY(), camera.GetOriginZ()); direction = newPos - oldPos; // Direction vector // Check for collision with new position for(int i = 0; i < NUM_OBJECTS; i++) { Vector normal = objects[i].CheckCollision(newPos.x, newPos.y, newPos.z, direction.x, direction.y, direction.z); if(normal != Vector::NullVector()) { // Get inverse normal (direction STRAIGHT INTO wall) Vector invNormal = normal.Negative(); Vector wallDir = direction - invNormal; // We know INTO wall, and DIRECTION to wall. Substract these and you got slide WALL direction newPos = oldPos + wallDir; direction = newPos - oldPos; } } Any help would be greatly appreciated! FIX I eventually got things up and running how they should thanks to Krazy, I'll post the updated code listing in case someone else comes upon this problem! for(int i = 0; i < NUM_OBJECTS; i++) { Vector normal = objects[i].CheckCollision(newPos.x, newPos.y, newPos.z, direction.x, direction.y, direction.z); if(normal != Vector::NullVector()) { Vector invNormal = normal.Negative(); invNormal = invNormal * (direction * normal).Length(); // Change normal to direction's length and normal's axis Vector wallDir = direction - invNormal; newPos = oldPos + wallDir; direction = newPos - oldPos; } }

    Read the article

  • How do I apply 2 rotations about different points to a single primitive using OpenGL

    - by Fenoec
    I'm working on a 2D top-down shooter game that has a rotation feature like Realm Of The Mad God such that if you press e the camera rotates around the character in a clockwise direction and q rotates the camera around the character in a counterclockwise direction. I have this working with my floors and walls by translating to the character, doing the screen rotation, and drawing everything with the character as the origin. The problem arises when I shoot projectiles which need to both rotate around the character and rotate around themselves (shooting uses the mouse cursor so I can shoot at any angle). For example, if the screen is not rotated and I'm shooting rectangular projectiles, I want them to face in the direction I'm shooting (rotation around themselves). However if I only do this rotation, when I then rotate the screen the projectiles will always shoot at the same position because my cursor position does not change. Therefore I need to also either rotate the projectiles around the character or rotate the mouse cursor position to get the correct position (which would then totally screw up all of the collision detection). Likewise if I only do the screen rotation on projectiles, the rectangles will always be facing the same way and they would only look correct if I were shooting straight up or straight down. So my question is, how can I perform 2 rotations on a primitive around 2 different points? The only way I can think of is to translate to the character and do the screen rotation, then somehow calculate the translation required to move back to the middle of the projectile (seeing as how my axes are now rotated) and do its rotation. Or am I thinking about this in the wrong way and there is a different solution to accomplishing this effect?

    Read the article

  • eclipse show errors but compiles when external makefile

    - by Anthony
    I have some c++ code using CImg and Eigen libraries. At the c++ code I define a plugin like this #define cimg_plugin1 "my_plugin.h" #include "CImg.h" The plugin contains many method definitions that are used at the c++ code. I also have a makefile that when called from the command line (./make), allows me to compile everything, and generates an executable. I want to import this code into a new Eclipse project, and I do it so: NewProjectC++ projectmakefile projectempty project unmark "Use default location", and select the folder containing my code at the filesystem ProjectpropertiesC/C++ Buildunmark "Use default build command" and set it to use my makefile Also in project propertiesC/C++ GeneralPaths and SymbolsAdd paths to folders containing Eigen and CImg Rebuild index Clean project Restart eclipse When I build the project, eclipse tells me I have more than 1000 errors in "my_plugin.h", but it is capable to generate the executable. Even though, I would like to get rid of this errors, because they are annoying. Also, if I want to open the declaration of CImg methods used at the plugin, I can't. I know it has been asked before, but any of the solutions I found were satisfactory for me (most of them enumerated at the previous list). The sources I visited are the following, and I would be really happy if you find and tell me others I didn't see. Eclipse shows errors but project compile fine eclipse C project shows errors (Symbol could not be resolved) but it compiles Eclipse CDT shows some errors, but the project is successfully built http://www.eclipse.org/forums/index.php/t/247954/

    Read the article

  • Using Toad with 64bit Oracle Client and Windows 7 64bit Operating System

    - by Andy5
    After downloading the latest version of Toad for Windows 7 64bit, I am struggling to get it to connect to the database using the existing full Oracle Client that is already on the desktop. The Oracle Client that is there is a 64bit version and is version 12c. When running Toad it says that there is no Oracle Client installed. All of the environment variables have been set up to point to the Oracle Client I note from the attached link that when using Toad in a 64bit os that you have to use a 32bit client? Is this still the case? If not how do I get it to use the Oracle Client? I cannot use another version because of the application that is using it needs that version. http://www.quest.com/toad-development-suite-for-oracle/ Thanks

    Read the article

  • Javascript How to automatically change word when click without need to refresh browser.?

    - by Fakhrul Zakry
    im quite lost here and not really expert about javascript. I want to change the content when user click with "Thanks for vote" automatically without need to refresh the page. Here is my html: {% if poll.privacy == "own" and request.user.get_profile.parliment != poll.location %} You do not have permission to vote this. {% else %} {% if has_vote %} {% if poll.rating_option == '1to5' %} <div class="rate"> <div id="poll-rate-{{ poll.pk }}"></div> </div> {% else %} Thanks for your vote. {% endif %} {% else %} {% if poll.rating_option == 'yes_no' %} <a href="javascript:void(0)" class="rate btn btn-xs btn-success mr5 vote-positive" rel="{% url 'vote_vote' poll.pk 1 %}" alt="{{ poll.pk }}">Yes</a> <a href="javascript:void(0)" class="rate btn btn-xs btn-danger vote-negative" rel="{% url 'vote_vote' poll.pk 0 %}" alt="{{ poll.pk }}">No</a> {% elif poll.rating_option == 'like_dislike' %} <a href="javascript:void(0)" class="rate btn btn-xs btn-success mr5 vote-positive" rel="{% url 'vote_vote' poll.pk 1 %}" alt="{{ poll.pk }}">Like</a> <a href="javascript:void(0)" class="rate btn btn-xs btn-danger vote-negative" rel="{% url 'vote_vote' poll.pk 0 %}" alt="{{ poll.pk }}">Dislike</a> {% elif poll.rating_option == '1to5' %} <div class="rate"> <div id="poll-rate-{{ poll.pk }}"></div> </div> {% endif %} {% endif %} {% endif %} and here is my javascript: function bindVoteHandler() { $('a.vote-positive, a.vote-negative').click(function(event) { event.preventDefault(); var link = $(this).attr('rel'); var poll_pk = $(this).attr('alt'); var selected_div = $(this).parent('div'); selected_div.html('<img src="{{ STATIC_URL }}img/loading_small.gif" />'); $.ajax(link).done(function( data ) { var result_div = $('div#vote-result-'+poll_pk); result_div.html(data); result_div.removeClass('vote-result-grey-out'); selected_div.html('<small>Thanks for your vote.</small>'); }); }); }; did anyone know what is the problem why i need to refresh my page after Like/Vote/rate to make it become (Thanks For your vote) ? please someone know help or share link with me. Below is the image: before click Like: after click Like: then when refreshed the word just displayed, it supposed automatically display when click Like. Thank you in advance..

    Read the article

  • Saving image from Gallery to db - Coursor IllegalStateException

    - by MyWay
    I want to save to db some strings with image. Image can be taken from gallery or user can set the sample one. In the other activity I have a listview which should present the rows with image and name. I'm facing so long this problem. It occurs when I wanna display listview with the image from gallery, If the sample image is saved in the row everything works ok. My problem is similar to this one: how to save image taken from camera and show it to listview - crashes with "IllegalStateException" but I can't find there the solution for me My table in db looks like this: public static final String KEY_ID = "_id"; public static final String ID_DETAILS = "INTEGER PRIMARY KEY AUTOINCREMENT"; public static final int ID_COLUMN = 0; public static final String KEY_NAME = "name"; public static final String NAME_DETAILS = "TEXT NOT NULL"; public static final int NAME_COLUMN = 1; public static final String KEY_DESCRIPTION = "description"; public static final String DESCRIPTION_DETAILS = "TEXT"; public static final int DESCRIPTION_COLUMN = 2; public static final String KEY_IMAGE ="image" ; public static final String IMAGE_DETAILS = "BLOP"; public static final int IMAGE_COLUMN = 3; //method which create our table private static final String CREATE_PRODUCTLIST_IN_DB = "CREATE TABLE " + DB_TABLE + "( " + KEY_ID + " " + ID_DETAILS + ", " + KEY_NAME + " " + NAME_DETAILS + ", " + KEY_DESCRIPTION + " " + DESCRIPTION_DETAILS + ", " + KEY_IMAGE +" " + IMAGE_DETAILS + ");"; inserting statement: public long insertToProductList(String name, String description, byte[] image) { ContentValues value = new ContentValues(); // get the id of column and value value.put(KEY_NAME, name); value.put(KEY_DESCRIPTION, description); value.put(KEY_IMAGE, image); // put into db return db.insert(DB_TABLE, null, value); } Button which add the picture and onActivityResult method which saves the image and put it into the imageview public void AddPicture(View v) { // creating specified intent which have to get data Intent intent = new Intent(Intent.ACTION_PICK); // From where we want choose our pictures intent.setType("image/*"); startActivityForResult(intent, PICK_IMAGE); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); // if identification code match to the intent, //if yes we know that is our picture, if(requestCode ==PICK_IMAGE ) { // check if the data comes with intent if(data!= null) { Uri chosenImage = data.getData(); String[] filePathColumn = {MediaStore.Images.Media.DATA}; Cursor cursor = getContentResolver().query(chosenImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String filePat = cursor.getString(columnIndex); cursor.close(); ImageOfProduct = BitmapFactory.decodeFile(filePat); if(ImageOfProduct!=null) { picture.setImageBitmap(ImageOfProduct); } messageDisplayer("got picture, isn't null " + IdOfPicture); } } } Then the code which converts bitmap to byte[] public byte[] bitmapToByteConvert(Bitmap bit ) { // stream of data getted for compressed bitmap ByteArrayOutputStream gettedData = new ByteArrayOutputStream(); // compressing method bit.compress(CompressFormat.PNG, 0, gettedData); // our byte array return gettedData.toByteArray(); } The method which put data to the row: byte[] image=null; // if the name isn't put to the editView if(name.getText().toString().trim().length()== 0) { messageDisplayer("At least you need to type name of product if you want add it to the DB "); } else{ String desc = description.getText().toString(); if(description.getText().toString().trim().length()==0) { messageDisplayer("the description is set as none"); desc = "none"; } DB.open(); if(ImageOfProduct!= null){ image = bitmapToByteConvert(ImageOfProduct); messageDisplayer("image isn't null"); } else { BitmapDrawable drawable = (BitmapDrawable) picture.getDrawable(); image = bitmapToByteConvert(drawable.getBitmap()); } if(image.length>0 && image!=null) { messageDisplayer(Integer.toString(image.length)); } DB.insertToProductList(name.getText().toString(), desc, image ); DB.close(); messageDisplayer("well done you add the product"); finish(); You can see that I'm checking here the length of array to be sure that I don't send empty one. And here is the place where Error appears imo, this code is from activity which presents the listview with data taken from db private void LoadOurLayoutListWithInfo() { // firstly wee need to open connection with db db= new sqliteDB(getApplicationContext()); db.open(); // creating our custom adaprer, the specification of it will be typed // in our own class (MyArrayAdapter) which will be created below ArrayAdapter<ProductFromTable> customAdapter = new MyArrayAdapter(); //get the info from whole table tablecursor = db.getAllColumns(); if(tablecursor != null) { startManagingCursor(tablecursor); tablecursor.moveToFirst(); } // now we moving all info from tablecursor to ourlist if(tablecursor != null && tablecursor.moveToFirst()) { do{ // taking info from row in table int id = tablecursor.getInt(sqliteDB.ID_COLUMN); String name= tablecursor.getString(sqliteDB.NAME_COLUMN); String description= tablecursor.getString(sqliteDB.DESCRIPTION_COLUMN); byte[] image= tablecursor.getBlob(3); tablefromDB.add(new ProductFromTable(id,name,description,image)); // moving until we didn't find last row }while(tablecursor.moveToNext()); } listView = (ListView) findViewById(R.id.tagwriter_listoftags); //as description says // setAdapter = The ListAdapter which is responsible for maintaining //the data backing this list and for producing a view to represent //an item in that data set. listView.setAdapter(customAdapter); } I put the info from row tho objects which are stored in list. I read tones of question but I can't find any solution for me. Everything works when I put the sample image ( which is stored in app res folder ). Thx for any advice

    Read the article

  • Integrating Fish eye with Jenkins

    - by ramaperumal
    Jenkins is up and running in my organization.In configure tab under Repository browser we have an option called fish eye.If I select fish eye as an repository browser it is asking the fish eye URL (such as http://fisheye6.cenqua.com/browse/ant/)My requirment is I need to fetch the reports such as (we would like to track the SVN to take chain change report, to give statistics on how many check-in happening in each code base, how many cut has been taken from each branches…etc ).We need to achieve all these things in Jenkins itself. For performing such things we need to setup the seperate fish eye server.If that is the case why we have the fish eye option in jenkins.We can perform all these activities in Fisheye instead of Jenkins. Please suggest, Thx Rama

    Read the article

  • notications pop up in user side

    - by user2931015
    i try to show notification as a pop up. like when admin login and through his account he send notification to user i add this html in admin form like this.. <asp:Button ID="notic" runat="server" Text="Send" onclick="Button1_Click" /> <br /> <input class="add_message" type="text" value="type your message" name="add_message"></input> <input type="button" value="add message" onclick="sNotify.addToQueue($('.add_message').attr('value'))"/> Then when admin click on button then notification send to users account like when any user login then he/she able to see pop ups in user form I call this java script in page load like this .. ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript:sNotify.addToQueue($('.add_message').attr('value'))();", true); it works like when i login as a admin and click on button then notification in his own page .. but i want to show this notifications in user form. so how to solve it?

    Read the article

  • Yii user rights extension

    - by jailed abroad
    i have installed the yii rights extension and here is my code after installation, database tables are created after installation. 'modules'=>array( // uncomment the following to enable the Gii tool 'rights'=>array( 'superuserName'=>'Admin', // Name of the role with super user privileges. 'authenticatedName'=>'Authenticated', //// Name of the authenticated user role. 'userIdColumn'=>'id',// Name of the user id column in the database. 'userNameColumn'=>'username', // Name of the user name column in the database. 'enableBizRule'=>true, // Whether to enable authorization item business rules. 'enableBizRuleData'=>false, //Whether to enable data for business rules. 'displayDescription'=>true, // Whether to use item description instead of name. ' // Key to use for setting success flash messages. 'flashErrorKey'=>'RightsError', / Key to use for setting error flash messages. // 'install'=>true, // Whether to install rights. 'baseUrl'=>'/rights', // Base URL for Rights. Change if module is nested. 'layout'=>'rights.views.layouts.main', // Layout to use for displaying Rights. 'appLayout'=>'application.views.layouts.main', //Application layout. 'cssFile'=>'rights.css', // Style sheet file to use for Rights. ' 'install'=>false, // Whether to enable installer. 'debug'=>false, ), 'gii'=>array( 'class'=>'system.gii.GiiModule', 'password'=>'1234', // If removed, Gii defaults to localhost only. Edit carefully to taste. 'ipFilters'=>array('127.0.0.1','::1'), ), ), But when i type url http://localhost/rightsTest/index.php/rights then it says There must be at least one superuser! I have tried many things but unable to find answer. Thanks for your help.

    Read the article

  • No resource type specified (at 'id' with value '@+id\st')

    - by Refaat
    I'm new at android programming, I'm now trying to make some buttons, I configured these buttons using the following code: The MainActivity class : public class MainActivity extends Activity { /** Called when the activity is first created. */ Button st,nd,center; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); st = (Button)findViewById(R.id.st); st = (Button)findViewById(R.id.center); st = (Button)findViewById(R.id.nd); } } and the XML Layout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/background" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Hello from animation!!" /> <button android:layout_width="100dp" android:layout_height="50dp" android:text="1st half" android:id="@+id\st" /> // and the other two points defined the same way </LinearLayout> And i got that syntax error: error: Error: No resource type specified (at 'id' with value '@+id\st'). // and the same error with the other two buttons HINT: The R class is imported and accessible from the MainActivity class but it can't read R.id.

    Read the article

  • Where is the best place to call the .tolist(); inside my controller classes or inside my model repository classes

    - by john G
    I have the following action method, inside my asp.net mvc web application:- public JsonResult LoadZoneByDataCenter(string id) { var zonelist = repository.getrealtedzone(Convert.ToInt32(id)).ToList(); //code goes here Which calls the following model repository method:- public IQueryable<Zone> getrealtedzone(int? dcid) { return tms.Zones.Where(a=> a.DataCenterID == dcid || dcid == null); } Currently I am calling the .tolist() which will interpret the Database from my action method, but my question is where is the best place to call the .tolist() inside the controller or inside the model classes and why ? thanks

    Read the article

  • Search Form in Responsive Design - Remove Search button on Mobile

    - by Kevin
    I'm working with a search box in the header of a responsive website. On desktop/tablet widths, there's a search input field and a styled 'search' button to the right. You can type in a search term and either click 'SEARCH' button or just hit enter on the keyboard with the same result. When you scale down to mobile widths, the search input field fills the width of the screen. The submit button falls below it. On a desktop, clicking the button or hitting enter activate the search. On an actual iphone phone, you can hit the 'SEARCH' button, but the native mobile keyboard that rises from the bottom of the screen has a search button where the enter/return key would normally be. It seems to know I'm in a form and the keyboard automatically gives me the option to kick off the search by basically hitting the ENTER key location....but it says SEARCH. So far so good. I figure I don't need the button in the header on mobile since it's already in the keyboard. Therefore, I'll hide the button on mobile widths and everything will be tighter and look better. So I added this to my CSS to hide it in mobile: #search-button {display: none;} But now the search doesn't work at all. On mobile, I don't get the option in the keyboard that showed up before and if I just hit enter, it doesn't work at all. On desktop at mobile width, hitting enter also not longer works. So clearly by hiding the submit/search button, the phone no longer gave me the native option to run the search. In addition, on the desktop at mobile width, even hitting enter inside the search input box also fails to launch the the search. Here's my search box: <form id="search-form" method="get" accept-charset="UTF-8, utf-8" action="search.php"> <fieldset> <div id="search-wrapper"> <label id="search-label" for="search">Item:</label> <input id="search" class="placeholder-color" name="item" type="text" placeholder="Item Number or Description" /> <button id="search-button" title="Go" type="submit"><span class="search-icon"></span></button> </div> </fieldset> </form> Here's what my CSS looks like: #search-wrapper { float: left; display: inline-block; position: relative; white-space: nowrap; } #search-button { display: inline-block; cursor: pointer; vertical-align: top; height: 30px; width: 40px; } @media only screen and (max-width: 639px) { #search-wrapper { display: block; margin-bottom: 7px; } #search-button { /* this didn't work....it hid the button but the search failed to load */ display: none;*/ } } So.....how can I hide this submit button when I'm on a mobile screen, but still let the search run from the mobile keyboard or just run by hitting enter when in the search input box. I was sure that putting display:none on the search button at mobile width would do the trick, but apparently not. Thanks...

    Read the article

  • database logic for tracking each and every operation in my web application

    - by ripa
    I am developing an Web application. In my application, I need to keep track of each and every operation for every logged in user. I have planned following for achieving this task:- I will create stored procedure in mysql. I will trigger this procedure on each table's insert , update delete. This is an tough job for me. Will anybody direct me in the right way? I am using PHP based Codeigniter framework and mysql database.

    Read the article

  • How to make notification to group users with read/unread flag?

    - by user2335065
    I am making a notification system so that when users in a group perform an action, it will notify all the other users in the group. I want the notification to be marked "read" or "unread" for each user of the group. With that, I can easily retreive any unread notification for a user and display it. I am think about creating a notification table that have the following fields. +----------------------+ | notification | +----------------------+ | id | | userid | | content | | status (read/unread) | | time | +----------------------+ My question is: Whether it is the correct way of making the system? As it means that when there is 1,000 users in a group, then I have to insert 1,000 rows to the table. If not, what is the better way of doing this? If it is the way to do this, how can I write the php/mysql codes to do the looping of inserting the rows? Thanks!

    Read the article

  • ClassCastException in iterating list returned by Query using Hibernate Query Language

    - by Tushar Paliwal
    I'm beginner in hibernate.I'm trying a simplest example using HQL but it generates exception at line 25 ClassCastException when i try to iterate list.When i try to cast the object returned by next() methode of iterator it generates the same problem.I could not identify the problem.Kindly give me solution of the problem. Employee.java package one; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class Employee { @Id private Long id; private String name; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Employee(Long id, String name) { super(); this.id = id; this.name = name; } public Employee() { } } Main2.java package one; import java.util.Iterator; import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; public class Main2 { public static void main(String[] args) { SessionFactory sf=new Configuration().configure().buildSessionFactory(); Session s1=sf.openSession(); Query q=s1.createQuery("from Employee "); Transaction tx=s1.beginTransaction(); List l=q.list(); Iterator itr=l.iterator(); while(itr.hasNext()) { Object obj[]=(Object[])itr.next();//Line 25 for(Object temp:obj) { System.out.println(temp); } } tx.commit(); s1.close(); sf.close(); } }

    Read the article

  • Add 2 titles styles in Nivo Lightbox Jquery

    - by user2984054
    I need to add 2 different titles to customize each one of them in the Nivo Lightbox Example: http://prntscr.com/23o766 But it's look like is not possible, is there a way to put 2 titles on 1 image? Or anyway to resolve this? also, I would love to be able to use the title as a link, but there are a lot of limitations. thanks. Code: <a class="image image-full" data-lightbox-gallery="gallery1" href="nivo-lightbox/img/b/grey_antique_q_white_mortar_concave_finish_technique_view_b.jpg" title="Grey Antique Q White Mortar Concave Finish Technique View B"> <img id="sample_board_image" src="nivo-lightbox/img/s/grey_antique_q_white_mortar_concave_finish_technique_view_b.jpg" alt="Grey Antique Q White Mortar Concave Finish Technique View B"></img> </a> There's must be a way to add more than 1 style in the title or any other way to add that text in the overlay in the Lightbox. I actually already tried the insertion of another html on the nivo lightbox, but it gives me a lot of trouble, the content is not showing properly, is there a way the content fits on the lightbox? http://prntscr.com/23qm97

    Read the article

  • Symfony2 impersonation route parameters missing

    - by jaPa
    I receive an error when I change pages if I am impersonated as another user in Symfony2. It only happens when the route has additional parameters. There is no sign of route generation at the pointed line number. Controller action /** * @Route("/member/{id}", name="member_page") * @Template() */ public function memberAction($id) Error An exception has been thrown during the rendering of a template ("Some mandatory parameters are missing ("slug") to generate a URL for route "member_page".") in members.html.twig at line 2.

    Read the article

  • Recursive Binary Search Tree Insert

    - by Nick Sinklier
    So this is my first java program, but I've done c++ for a few years. I wrote what I think should work, but in fact it does not. So I had a stipulation of having to write a method for this call: tree.insertNode(value); where value is an int. I wanted to write it recursively, for obvious reasons, so I had to do a work around: public void insertNode(int key) { Node temp = new Node(key); if(root == null) root = temp; else insertNode(temp); } public void insertNode(Node temp) { if(root == null) root = temp; else if(temp.getKey() <= root.getKey()) insertNode(root.getLeft()); else insertNode(root.getRight()); } Thanks for any advice.

    Read the article

  • How to programatically set drawableLeft on Android button?

    - by Frank LoVecchio
    I'm dynamically creating buttons. I styled them using XML first, and I'm trying to take the XML below and make it programattic. <Button android:id="@+id/buttonIdDoesntMatter" android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="buttonName" android:drawableLeft="@drawable/imageWillChange" android:onClick="listener" android:layout_width="fill_parent"> </Button> This is what I have so far. I can do everything but the drawable. linear = (LinearLayout) findViewById(R.id.LinearView); Button button = new Button(this); button.setText("Button"); button.setOnClickListener(listener); button.setLayoutParams( new LayoutParams( android.view.ViewGroup.LayoutParams.FILL_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT ) ); linear.addView(button);

    Read the article

  • How to make Python check if ftp directory exists?

    - by Phil
    I'm using this script to connect to sample ftp server and list available directories: from ftplib import FTP ftp = FTP('ftp.cwi.nl') # connect to host, default port (some example server, i'll use other one) ftp.login() # user anonymous, passwd anonymous@ ftp.retrlines('LIST') # list directory contents ftp.quit() How do I use ftp.retrlines('LIST') output to check if directory (for example public_html) exists, if it exists cd to it and then execute some other code and exit; if not execute code right away and exit?

    Read the article

  • How to install nuget package manually :)

    - by Anirudha
    Originally posted on: http://geekswithblogs.net/anirugu/archive/2013/11/13/how-to-install-nuget-package-manually.aspxWhen you install a nuget package in your project then Visual studio cached it for you for future purpose. If you live offline few time you can add the this cache directory as your nuget source. For see the folder where nuget cached then just go to Tools > options > Package manager > source > Cached packages > browse. You can add this cached folder as source.     For use nuget package without Visual studio you can try this trick.   open this in your explorer C:\Users\{yourusername}\AppData\Local\NuGet\Cache Now rename the file as described here. for example bootstrap.3.0.2.nupkg to bootstrap.3.0.2.rar open the rar and see the content folder. this folder contain the assembly/library that nuget install in your project.

    Read the article

  • Postfix smarthost with diffent relayhosts and sender dependant authentication

    - by mattinsalto
    I've setup postfix as smarthost with different relayhosts and sender dependant authentication. Everything works ok, but I have a performance question. Is it better to send all the email corresponding to a domain through only one account? I mean, now I'm sending each message authenticating to the relay host with the sender credentials. Example: If I have 5 email accounts and I send 10 simultaneous messages from each account, How many times is postfix login to the relay host if I have sender dependant authentication? 5 times? once for each sender 50 times? once for each message If I send all the messages corresponding to one realy host through one account, how many times does postfix login to the relay host? only once? Thanks in advance.

    Read the article

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