Daily Archives

Articles indexed Tuesday June 3 2014

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

  • Remove third/nth level domains from google Index

    - by drakythe
    Somehow google has indexed some third(and fourth!) level domains that I had attached to my server temporarily, eg. my.domain.root.com. I now have these redirected properly where I would like them to go, however with a carefully crafted search one can still find them and I'd rather they not be exposed. My google foo skills have failed me in finding an answer, so I come to you wonderful folks: Is there a way/How do I remove sub-level domains from google search results? I have the site in google webmaster tools and verified, but all the URL removal requests I can perform append the url to the base url, not prefixed. And finally, how can I prevent this in the future?

    Read the article

  • MachForm, RackForms(FromBoss), Form Tools [on hold]

    - by user39200
    This is my first question here. I am looking for a form builder solution that will allow rapid form development even by beginners, without needing much knowledge of programming. I prefer a solution that we can install on our servers. I have 3 products shortlisted for further review: MachForm, RackForms(formerly FormBoss) and Form Tools If anyone has used any of these products, I would appreciate your input on your experience with using these products and your recommendations. Does anyone know of other products that I must be sure to include in my review? We will eventually move over hundreds of forms to the chosen solution and I would like to make sure as much as I can that it will still be a viable solution in the coming years. Looking forward to everyone's feedback!

    Read the article

  • RewriteRule not working at server level?

    - by Alexis Wilke
    I wanted to forbid some robots from doing certain things to my websites and decided to add a RewriteRule for that purpose. The rule works when put in one of my <VirtualHost *:80> tag and looks like this: RewriteEngine On RewriteCond %{HTTP_USER_AGENT} libwww-perl RewriteCond %{REQUEST_METHOD} POST RewriteRule . - [F,L] However, I wanted to apply that to all my websites instead of just one of them. So with the newest version of Apache2 settings, I decided to put that code in the security.conf file. This file is defined under /etc/apache2/conf-available/... (and yes, I have a softlink from the /etc/apache2/conf-enabled/... directory.) However, if the definition is only in the conf-available/security.conf files, it somehow gets ignored. From the documentation, it says that these Rewrite* commands all work at server level! Any idea of what I would be missing?

    Read the article

  • Reading 'Index Status' graph in Google Webmaster tools

    - by sam
    I recently found a bunch of old files that had been ftp'ed to a live production server by mistake on a static (html / css / js) site. I manually deleted these files, but today when checking in Google Webmaster tools i found this graph below. The 'update' marker is from 3/9/14, what i can work out is what Google is trying to tell me, are they saying that : There was a ranking update like Penguin or Panda and they penalized my site and un-indexed a load of pages which they thought were junk.. OR Is this showing that I updated the site by deleting the files on the server on 3/9/14 OR Is this something else ?

    Read the article

  • Does a longer registration length/period for a domain name improve its SEO and search ranking?

    - by Cupcake
    While I was renewing a domain of mine with a well-known domain registrar, the support person who was on call with me said that I'd improve the SEO ranking of my domain if I increased the registration length from 1 year to 5 years instead. The explanation that he gave me was something along the lines that a search engine like Google doesn't like to send users to domains and businesses that may no longer exist, and that by registering my domain for 5 years instead of just 1, Google would have higher confidence that I'm serious about keeping my business around for the long-term. Needless to say, I was quite skeptical. Does the registration/renewal length of a domain name affect its SEO and search result ranking for search engines such as Google?

    Read the article

  • Apache htaccess results in files being downloaded instead of displayed

    - by chrissik
    So I had this "beautiful" website that did exactly what I wanted it to do. Then I shut down my PC, reboot and...the pages just download now instead of being displayed. I re-installed XAMPP and launched Apache again and I was able to identify the .htaccess file as the cause of the problem. Options +FollowSymlinks RewriteEngine on RewriteCond %{QUERY_STRING} !^desktop RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|iphone|ipod|#opera mobile|palmos|webos" [NC] RewriteRule ^/?$ /mobile/index [L,R=302] RewriteRule ^/?$ /de/index [R] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.*)$ $1.html Here is the problem I guess: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.*)$ $1.html This should make it possible to use /de/index instead of /de/index.html - but somehow it causes the page to download if I open localhost/de/index (but with localhost/de/index.html it works fine...). I'm using HTML Sites with SSI Elements on a Apache web server. The only other file that is different to the out-of-the-box ones is the httpd.conf, where I enabled SSI: AddType text/html .shtml AddHandler server-parsed .shtml AddHandler server-parsed .html AddHandler server-parsed .htm Options Indexes FollowSymLinks Includes AddOutputFilter INCLUDES .shtml Options +Includes So I hope there is somebody among you that can help me with this annoying problem as I'm quite desperate... for some reason, even without the problematic lines Chrome keeps downloading the files (even if I delete the .htaccess file), while IE and Opera display the pages. Edit: Now Opera also wants to download files (whether index.html or index are called).

    Read the article

  • Can not export JARS in lwjgl!

    - by NerdyLegend
    I did it before but for some reason it's doing the stupid problem again. I want to export as a regular Jar file, not a folder full of files. I export it like in Oskar Veerhoak. cmd says Exception in thread "main" java.lang.RuntimeException: Resource not found: res/F lubberFlap.png at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(ResourceLoa der.java:69) at com_FlubberSpace.MainFS.main(MainFS.java:118) I tested it out with my other project with the same code pretty much. This is how I load my Textures wood = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/wood.png")); of course it works fine in eclipse but not after export. I havn't tried giving the previous game its' own project, I have it in a package. Can someone record how to export properly? I want a jar file that you just double click to start it. I also want it so nobody can extract the files and see my classes and res.

    Read the article

  • Error when updating enumerated value?

    - by igrad
    Once upon a time, there was a Player class (simplified version) enum animState{RUNNING,JUMPING,FALLING,IDLING}; class Player { public: Player(int x, int y); void handle(); void show(); ~Player(); private: int m_x; int m_y; animState playerAnimState; } There was also a "handle" function-member, which took care of all movement and collisions for the player: #include "player.h" void Player::handle() { if(/*Player presses 'D' key*/) { m_x++; playerAnimState = RUNNING; } //Other stuff that is just there to look nice Through lots of experimentation with "//" and "/**/", I've found that I consistently get an error at "playerAnimState = RUNNING." Have I broken some enumeration rule? Does my laptop really suck that bad? I hate to post a "fix my code for me" question, but I'm not very seasoned with enums.

    Read the article

  • what is the easiest way to make a hitbox that rotates with it's texture

    - by Matthew Optional Meehan
    In xna when you have a sprite that doesnt rotate it's very easy to get the four corner of a sprite to make a hitbox, but when you do a rotation the points get moved and I assume there is some kind of math that I can use to aquire them. I am using the four points to draw a rectangle that visually represents the hitboxes. I have seen some per-pixel collission examples but I can forsee they would be hard to draw a box/'convex hull' around. I have also seen physics like farseer but I'm not sure if there is a quick tutorial to do what I want. What do you guys think is the best approach becuase I am looking to complete this work by the end of the week.

    Read the article

  • AI agents with FSM: a question regarding this

    - by Prog
    Finite State Machines implemented with the State design pattern are a common way to design AI agents. I am familiar with the State design pattern and know how to implement it. However I have a question regarding how this is used in games to design AI agents. Please consider a class Monster that represents an AI agent. Simplified it looks like this: class Monster{ State state; // other fields omitted public void update(){ // called every game-loop cycle state.execute(this); } public void setState(State state){ this.state = state; } // irrelevant stuff omitted } There are several State subclasses that implement execute() differently. So far classic State pattern. Here's my question: AI agents are subject to environmental effects and other objects communicating with them. For example an AI agent might tell another AI agent to attack (i.e. agent.attack()). Or a fireball might tell an AI agent to fall down. This means that the agent must have methods such as attack() and fallDown(), or commonly some message receiving mechanism to understand such messages. My question is divided to two parts: 1- Please say if this is correct: With an FSM, the current State of the agent should be the one taking care of such method calls - i.e. the agent delegates to the current state upon every event. Correct? Or wrong? 2- If correct, than how is this done? Are all states obligated by their superclass) to implement methods such as attack(), fallDown() etc., so the agent can always delegate to them on almost every event? Or is it done in some other way?

    Read the article

  • How do I convert screen coordinates to between -1 and 1?

    - by bbdude95
    I'm writing a function that allows me to click on my tiles. The origin for my tiles is the center, however, the mouse's origin is the top left. I need a way to transform my mouse coordinates into my tile coordinates. Here is what I already have (but is not working): void mouseClick(int button, int state, int x, int y) { x -= 400; y -= 300; float xx = x / 100; // This gets me close but the number is still high. float yy = y / 100; // It needs to be between -1 and 1 }

    Read the article

  • Extrapolation breaks collision detection

    - by user22241
    Before applying extrapolation to my sprite's movement, my collision worked perfectly. However, after applying extrapolation to my sprite's movement (to smooth things out), the collision no longer works. This is how things worked before extrapolation: However, after I implement my extrapolation, the collision routine breaks. I am assuming this is because it is acting upon the new coordinate that has been produced by the extrapolation routine (which is situated in my render call ). After I apply my extrapolation How to correct this behaviour? I've tried puting an extra collision check just after extrapolation - this does seem to clear up a lot of the problems but I've ruled this out because putting logic into my rendering is out of the question. I've also tried making a copy of the spritesX position, extrapolating that and drawing using that rather than the original, thus leaving the original intact for the logic to pick up on - this seems a better option, but it still produces some weird effects when colliding with walls. I'm pretty sure this also isn't the correct way to deal with this. I've found a couple of similar questions on here but the answers haven't helped me. This is my extrapolation code: public void onDrawFrame(GL10 gl) { //Set/Re-set loop back to 0 to start counting again loops=0; while(System.currentTimeMillis() > nextGameTick && loops < maxFrameskip){ SceneManager.getInstance().getCurrentScene().updateLogic(); nextGameTick+=skipTicks; timeCorrection += (1000d/ticksPerSecond) % 1; nextGameTick+=timeCorrection; timeCorrection %=1; loops++; tics++; } extrapolation = (float)(System.currentTimeMillis() + skipTicks - nextGameTick) / (float)skipTicks; render(extrapolation); } Applying extrapolation render(float extrapolation){ //This example shows extrapolation for X axis only. Y position (spriteScreenY is assumed to be valid) extrapolatedPosX = spriteGridX+(SpriteXVelocity*dt)*extrapolation; spriteScreenPosX = extrapolationPosX * screenWidth; drawSprite(spriteScreenX, spriteScreenY); } Edit As I mentioned above, I have tried making a copy of the sprite's coordinates specifically to draw with.... this has it's own problems. Firstly, regardless of the copying, when the sprite is moving, it's super-smooth, when it stops, it's wobbling slightly left/right - as it's still extrapolating it's position based on the time. Is this normal behavior and can we 'turn it off' when the sprite stops? I've tried having flags for left / right and only extrapolating if either of these is enabled. I've also tried copying the last and current positions to see if there is any difference. However, as far as collision goes, these don't help. If the user is pressing say, the right button and the sprite is moving right, when it hits a wall, if the user continues to hold the right button down, the sprite will keep animating to the right, while being stopped by the wall (therefore not actually moving), however because the right flag is still set and also because the collision routine is constantly moving the sprite out of the wall, it still appear to the code (not the player) that the sprite is still moving, and therefore extrapolation continues. So what the player would see, is the sprite 'static' (yes, it's animating, but it's not actually moving across the screen), and every now and then it shakes violently as the extrapolation attempts to do it's thing....... Hope this help

    Read the article

  • Matrix rotation wrong orientation LibGDX

    - by glz
    I'm having a problem with matrix rotation in libgdx. I rotate it using the method matrix.rotate(Vector3 axis, float angle) but the rotation happens in the model orientation and I need it happens in the world orientation. For example: on create() method: matrix.rotate(new Vector3(0,0,1), 45); That is ok, but after: on render() method: matrix.rotate(new Vector3(0,1,0), 1); I need it rotate in world axis.

    Read the article

  • How do you make a bullet ricochet off a vertical wall?

    - by Bagofsheep
    First things first. I am using C# with XNA. My game is top-down and the player can shoot bullets. I've managed to get the bullets to ricochet correctly off horizontal walls. Yet, despite using similar methods (e.g. http://stackoverflow.com/questions/3203952/mirroring-an-angle) and reading other answered questions about this subject I have not been able to get the bullets to ricochet off a vertical wall correctly. Any method I've tried has failed and sometimes made ricocheting off a horizontal wall buggy. Here is the collision code that calls the ricochet method: //Loop through returned tile rectangles from quad tree to test for wall collision. If a collision occurs perform collision logic. for (int r = 0; r < returnObjects.Count; r++) if (Bullets[i].BoundingRectangle.Intersects(returnObjects[r])) Bullets[i].doCollision(returnObjects[r]); Now here is the code for the doCollision method. public void doCollision(Rectangle surface) { if (Ricochet) doRicochet(surface); else Trash = true; } Finally, here is the code for the doRicochet method. public void doRicochet(Rectangle surface) { if (Position.X > surface.Left && Position.X < surface.Right) { //Mirror the bullet's angle. Rotation = -1 * Rotation; //Moves the bullet in the direction of its rotation by given amount. moveFaceDirection(Sprite.Width * BulletScale.X); } else if (Position.Y > surface.Top && Position.Y < surface.Bottom) { } } Since I am only dealing with vertical and horizontal walls at the moment, the if statements simply determine if the object is colliding from the right or left, or from the top or bottom. If the object's X position is within the boundaries of the tile's X boundaries (left and right sides), it must be colliding from the top, and vice verse. As you can see, the else if statement is empty and is where the correct code needs to go.

    Read the article

  • Increase animation speed according to the swipe speed in unity for Android

    - by rohit
    I have the animation done through Maya and brought the FBX file to unity. Here is my code to calculate the speed of the swipe: Vector2 speedMeasuredInScreenWidthsPerSecond =(Input.touches[0].deltaPosition / Screen.width) * Input.touches[0].deltaTime; Now I wanted to take speedMeasuredInScreenWidthsPerSecond and use it to increase the animation speed accordingly like this: animation["gmeChaAnimMiddle"].speed=Mathf.Round(speedMeasuredInScreenWidthsPerSecond); However, this results in an error that I need to convert Vector2 to float. So how do I overcome it?

    Read the article

  • Box2d world width and height ratio with screen width and height

    - by Sujith
    I have view, for example GameView which extends SurfaceView . I have integrated Box2D physics in GameView. I have two widths , GameView width, height and Box2D physics world width ,height. I need to get the position of box2d world with the GameView co-ordinates. For example, Total width of screen = 240 Total height of screen = 320 Screen points needed to be mapped onto box2d co-ordinates (x,y) = 127, 139 For this i need to get the max width and height of the Box2d physics world. Is there is any way to get the max width and height of Box2d world. or Can i limit the width and height of box2d world within the screen resolution.

    Read the article

  • make error in re-building ns2

    - by user3702405
    I have implemented a new routing protocol named AODV2 in ns-2.35. I am using ns-2.35 in fedora 13. All .cc files have a .o file with them that means recompilation is done. But I am getting an error in response to the 'make' command. Error is shown below: trace/cmu-trace.o: In function hdr_aodv2::access(Packet const*)': cmu-trace.cc:(.text._ZN9hdr_aodv26accessEPK6Packet[hdr_aodv2::access(Packet const*)]+0x7): undefined reference tohdr_aodv2::offset_2' collect2: ld returned 1 exit status make: * [ns] Error 1 I don't know how to remove this error, Can anyone help me please? Thanks, Naeem

    Read the article

  • jQuery Mobile page overrides desktop HTML div layout

    - by batjko
    I'd like to use jQuery mobile on my desktop page. I'm probably thinking of this wrongly, but I tried simply inserting a page element into an existing standard div, like this: <body> <div id="left_sidebar"> [...] </div> <div id="mylist" data-role="page"> <div data-role="listview"> [list items bla bla] </div> </div> <div id="right_sidebar"> [...] </div> <div id="site_footer"> (c) bla blub </div> </body> ...hoping that only the middle part displays the "mobile" page elements. However, that page div seems to override the entire site and turns the whole body into a mobile page (albeit displaying my listview item nicely... across the entire screen). Any idea what to do? Advice is much appreciated.

    Read the article

  • retrieve image from sql server in picturebox

    - by user3116296
    I have saved a picture in sql server and now i can not to retrieve image and set it's in picturebox with linq. why byte[] x become null? private void dataGridViewUser_CellClick(object sender, DataGridViewCellEventArgs e) { DataGridViewRow row = dataGridViewUser.CurrentRow; byte[] x=(byte[])row.Cells["Image"].Value; MemoryStream ms1 = new MemoryStream(x); picuser.Image = Bitmap.FromStream(ms1); }

    Read the article

  • @Secured not working

    - by user3640507
    I am new to spring and trying to implement Role based authorization with the help of @Secured annotation. I have a method which is specifically for ADMIN and I have written @Secured ("ROLE_ADMIN") to secure it. @Secured ("ROLE_ADMIN") public void HelloUser(String name) { System.out.println("Hello ADMIN"); } Now when I call this method by creating a class object it gets called eventhough user dont have ADMIN authority But when I dont create an object and use @autowired annotation instead then it works i.e User is not allowed to access this method. In my security.xml as well as servlet.xml I have added <global-method-security secured-annotations="enabled" /> Can some one please tell me where I am going wrong or is this the natural behaviour in spring ?

    Read the article

  • MVC DropDownListFor not populating the selected value

    - by user2254436
    I'm really having troubles with MVC, in another project I've done the same thing and it worked fine but in this project I just don't understand why the selected item in the dropdown is not populating the class correctly with EF. I have 2 classes: public partial class License { public License() { this.Customers = new HashSet<Customer>(); } public int LicenseID { get; set; } public int Lic_LicenseTypeID { get; set; } public int Lic_LicenseStatusID { get; set; } public string Lic_LicenseComments { get; set; } public virtual EntitiesList LicenseStatus { get; set; } public virtual EntitiesList LicenseType { get; set; } } public partial class EntitiesList { public EntitiesList() { this.LicensesStatus = new HashSet<License>(); this.LicensesType = new HashSet<License>(); } public int ListID { get; set; } public string List_EntityValue { get; set; } public string List_Comments { get; set; } public string List_EntityName { get; set; } public virtual ICollection<License> LicensesStatus { get; set; } public virtual ICollection<License> LicensesType { get; set; } public string List_DisplayName { get { return Regex.Replace(List_EntityName, "([a-z])([A-Z])", "$1 $2"); ; } } public string List_DisplayValue { get { return Regex.Replace(List_EntityValue, "([a-z])([A-Z])", "$1 $2"); } } } The EntitiesList is table in db that have all my "enum" lists. For example: ListID - 0 List_EntityValue - Activate List_EntityName - LicenseStatus ListID - 1 List_EntityValue - Basic List_EntityName - LicenseType This is my model: public class LicenseModel { public License License { get; set; } public SelectList LicenseStatuses { get; set; } public int SelectedStatus { get; set; } public SelectList LicenseTypes { get; set; } public int SelectedType { get; set; } } My controller for create: public ActionResult Create() { LicenseModel model = new LicenseModel(); model.License = new License(); model.LicenseStatuses = new SelectList(managerLists.GetAllLicenseStatuses(), "ListID", "List_DisplayValue"); model.LicenseTypes = new SelectList(managerLists.GetAllLicenseTypes(), "ListID", "List_DisplayValue"); return View(model); } [HttpPost] [ValidateAntiForgeryToken] public ActionResult Create(LicenseModel model) { if (ModelState.IsValid) { model.License.Lic_LicenseTypeID = model.SelectedType; model.License.Lic_LicenseStatusID = model.SelectedStatus; managerLicense.AddNewObject(model.License); return RedirectToAction("Index"); } return View(model); } managerLists and managerLicense are the managers that connect between the entities in db and the MVC UI, nothing special... they contains queries for adding new objects, getting the lists, editing and so on. And the view for creating the License: @using (Html.BeginForm()) { @Html.AntiForgeryToken() @Html.ValidationSummary(true) <fieldset> <legend>License</legend> <div class="form-group"> @Html.LabelFor(model => model.License.Lic_LicenseTypeID) @Html.DropDownListFor(model => model.SelectedType, Model.LicenseTypes, new { @class = "form-control" }) <p class="help-block">@Html.ValidationMessageFor(model => model.License.Lic_LicenseTypeID)</p> </div> <div class="form-group"> @Html.LabelFor(model => model.License.Lic_LicenseStatusID) @Html.DropDownListFor(model => model.SelectedStatus, Model.LicenseStatuses, new { @class = "form-control" }) <p class="help-block">@Html.ValidationMessageFor(model => model.License.Lic_LicenseStatusID)</p> </div> <div class="form-group"> @Html.LabelFor(model => model.License.Lic_LicenseComments) @Html.TextAreaFor(model => model.License.Lic_LicenseComments, new { @class = "form-control", rows = "3" }) <p class="help-block">@Html.ValidationMessageFor(model => model.License.Lic_LicenseComments)</p> </div> <p> <input type="submit" value="Create" /> </p> </fieldset> } Now, when I'm trying to save the new license, when it gets to the db.SaveChanges() in the manager I'm getting: "Validation failed for one or more entities. See 'EntityValidationErrors' property for more details." In breakpoint, the Lic_LicenseTypeID and Lic_LicenseStatusID are getting correctly the ID's from the selected item in the dropdown but the LicenseStatus and LicenseStatus properties are null. What an I missing?

    Read the article

  • Gmail zend imap - latency when fetching messageids

    - by T.B Ygg
    i have this code to fetch emails from gmail using imap with the zend framework. i go back 2 days in my search (as i do not want all messages) all works well but it takes forever to load the messages and i need to do this for 5+ users, it seems like the search goes through the entire gmail message archive in getting the newest ones. my code looks like this: $dato = date('j-F-Y', strtotime($Date. ' - 2 days')); $dato = "SINCE ".$dato; $messageids = $imap->search(array($dato)); any ideas on how to make zend work faster?

    Read the article

  • .NET MVC What is the best way to disable browser caching?

    - by Chameera Dedduwage
    As far as my research goes, there are several steps in order to make sure that browser caching is disabled. These HTTP headers must be set: Cache-Control: no-cache, no-store, must-revalidate, proxy-revalidate Pragma: no-cache, no-store Expires: -1 Last-Modified: -1 I have found out that this can be done in two ways: Way One: use the web.config file <add name="Cache-Control" value="no-store, no-cache, must-revalidate, proxy-revalidate"/> <add name="Pragma" value="no-cache, no-store" /> <add name="Expires" value="-1" /> <add name="Last-Modified" value="-1" /> Way Two: use the meta tags in _Layout.cshtml <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate, proxy-revalidate" /> <meta http-equiv="Pragma" content="no-cache, no-store" /> <meta http-equiv="Expires" content="-1" /> <meta http-equiv="Expires" content="-1" /> My Question: which is the better approach? Or, alternatively, are they equally acceptable? How do these all relate to different platforms? Which browsers would honor what headers? In addition, please feel free to add anything I've missed, if any.

    Read the article

  • $where in mongodb web shell not working

    - by Bravo
    i have the below set of test documents which i inserted in to the mongodb and when i use to query the db using the $where get the below exception Error: database error: $where query, but no script engine Any idea why the $where clause not working test data : db.things.save({ "_id" : 1, "domainName" : "test11.com", "hosting" : "hostgator.com" }) db.things.save({ "_id" : 2, "domainName" : "test2.com", "hosting" : "aws.amazon.com"}) db.things.save({ "_id" : 3, "domainName" : "test3.com", "hosting" : "aws.amazon.com" }) db.things.save({ "_id" : 4, "domainName" : "test4.com", "hosting" : "hostgator.com" }) db.things.save({ "_id" : 5, "domainName" : "test5.com", "hosting" : "aws.amazon.com" }) db.things.save({ "_id" : 6, "domainName" : "test6.com", "hosting" : "cloud.google.com" }) db.things.save({ "_id" : 7, "domainName" : "test7.com", "hosting" : "aws.amazon.com" }) db.things.save({ "_id" : 8, "domainName" : "test8.com", "hosting" : "hostgator.com" }) db.things.save({ "_id" : 9, "domainName" : "test9.com", "hosting" : "cloud.google.com" }) db.things.save({ "_id" : 10, "domainName" : "test10.com", "hosting" : "godaddy.com" }) query used : db.things.find( { $where: "this.domainName == 'test11.com'" } );

    Read the article

  • Sort multidimension array in php by more than two fields

    - by Ankita Agrawal
    I want to sort array by two fields. I mean to say I have an array like :- Array ( [0] => Array ( [name] => abc [url] => http://127.0.0.1/abc/img1.png [count] => 69 [img] => accessoire-sets_1.jpg ) [1] => Array ( [name] => abc2 [url] => http://127.0.0.1/abc/img12.png [count] => 73 [img] => ) [2] => Array ( [name] => abc45 [url] => http://127.0.0.1/abc/img122.png [count] => 15 [img] => tomahawk-kopen_1.png ) [3] => Array ( [name] => zyz [url] => http://127.0.0.1/abc/img22.png [count] => 168 [img] => ) [4] => Array ( [name] => lmn [url] => http://127.0.0.1/abc/img1222.png [count] => 10 [img] => ) [5] => Array ( [name] => qqq [url] => http://127.0.0.1/abc/img1222.png [count] => 70 [img] => ) [6] => Array ( [name] => dsa [url] => http://127.0.0.1/abc/img1112.png [count] => 43 [img] => ) [7] => Array ( [name] => wer [url] => http://127.0.0.1/abc/img172.png [count] => 228 [img] => ) [8] => Array ( [name] => hhh [url] => http://127.0.0.1/abc/img126.png [count] => 36 [img] => ) [9] => Array ( [name] => rrrt [url] => http://127.0.0.1/abc/img12.png [count] => 51 [img] => ) [10] => Array ( [name] => yyy [url] => http://127.0.0.1/abc/img12.png [count] => 22 [img] => ) [11] => Array ( [name] => cxz [url] => http://127.0.0.1/abc/img12.png [count] => 41 [img] => ) [12] => Array ( [name] => tre [url] => http://127.0.0.1/abc/img12.png [count] => 32 [img] => ) [13] => Array ( [name] => fds [url] => http://127.0.0.1/abc/img12.png [count] => 10 [img] => ) ) array WITHOUT images (field "img" )should always be placed underneath array WITH images. After this there will be sorted on the amount of products (field count) in the array. Means I have to show sort array first on the basis of img then count. I am using usort( $childLinkCats, 'sortempty' );` function sortempty( $a, $b ) { return empty( $a['img'] ); } it will show array with image value above the one who contains null value. and to sort through count Im using usort($childLinkCats, "_sortByCount"); function _sortByCount($a, $b) { return strnatcmp($a['count'], $b['count']); } It will short by count But I am facing problem that only 1 working is working at a time, but I have to use both, please help me.

    Read the article

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