Daily Archives

Articles indexed Tuesday May 27 2014

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

  • Does a lead-to screen with AdSense ad conform to Google's rules?

    - by ElHaix
    Re: Google's ad placement policy I have noticed that when clicking on some Forbes links, I am taken to a screen with an ad in the middle - at the top there is a link to skip the ad. Upon clicking on the skip link I am taken to the article I want to view. I want to implement something similar on my sites, where, when clicking on a search result, a the results window first displays one AdSense add on the screen with a similar UI as what I saw on Forbes. Currently, when a user clicks on a result, a new tab/window opens with the result. What I am proposing is that before the result appears, the screen displays a "Continue to result" link at the top in large letters, and in the center of the page, "Advertisement" with the ad below. This is the only popup that is user initiated and there are no other popups on the site. Navigation elements are not modified in any way. Will I get penalized by Google for implementing this?

    Read the article

  • How can I replicate Google Page Speed's lossless image compression as part of my workflow?

    - by Keefer
    I love that Google's Page Speed is able to losslessly compress a lot of my images, but I'd love to make it part of my workflow, prior to uploading a site and making it live. Is there anything I can run locally to give me the same lossless compression? I currently export images from Export For Web from Photoshop, and use a little application called PNGCrusher to reduce file size of PNGs. I'd love to find a faster way though than saving out and replacing the individual images from Page Speed's results.

    Read the article

  • Calculate vector direction

    - by Starkers
    Is the direction angle always measured from the plus x axis? Does a vector in the +,+ quadrant always have a direction between 0 and 90, and in -,+ between 90 and 180 and in -,- between 180 and 270 and in -,+ between 270 and 360 ? Also, how should we calculate the direction using tan? Would that mean nested if statements to find out what quadrant we're in, and then applying the appropriate "work arounds"? E.g. If we were in the -,+ (like in the diagram) would we find the angle from the + axis would be 90 + tan^-1(y/x), the 90 + only used because we're in the -,+ quadrant. Also, that's just a quick solution, may be off, I just want to know if we use nested if statements to get the angle from the + x axis. Finally, should we find the distance in degrees or radians?

    Read the article

  • OpenGL - Calculating camera view matrix

    - by Karle
    Problem I am calculating the model, view and projection matrices independently to be used in my shader as follows: gl_Position = projection * view * model * vec4(in_Position, 1.0); When I try to calculate my camera's view matrix the Z axis is flipped and my camera seems like it is looking backwards. My program is written in C# using the OpenTK library. Translation (Working) I've created a test scene as follows: From my understanding of the OpenGL coordinate system they are positioned correctly. The model matrix is created using: Matrix4 translation = Matrix4.CreateTranslation(modelPosition); Matrix4 model = translation; The view matrix is created using: Matrix4 translation = Matrix4.CreateTranslation(-cameraPosition); Matrix4 view = translation; Rotation (Not-Working) I now want to create the camera's rotation matrix. To do this I use the camera's right, up and forward vectors: // Hard coded example orientation: // Normally calculated from up and forward // Similar to look-at camera. Vector3 r = Vector.UnitX; Vector3 u = Vector3.UnitY; Vector3 f = -Vector3.UnitZ; Matrix4 rot = new Matrix4( r.X, r.Y, r.Z, 0, u.X, u.Y, u.Z, 0, f.X, f.Y, f.Z, 0, 0.0f, 0.0f, 0.0f, 1.0f); This results in the following matrix being created: I know that multiplying by the identity matrix would produce no rotation. This is clearly not the identity matrix and therefore will apply some rotation. I thought that because this is aligned with the OpenGL coordinate system is should produce no rotation. Is this the wrong way to calculate the rotation matrix? I then create my view matrix as: // OpenTK is row-major so the order of operations is reversed: Matrix4 view = translation * rot; Rotation almost works now but the -Z/+Z axis has been flipped, with the green cube now appearing closer to the camera. It seems like the camera is looking backwards, especially if I move it around. My goal is to store the position and orientation of all objects (including the camera) as: Vector3 position; Vector3 up; Vector3 forward; Apologies for writing such a long question and thank you in advance. I've tried following tutorials/guides from many sites but I keep ending up with something wrong. Edit: Projection Matrix Set-up Matrix4 projection = Matrix4.CreatePerspectiveFieldOfView( (float)(0.5 * Math.PI), (float)display.Width / display.Height, 0.1f, 1000.0f);

    Read the article

  • LibGdx efficient data saving/loading?

    - by grimrader22
    Currently, my LibGDX game consists of a 512 x 512 map of Tiles and entities such as players and monsters. I am wondering how to efficiently save and load the data of my levels. At the moment I am using JSON serialization for each class I want to save. I implement the Json.Serializable interface for all of these classes and write only the variables that are necessary. So my map consists of 512 x 512 tiles, that's 260,000 tiles. Each tile on the map consists of a Tile object, which points to some final Tile object like a GRASS_TILE or a STONE_TILE. When I serialize each level tile, the final Tile that it points to is re-serialized over and over again, so if I have 100 Tiles all pointing to GRASS_TILE, the data of GRASS_TILE is written 100 times over. When I go to load/deserialize my objects, 100 GrassTile objects are created, but they are each their own object. They no longer point to the final tile object. I feel like this reading/writing files very slow. If I were to abandon JSON serialization, to my knowledge my next best option would be saving the level data to a sql database. Unless there is a way to speed up serializing/deserializing 260,000 tiles I may have to do this. Is this a good idea? Could I really write that many tiles to the database efficiently? To sum all this up, I am trying to save my levels using JSON serialization, but it is VERY slow. What other options do I have for saving the data of so many tiles. I also must note that the JSON serialization is not slow on a PC, it is only VERY slow on a mobile device. Since file writing/reading is so slow on mobile devices, what can I do?

    Read the article

  • Scaling background without scaling foreground in platformer?

    - by David Xu
    I'm currently developing a platform game and I've run into a problem with scaling resolutions. I want a different resolution of the game to still display the foreground unscaled (characters, tiles, etc) but I want the background to be scaled to fit into the window. To explain this better, my viewport has 4 variables: (x, y, width, height) where x and y are the top left corner and width and height are the dimensions. These can be either 800x600, 1024x768 or 1280x960. When I design my levels, I design everything for the highest resolution (1280x960) and expect the game engine to scale it down if a user is running in a lower resolution. I have tried the following to make it work but nothing I've come up with solves it so far: scale = view->width/1280; drawX = x * scale; drawY = y * scale; (this makes the translation too small for low resolution) and scale = view->width/1280; bgWidth = background->width*scale; bgHeight = background->height*scale; drawX = x + background->width/2 - bgWidth/2; drawY = y + background->height/2 - bgHeight/2; (this makes the translation completely wrong at the edges of the map) The thing is, no matter what resolution the game is run at, the map remains the same size, and the foreground is unscaled. (With a lower resolution you just see less of the foreground in the viewport) I was wondering if anyone had any idea how to solve this problem? Thank you in advance!

    Read the article

  • Creating a curved mesh on inside of sphere based on texture image coordinates

    - by user5025
    In Blender, I have created a sphere with a panoramic texture on the inside. I have also manually created a plane mesh (curved to match the size of the sphere) that sits on the inside wall where I can draw a different texture. This is great, but I really want to reduce the manual labor, and do some of this work in a script -- like having a variable for the panoramic image, and coordinates of the area in the photograph that I want to replace with a new mesh. The hardest part of doing this is going to be creating a curved mesh in code that can sit on the inside wall of a sphere. Can anyone point me in the right direction?

    Read the article

  • How to obtain a camera stream from Unity without rendering it to the player's screen?

    - by aiguy
    I'd like to stream the output of two cameras to a separate process. Right now, it looks like the best way to do that is to grab the rendered camera views from the screen via platform specific screen capture hooks then compress them real time with h.264. Is there a way to grab the input of the cameras within unity and avoid rendering them to the screen? One solution I'm considering involves using Unity's multiplayer capability to run the game on a separate machine and grab it from that screen buffer, unbeknownst to the player.

    Read the article

  • htaccess to redirect from domain with sub-directory url to the same url on sub-domain

    - by Ibrahm Yaser
    i have problem of redirecting from domain with sub-directory like http://mydomain.com/project/01/117q803789s92d01 or http://mydomain.com/project/08/117t803789s92d08 .. etc to always http://ww2.mydomain.com/project/01/117q803789s92d01 the other link will to http://ww2.mydomain.com/project/08/117t803789s92d08 ... etc i tried this RewriteCond %{HTTP_HOST} ^mydomain\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ RewriteRule ^project\/\/?(.*)$ "http\:\/\/ww2\.mydomain\.com\/project\/$1" [R=301,L] but for some reason its always redirect me to wrong with missing "\" like if i try to access http://mydomain.com/project/01/117q803789s92d01 redirect me to http://ww2.mydomain.com/project01/117q803789s92d01 Did I miss something?!

    Read the article

  • Prevent dragging in Joint JS

    - by user3607705
    I am working on JointJS API. However I want to prevent the elements from being movable from their original positions. Can you suggest me some feature of JointJS or any feature of CSS in general, which I could use to make my object immovable. I can't use interactive: false option on the paper or paper.$el.css('pointer-events', 'none'); because I need to have highlighting features when mouse hovers over the element. Please suggest a way that disables movement of elements while allowing other features.

    Read the article

  • scikit learn extratreeclassifier hanging

    - by denson
    I'm running the scikit learn on some rather large training datasets ~1,600,000,000 rows with ~500 features. The platform is Ubuntu server 14.04, the hardware has 100gb of ram and 20 CPU cores. The test datasets are about half as many rows. I set n_jobs = 10, and am forest_size = 3*number_of_features so about 1700 trees. If I reduce the number of features to about 350 it works fine but never completes the training phase with the full feature set of 500+. The process is still executing and using up about 20gb of ram but is using 0% of CPU. I have also successfully completed on datasets with ~400,000 rows but twice as many features which completes after only about 1 hour. I am being careful to delete any arrays/objects that are not in use. Does anyone have any ideas I might try?

    Read the article

  • Change Interval Of CADisplayLink

    - by user3679109
    I have replaced an NSTimer with a CADisplayLink. I have it working properly but it is running too slowly. How could I go about speeding this up? This is the code that I'm using: ViewController.h (In {} with @interface: CADisplayLink *displayLink; ViewController.m (viewDidLoad): displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(onTimer)]; [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; onTimer is the method that it is calling. So my question is how do I speed up how often this is being called? Thanks

    Read the article

  • microsoft sql server management studio Incorrect syntax near '|'

    - by user3679099
    SELECT IPD.Task_grp "Task Group", TASK.STARTW "Starting Area", TASK.ENDW "Destination Area", IPD.Nxt_Work_Grp,IPD.Nxt_Work_Area "Drop Area", IPD.Prty "Priority", IPD.Stat_Code "Status" FROM int_path_defn IPD, (SELECT start_curr_work_grp || start_curr_work_area StartW, start_dest_work_grp ||start_dest_work_area EndW FROM task_hdr WHERE task_id='332800') TASK WHERE IPD.CURR_WORK_GRP || IPD.Curr_Work_Area=TASK.StartW AND IPD.Dest_Work_Grp || IPD.Dest_Work_Area=TASK.ENDW I am getting Msg 102, Level 15, State 1, Line 5 Incorrect syntax near '|'. Please help what could be the wrong. same query executed successfully in oracle sql developer

    Read the article

  • How can i add an image in html email from lotus domino agent?

    - by mike_x_
    i want to add a simple image into an email which i want to send from a lotus agent. I paste below a part of the code: StringBuilder sb = new StringBuilder(); sb.append("<div><img src=\"http://goo.gl/lziMZN\"></div>"); email.setHTMLPart(sb.toString()); email.send("[email protected]"); I also tried to use an image from my image resources in the nsf. Whatever i tried i get an empty image area (browser-no-image icon) in the email i receive. I also have checked "Allow restricted operations" in my agent. I would prefer it if there is a solution to use an image from my resources and not an external link. Any solutions?

    Read the article

  • GET request, iOS

    - by phnmnn
    I need to do this GET request: http://api.testmy.co.il/api/sync?BID=1049&ClientCode=3847&Discount=2.34&Service=0&Items=[{"Name":"Tax","Price":"2.11","Quantity":"1","SerialID":"1","Remarks":"","Toppings":""}]&Payments=[] In browser I get response: { "Success":true, "Atava":[], "Pending":[], "CallWaiter":false } But in iOS it not work. i try: NSString *requestedURL=[NSString stringWithFormat:@"http://api.testmy.co.il/api/sync?BID=%i&ClientCode=%i&Discount=2.34&Service=0&Items=[{\"Name\":\"Tax\",\"Price\":\"2.11\",\"Quantity\":\"1\",\"SerialID\":\"1\",\"Remarks\":\"\",\"Toppings\":\"\"}]&Payments=[]",BID,num]; NSURL *url = [NSURL URLWithString:requestedURL]; NSURLResponse *response; NSData *GETReply = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil]; NSString *theReply = [[NSString alloc] initWithBytes:[GETReply bytes] length:[GETReply length] encoding: NSASCIIStringEncoding]; NSLog(@"Reply: %@", theReply); OR NSString *requestedURL=[NSString stringWithFormat:@"http://api.testmy.co.il/api/sync?BID=%i&ClientCode=%i&Discount=2.34&Service=0&Items=[{'Name':'Tax','Price':'2.11','Quantity':'1','SerialID':'1','Remarks':'','Toppings':''}]&Payments=[]",BID,num]; OR NSMutableDictionary *params = [[NSMutableDictionary alloc] init]; [params setObject:@"Tax" forKey:@"Name"]; [params setObject:@"2.11" forKey:@"Price"]; [params setObject:@"1" forKey:@"Quantity"]; [params setObject:@"1" forKey:@"SerialID"]; [params setObject:@"" forKey:@"Remarks"]; [params setObject:@"" forKey:@"Toppings"]; NSData *jsonData = nil; NSString *jsonString = nil; if([NSJSONSerialization isValidJSONObject:params]) { jsonData = [NSJSONSerialization dataWithJSONObject:params options:0 error:nil]; jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding]; NSLog(@"%@",jsonString); } NSString *get=[NSString stringWithFormat: @"&Items=%@", jsonString]; NSData *getData = [get dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url]; [request setHTTPMethod:@"GET"]; [request setTimeoutInterval:8]; [request setHTTPBody:getData]; [request setValue:@"application/json;charset=UTF-8" forHTTPHeaderField:@"Content-Type"]; nothing doesn't work. How to fix it? Sorry for bad english.

    Read the article

  • How to check if element have any text

    - by user3611403
    How can I check, if element does have any text? I have found some code, but it does not work. I need to do something like this: If element has text, write this, if not, write something else. if (!$('.flexslider .item:first p').text().trim().length) { var text = $(this).text(); $('.text-anim-sphone').html(text); } else { $('.text-anim-sphone').html('welcome'); }

    Read the article

  • Select data from three different tables with null data

    - by user3678972
    I am new in Sql. My question is how to get data from three different tables with null values. I have tried a query as below: SELECT * FROM [USER] JOIN [Location] ON ([Location].UserId = [USER].Id) JOIN [ParentChild] ON ([ParentChild].UserId = [USER].Id) WHERE ParentId=7 which I find from this link. Its working fine but, it not fetches all and each data associated with the ParentId Something like it only fetches data which are available in all tables, but also omits some data which not available in Location tables but it comes under the given ParentId. For example: UserId ParentId 1 7 8 7 For userId 8, there is data available in Location table,so it fetches all data. But there is no data for userId 1 available in Location table, so the query didn't work for this. But I want all and every data. If there is no data for userId then it can return only null columns. Is it possible ?? hope everyone can understand my problem.

    Read the article

  • Unable to capture the id of div clicked

    - by user3674364
    This is my jsfiddle http://jsfiddle.net/6TUtw/4/ How can i register for the event div click , so that i can get the name i have tried with different things , but none of them worked . $('#tabs div').click(function() { var elem = $(this); alert(elem); }); $('#tabs').on('click', 'div.click', function () { var elem = $(this); alert(elem); }); $("#tabs").click(function(){ var elem = $(this); alert(elem); });

    Read the article

  • Vertically Center - with unknown height

    - by panthro
    I have two div's side by side. On the left is an image, on the right are inputs. The image varies depending on what the user uploads. How can I vertically centre align the image and the inputs? I would like the inputs to appear vertically centre to the image. Both the img and inputs have their own container: <div class="img-container"> <div class="data-container"> Fiddle: http://jsfiddle.net/vbLht/

    Read the article

  • AES and CBC in PHP

    - by Kane
    I am trying to encrypt a string in php using AES-128 and CBC, but when I call mcrypt_generic_init() it returns false. $cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '',MCRYPT_MODE_CBC, ''); $iv_size = mcrypt_enc_get_iv_size($cipher); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $res = mcrypt_generic_init($cipher, 'aaaa', $iv); //'aaaa' is a test key Can someone tell me why is returning 0/false? I read the php documentation and seems correct (http://us.php.net/manual/en/mcrypt.examples.php)

    Read the article

  • Pointer reference and dereference

    - by ZhekakehZ
    I have the following code: #include <iostream> char ch[] = "abcd"; int main() { std::cout << (long)(int*)(ch+0) << ' ' << (long)(int*)(ch+1) << ' ' << (long)(int*)(ch+2) << ' ' << (long)(int*)(ch+3) << std::endl; std::cout << *(int*)(ch+0) << ' ' << *(int*)(ch+1) << ' ' << *(int*)(ch+2) << ' ' << *(int*)(ch+3) << std::endl; std::cout << int('abcd') << ' ' << int('bcd') << ' ' << int('cd') << ' ' << int('d') << std::endl; } My question is why the pointer of 'd' is 100 ? I think it should be: int('d') << 24; //plus some trash on stack after ch And the question is why the second and the third line of the stdout are different ? 6295640 6295641 6295642 6295643 1684234849 6579042 25699 100 1633837924 6447972 25444 100 Thanks.

    Read the article

  • Using jquery Autocomplete on textbox control in c#

    - by Abid Ali
    When I run this code I get alert saying Error. My Code: <script type="text/javascript"> debugger; $(document).ready(function () { SearchText(); }); function SearchText() { $(".auto").autocomplete({ source: function (request, response) { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "Default.aspx/GetAutoCompleteData", data: "{'fname':'" + document.getElementById('txtCategory').value + "'}", dataType: "json", success: function (data) { response(data.d); }, error: function (result) { alert("Error"); } }); } }); } </script> [WebMethod] public static List<string> GetAutoCompleteData(string CategoryName) { List<string> result = new List<string>(); using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DbConnection"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand("select fname from tblreg where fname LIKE '%'+@CategoryText+'%'", con)) { con.Open(); cmd.Parameters.AddWithValue("@CategoryText", CategoryName); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { result.Add(dr["fname"].ToString()); } return result; } } } I want to debug my function GetAutoCompleteData but breakpoint is not fired at all. What's wrong in this code? Please guide. I have attached screen shot above.

    Read the article

  • calculate the rendering of a custom control

    - by Marc Jonkers
    In an xpage I would like to be able to decide which custom controls have to be rendered or loaded. I have a custom control named 1, another 2, 3 etc When a scoped variable has the value 1, custom control 1 should be displayed/rendered/loaded. A value of 2 , custom control 2 has to be displayed. etc I came up with following sollution : I calculate if that custom control has to be loaded or not depending on the value of the scoped variable. Since I have 8 of these custom controls on 1 page I was wondering ,since only 1 out of those 8 custom controls have to be rendered ,if there isn't a better way with less code to do the same job. Won't my sollution put a lot of load to my server ?

    Read the article

  • Can run Javascript but not jQuery?

    - by blazonix
    I'm running into a strange problem - I tried running a basic function in JS and jQuery, and while the former worked, the latter didn't. JS - okay alert('Works'); jQuery - not okay $(document).ready({ alert('Works'); }); Here's some facts: My references to the jQuery library are correct (And pretty sure my Internet connection is steady :) I'm using a CDN - CloudFlare to be exact, but I've switched development mode on and Rocket Loader off - so all the code I've uploaded to the server is WYSIWYG (CloudFlare adds some stuff in the tags if you leave Rocket Loader on. I tried running the alert code in the head section, and elsewhere in the body tags, to no avail. What could have possibly gone wrong? EDIT 1: The page is here - http://casestudieslounge.com/chat/BIM/WebContent/chat.php

    Read the article

  • No Hibernate Session bound to thread grails

    - by naresh
    Actually we've lot of quartz jobs in our application. For some time all of the jobs work fine. After some time all jobs are throwing the following exception. org.quartz.JobExecutionException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here [See nested exception: java.lang.IllegalStateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here] at grails.plugins.quartz.QuartzDisplayJob.execute(QuartzDisplayJob.groovy:37) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) Caused by: java.lang.IllegalStateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here at grails.plugins.quartz.QuartzDisplayJob.execute(QuartzDisplayJob.groovy:29) ... 2 more

    Read the article

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