Daily Archives

Articles indexed Monday September 10 2012

Page 11/16 | < Previous Page | 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • How can I fix the #c3284d# malvertising hack on my website?

    - by crm
    For the past couple of weeks at semi regular intervals, this website has had the #c3284d# malware code inserted into some of its .php files. Also the .htaccess file had its equivelant code inserted. I have, on many occasions removed the malicious code, replaced files, changed the ftp password on my ftp client (which is CoreFTP), changed the connection method to FTPS for more secure storage of the password (instead of plain text). I have also scanned my computer several times using AVG and Windows Defender which have found no malware on my computer which might have been storing my ftp passwords. I used Sucuri SiteCheck to check my website which says my website is clean of malware which is bizarre because I just attempted to click one of the links on the site a minute ago and it linked me to another one of these random stats.php sites, even though it appears I have gotten rid of the #c3284d# code again (which will no doubt be re-inserted somehow in an hour or so).. Has anyone found an actual viable solution for this malware hack? I have done just about all of the things suggested here and here and the problem still persists. Currently when I click on a link within the sites navigation menu within Google Chrome I get googles Malware warning page: Warning: Something's Not Right Here! oxsanasiberians.com contains malware. Your computer might catch a virus if you visit this site. Google has found that malicious software may be installed onto your computer if you proceed. If you've visited this site in the past or you trust this site, it's possible that it has just recently been compromised by a hacker. You should not proceed. Why not try again tomorrow or go somewhere else? We have already notified oxsanasiberians.com that we found malware on the site. For more about the problems found on oxsanasiberians.com, visit the Google Safe Browsing diagnostic page. I'm wondering if it is possible that the Google Chrome browser I am using has itself been hacked? Does anyone else get re-directed when clicking links on the the website?

    Read the article

  • How to link subdomains to main domain to get seo benefit

    - by sam
    how can i link subdomains to my main domain to get the seo benefit ? ive seen examples using all sorts of clever redirects and php where you get the subdomains content on the main site.. but what i want is for the subdomain to be linked with the main domain, i dont mind it sitting by itself, but id just like to get the seo benefit of it, im aware that google see subdomains as seperate domains but can change / help them to be seen more as one site ?

    Read the article

  • Starting a career with broad experience or specific experience

    - by TMP
    I am a senior in college going for a CS degree. I have an internship that works with a variety of languages and gives me a pretty good amount of responsibility. The only problem is that it is the only job experience I've had. My question is whether or not it might be a good idea to work another internship, keep the same internship, or in addition to the previous options, to get a masters degree so that i can extend my education and time to gather the usually necessary 2-3 years of industry experience. Obviously there's no outright correct way, but i just want to know if it is more accepted to get experience with different companies or to stick with one to show commitment.

    Read the article

  • Lighting a Voxel World Realistically

    - by sharethis
    I am new to game development and never implemented a complicated (and realistic) lighting. My game uses a 3d voxel terrain world (like Minecraft). To hold the data I use octrees. My goal is to render a more realistic world scene like in most voxel games. For that I want to use a bezier algorithm to round out the blocky world. Assume that I already have a large generated polygon of my terrain (or some of them). I heard of some techniques like volumetric light, global illumination, ... What approaches of a very realistic lighting are there for my "organic shaped" voxel game?

    Read the article

  • Central renderer for a given scene

    - by Loggie
    When creating a central rendering system for all game objects in a given scene I am trying to work out the best way to go about passing the scene to the render system to be rendered. If I have a scene managed by an arbitrary structure, i.e., an octree, bsp trees, quad-tree, kd tree, etc. What is the best way to pass this to the render system? The obvious problem is that if simply given the root node of the structure, the render system would require an intrinsic knowledge of the structure in order to traverse the structure. My solution to this is to clip all objects outside the frustum in the scene manager and then create a list of the objects which are left and pass this simple list to the render system, be it an array, a vector, a linked list, etc. (This would be a structure required by the render system as a means to know which objects should be rendered). The list would of course attempt to minimise OpenGL state changes by grouping objects that require the same rendering operations to be performed on them. I have been thinking a lot about this and started searching various terms on here and followed any additional information/links but I have not really found a definitive answer. The case may be that there is no definitive answer but I would appreciate some advice and tips. My question is, is this a reasonable solution to the problem? Are there any improvements that I could make? Are there any caveats I should know about? Side question: Am I right in assuming that octrees, bsp trees, etc are all forms of BVH?

    Read the article

  • Z axis in isometric tilemap

    - by gyhgowvi
    I'm experimenting with isometric tile maps in JavaScript and HTML5 Canvas. I'm storing tile map data in JavaScript 2D array. // 0 - Grass // 1 - Dirt // ... var mapData = [ [0, 0, 0, 0, 0], [0, 0, 1, 0, 0, ... ] and draw for(var i = 0; i < mapData.length; i++) { for(var j = 0; j < mapData[i].length; j++) { var p = iso2screen(i, j, 0); // X, Y, Z context.drawImage(tileArray[mapData[i][j]], p.x, p.y); } } but this function mean's all tile Z axis is equal to zero. var p = iso2screen(i, j, 0); Maybe anyone have idea and how to do something like mapData[0][0] Z axis equal to 3 mapData[5][5] Z axis equal to 5? I have idea: Write function for grass, dirt and store this function to 2D array and draw and later mapData[0][0].setZ(3); But it is good idea to write functions for each tiles?

    Read the article

  • Game Development In C Only. Is it possible?

    - by Ishan Sharma
    I am a first year college student in India and want to make a small game as a this semester project. I am quite good at C and am learning it rapidly but I wanted to ask if developing a game entirely in C (no C++ or C#) I'd love to use these but for college projects, we have strict requirements of using only C. What I am looking for is a simple top view driving game. It won't have anything fancy and even the visual things will be powered by simple characters. For example, user controlled car can be represented by ¦ and edges of road by series of |'s. What do you think?

    Read the article

  • Weight doesn't work in a custom android component

    - by RCB
    I wanted to create a custom bottom button bar layout, I've created a xml file : <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" style="@android:style/ButtonBar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="0dp" > <Button android:id="@+id/media_menu_button" style="?android:attr/buttonStyleSmall" android:layout_width="0dp" android:layout_height="match_parent" android:layout_margin="0dp" android:layout_weight="1" android:text="@string/media_menu_button" /> <Button android:id="@+id/scenario_menu_button" style="?android:attr/buttonStyleSmall" android:layout_width="0dp" android:layout_height="match_parent" android:layout_margin="0dp" android:layout_weight="1" android:text="@string/scenario_menu_button" /> <Button android:id="@+id/rooms_menu_button" style="?android:attr/buttonStyleSmall" android:layout_width="0dp" android:layout_height="match_parent" android:layout_margin="0dp" android:layout_weight="1" android:text="@string/rooms_menu_button" /> <Button android:id="@+id/shortcut_menu_button" style="?android:attr/buttonStyleSmall" android:layout_width="0dp" android:layout_height="match_parent" android:layout_margin="0dp" android:layout_weight="1" android:text="@string/shortcut_menu_button" /> as you can see I've given all the buttons width 0dp and weight of 1. then, I've created a class that extends the linear layout class : public class BeLightBottomBar extends LinearLayout implements OnClickListener { private LayoutInflater mInflater; private Context contexnt; private Button mShortcutMenuButton; private Button mRoomsMenuButton; private Button mScenarioMenuButton; private Button mMediaMenuButton; public BeLightBottomBar(Context context, AttributeSet attrs) { super(context, attrs); //inflate the view this.contexnt = context; mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout barView = (LinearLayout) mInflater.inflate(R.layout.belight_bottombar, null); addView(barView); //get all the instances of the components of the bar mShortcutMenuButton = (Button) barView.findViewById(R.id.shortcut_menu_button); mRoomsMenuButton = (Button) barView.findViewById(R.id.rooms_menu_button); mScenarioMenuButton = (Button) barView.findViewById(R.id.scenario_menu_button); mMediaMenuButton = (Button) barView.findViewById(R.id.media_menu_button); //set this as a click listener mShortcutMenuButton.setOnClickListener(this); mRoomsMenuButton.setOnClickListener(this); mScenarioMenuButton.setOnClickListener(this); mMediaMenuButton.setOnClickListener(this); ... ... ... } the problem is when i add this class to the main activity xml <belight.homecontrol.components.BeLightBottomBar android:id="@+id/button_bar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_margin="0dp" android:padding="0dp" /> the weight stops working, all the buttons are different. and I don't know why !? if I just copy paste the bottom's bar xml code to the main xml file it works fine, the problem only occurs when using it as a whole. P.S. Is it a good practice to create a component this way? Or maybe I'm doing something wrong? Thanks, Dan

    Read the article

  • Sort List <Rectangle>

    - by user1649498
    How do I sort a rectangle list by their area? Been looking into IComparable at msdn library, but can't figure it out... I wrote this: SortedL= new List<Rectangle>(); int count1 = 0; int count3 = redovi; while (count1 < count3) { int count2 = 0; while (count2 < count3) { int x = Oblici[count1].Width; int y = Oblici[count1].Height; int z = Oblici[count2].Width; int w = Oblici[count2].Height; int area1 = x * y; int area2 = z * w; int a = area1.CompareTo(area2); if (a < 0) { count1 = count2; if (count2 < (count3 - 1)) { count2++; } else break; } else if (a == 0) { if (count2 < (count3 - 1)) { count2++; } else break; } else if (a > 0) { if (count2 < count3 - 1) { count2++; } else break; } } SortedL.Add(Oblici[count1]); Oblici.RemoveAt(count1); count3 = (count3 - 1);}} And it works, but it's pretty ugly, and I know there is an easier way...

    Read the article

  • Generating a random displacement on the unit sphere

    - by becko
    Given a unit vector n, I need to generate, as fast as possible, another random unit vector m. The deviation of m from n should be on the order of a positive parameter sigma, and the distribution of m on the unit sphere should be symmetrical around n. I have no specific requirements on the representation of unit vectors, so you can use spherical angles, Cartesian coordinates, or whatever turns out to be convenient. Also, there are no precise requirements on the probability distributions used, as long as it decays when m deviates more than sigma from n. I am working with gsl and C. I have come up with a somewhat convoluted method using Cartesian coordinates. I will post it later if it is useful, but I would like to see people's ideas.

    Read the article

  • Java, LDAP: Make it not ignore blank passwords?

    - by Steve
    I'm maintaining some legacy Java LDAP code. I know next to nothing about LDAP. The program below basically just sends the userid and password to the LDAP server, receives notification back if the credentials are good. If so, it prints out the LDAP attributes received from the LDAP server, if not it prints out an exception. All works well if a bad password is given. An "invalid credentials" exception gets thrown. However, if a blank password is sent to the LDAP Server, authentication will still happen, LDAP attributes will still be returned. Is this unhappy situation due to the LDAP server allowing blank passwords, or does the code below need to be adjusted such a blank password will get fed to the LDAP server in such a way so it will get rejected? I do have data validation in place. I took it off in a testing environment to solve another issue and noticed this problem. I would prefer not to have this problem underneath the data validation. Thanks much in advance for any information import javax.naming.*; import javax.naming.directory.*; import java.util.*; import java.sql.*; public class LDAPTEST { public static void main(String args[]) { String lcf = "com.sun.jndi.ldap.LdapCtxFactory"; String ldapurl = "ldaps://ldap-cit.smew.acme.com:636/o=acme.com"; String loginid = "George.Jetson"; String password = ""; DirContext ctx = null; Hashtable env = new Hashtable(); Attributes attr = null; Attributes resultsAttrs = null; SearchResult result = null; NamingEnumeration results = null; int iResults = 0; int iAttributes = 0; env.put(Context.INITIAL_CONTEXT_FACTORY, lcf); env.put(Context.PROVIDER_URL, ldapurl); env.put(Context.SECURITY_PROTOCOL, "ssl"); env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_PRINCIPAL, "uid=" + loginid + ",ou=People,o=acme.com"); env.put(Context.SECURITY_CREDENTIALS, password); try { ctx = new InitialDirContext(env); attr = new BasicAttributes(true); attr.put(new BasicAttribute("uid",loginid)); results = ctx.search("ou=People",attr); while (results.hasMore()) { result = (SearchResult)results.next(); resultsAttrs = result.getAttributes(); for (NamingEnumeration enumAttributes = resultsAttrs.getAll(); enumAttributes.hasMore();) { Attribute a = (Attribute)enumAttributes.next(); System.out.println("attribute: " + a.getID() + " : " + a.get().toString()); iAttributes++; }// end for loop iResults++; }// end while loop System.out.println("Records == " + iResults + " Attributes: " + iAttributes); }// end try catch (Exception e) { e.printStackTrace(); } }// end function main() }// end class LDAPTEST

    Read the article

  • How to add a 3rd level to my CSS drop down menu?

    - by Cynthia
    I have a 2-level drop down menu that looks great in all browsers. Now I want to add a 3rd level. How do I do that? Here is my HTML for the menu: <div class="nav"> <div class="navbar"> <ul class="menu"> <li><a href="#">Home</a></li> <li><a href="#">About JoyFactory</a> <ul class="sub-menu"> <li><a href="#">Who We Are</a></li> <li><a href="#">Our Education Concept</a></li> <li><a href="#">References</a></li> </ul> </li> <li><a href="#">JoyFactory Kinderkrippe</a> <ul class="sub-menu"> <li><a href="#">JoyFactory Kinderkrippe Oerlikon</a> <ul> <li><a href="#">item 1</a></li> <li><a href="#">item 2</a></li> <li><a href="#">item 3</a></li> <li><a href="#">item 4</a></li> </ul> </li> <li><a href="#">JoyFactory Kinderkrippe Seebach</a></li> </ul> </li> </ul> </div> </div> and here is my CSS: .nav { clear:both ; width:1020px ; height:55px ; background:url("images/nav-bg.png") no-repeat ; position:absolute ; top:125px ; left:-10px ; } .navbar { width:1000px ; height:50px ; margin:auto ; } ul.menu { margin-left:0 ; padding-left:0 ; list-style-type:none ; } .menu li { display:inline ; float:left ; height:50px ; margin:0 6px ; } .menu li a { font-family:'MyriadPro-SemiboldCond' ; font-size:24px ; color:#ffffff ; text-decoration:none ; height:50px ; line-height:50px ; padding:0px 10px ; } .menu li:hover, .menu li:hover a { background:#ffd322 ; color:#e32a0e ; } .sub-menu { position:absolute ; float:none ; padding:0 ; top:50px ; z-index:9999 ; background:#ffd322 ; margin-left:0 ; padding-left:0 ; } .sub-menu li { display:none ; min-width:175px !important ; margin: 0 !important; padding: 0 !important; } .sub-menu li a, .current-menu-parent .sub-menu li a { display:block ; background:#ffd322 ; font-family:arial,helvetica,sans-serif ; font-size:16px ; padding:0 10px ; border-top:1px solid #f37f10 ; border-left:none ; } .sub-menu li a:hover, .menu li.current-menu-parent .sub-menu li.current-menu-item a { background:#f37f10 } .menu li:hover li { float: none; display:block; clear: both; } Any help would be most appreciated! Many thanks :)

    Read the article

  • Switch activity from a AlertDialog button

    - by Fahim Ahmed
    Let's say , I have three classes : MapsActivity , MyItemizedOverlay & GetDirectionActivity . In MyItemizedOverlay , I want to switch to GetDirectionActivity after the positive dialog button is clicked . ActiveDialog is placed under onTap method , so that I can get the GeoPoint. For this , what I've done : In ItemizedOverlay class : @Override public boolean onTap(GeoPoint p, MapView mapView) { // TODO Auto-generated method stub int lat = p.getLatitudeE6(); int lot = p.getLongitudeE6(); AlertDialog.Builder dialog = new AlertDialog.Builder(mContext); dialog.setTitle("Confirmation"); dialog.setMessage("Confirm this as end point ?"); dialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int arg1) { // TODO Auto-generated method stub Intent intent = new Intent(mContext, GetDestination.class); startActivity(intent); } }); dialog.setNegativeButton("No", null); dialog.show(); return true ; } here IDE shows that I have a error in startActivity(intent) line . I've tried that also : In MyItemizedOverlay class : @Override public boolean onTap(GeoPoint p, MapView mapView) { return super.onTap(p, mapView); } In MapsActivity class : GeoPoint point2 = null ; confirmationOverlay.onTap(point2, mapView) ; int latt = point.getLatitudeE6() ; int longt = point.getLongitudeE6(); final int endpointArray [] = {latt , longt}; if(some condition to show the alert dialog after tapping) { AlertDialog.Builder dialog = new AlertDialog.Builder(MapsActivity.this); dialog.setTitle("Confirmation"); dialog.setMessage("Confirm this location as end point ?"); dialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int arg1) { // TODO Auto-generated method stub Intent intent = new Intent(MapsActivity.this,GetDestination.class); intent.putExtra("geopoint" , endpointArray); startActivity(intent); } }); dialog.setNegativeButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int arg1) { } }); dialog.show(); } For the if statement what sort of condition I can use ? If I set it just like lat0 then the alertdialog appears without tapping on the map. I know this is very silly , but since I am new in both android & java , I hope you guys will consider it. Please help !

    Read the article

  • What is the difference between a "service account" and an "installed application"?

    - by TheBeatlemaniac
    To my understanding, the main difference is that a service account doesn't require a user to log in for authorization, while an installed application does. I am making an Android app (an "installed application"?) that offers an in-app subscription, and doesn't require the user to log in to an account (a "service account"?). To get a Client ID for the Google Play Developer API, I have to declare it as either an installed application or a service account, and am unsure which to go with.

    Read the article

  • Facebook doesn't work on my website

    - by Wilker Augusto
    So, I use to have the facebook like button and box working normaly but now, I have created a new blogue and a new facebook app and the facebook just doens't work in it. Problem : in like box or the normal like button it ask for me to confirm the like but after confirmation, nothing happend. Can anybody please explain me how to make it work on my website ? I tried to follow instruction about open graphs and alots of things that I did not use last time on a website, and nothing worked for me . So, can anybody explain me please step by step what I need to do to make the facebook aplication work on my website ? Please and thanks :) p.s: sorry for my english

    Read the article

  • Reducing Integer Fractions Algorithm - Solution Explanation?

    - by Andrew Tomazos - Fathomling
    This is a followup to this problem: Reducing Integer Fractions Algorithm Following is a solution to the problem from a grandmaster: #include <cstdio> #include <algorithm> #include <functional> using namespace std; const int MAXN = 100100; const int MAXP = 10001000; int p[MAXP]; void init() { for (int i = 2; i < MAXP; ++i) { if (p[i] == 0) { for (int j = i; j < MAXP; j += i) { p[j] = i; } } } } void f(int n, vector<int>& a, vector<int>& x) { a.resize(n); vector<int>(MAXP, 0).swap(x); for (int i = 0; i < n; ++i) { scanf("%d", &a[i]); for (int j = a[i]; j > 1; j /= p[j]) { ++x[p[j]]; } } } void g(const vector<int>& v, vector<int> w) { for (int i: v) { for (int j = i; j > 1; j /= p[j]) { if (w[p[j]] > 0) { --w[p[j]]; i /= p[j]; } } printf("%d ", i); } puts(""); } int main() { int n, m; vector<int> a, b, x, y, z; init(); scanf("%d%d", &n, &m); f(n, a, x); f(m, b, y); printf("%d %d\n", n, m); transform(x.begin(), x.end(), y.begin(), insert_iterator<vector<int> >(z, z.end()), [](int a, int b) { return min(a, b); }); g(a, z); g(b, z); return 0; } It isn't clear to me how it works. Can anyone explain it? The equivilance is as follows: a is the numerator vector of length n b is the denominator vector of length m

    Read the article

  • Client fails to connect with RMI registry when using ProcessBuilder

    - by xavier666
    If i'm creating the RMI registry from command line, the client has no problem in binding objects to the registry. However, if i'm starting the RMI registry using ProcessBuilder, it's giving error. This is my code for creating rmiregistry using ProcessBuilder ProcessBuilder obj = new ProcessBuilder ("rmiregistry","2500"); Process obj_process = obj.start(); The error that i'm getting for using ProcessBuilder when I'm trying to bind to my own RMI registry java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: node_func node_func is an interface Any ideas?

    Read the article

  • How to disable other touch gestures after adding another tap gesture to the view?

    - by Hudson Duan
    I have a view with some tables and buttons on it, and then I want to add a tap gesture to the entire view, but I only want that gesture recognizer to recognize taps. Ideally, I want to do something when the added gesture recognizer is tapped, then remove that gesture recognizer after so the other buttons and tables can be accessed. Basically a tap to dismiss functionality that replicates something like the facebook notifications window, tap outside to dismiss, but not interfere with the buttons outside of the notifications view. Can anybody help? My current code is: NotificationsWindow *customView = [[[NSBundle mainBundle]loadNibNamed:@"NotificationsWindow" owner:self options:nil]objectAtIndex:0]; customView.frame= CGRectMake(12, 12, customView.frame.size.width, customView.frame.size.height); UITapGestureRecognizer *recognizerForSubView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapBehindAgain:)]; [recognizerForSubView setNumberOfTapsRequired:1]; recognizerForSubView.cancelsTouchesInView = NO; //So the user can still interact with controls in the modal view [customView addGestureRecognizer:recognizerForSubView]; [self.view addSubview:customView]; UITapGestureRecognizer *recognizerForSuperView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapBehind:)]; [recognizerForSuperView setNumberOfTapsRequired:1]; recognizerForSuperView.cancelsTouchesInView = NO; //So the user can still interact with controls in the modal view [customView.superview addGestureRecognizer:recognizerForSuperView]; (void)handleTapBehind:(UITapGestureRecognizer *)sender { NSLog(@"tapped"); [[self.view.subviews lastObject] removeFromSuperview]; [self.view removeGestureRecognizer:sender]; } I want to make it so that the recognizer for the super view dismisses the subview, but not to interfere with the other taps on the super view.

    Read the article

  • How do you get Microsoft Access 2007 32bit to show 64bit ODBC Drivers on Windows 7 64bit?

    - by johnny
    I followed the advice here: Windows 7 64 bit odbc drivers for Ms Access Missing but it does not apply. I have Oracle drivers that are 64bit. If I click the ODBC mmc in my admin tools I can see the DSN. In my properties of the ODBC administrator, it appears to be pointing to the 64bit version of the ODBC administrator, which is good: %windir%\system32\odbcad32.exe If I use this version of the ODBC administrator, I can see the Oracle drivers and my DSN via the mmc. When I go to Microsoft Access 2007 (32bit), however, and click external data, ODBC, my 32bit ODBC administrator is opening, which does not have the driver. Can Access 2007 32bit use a 64bit driver to connect to a database (oracle in this case)? The driver works fine in all other applications, just not Access. How can I get Access to use the 64bit ODBC administrator? EDIT: For clarification, the problem is that Access is opening the 32bit version, the syswow64 version. I need it to open the native 64bit version, which it is not opening. The problem is that Microsoft Access keeps opening the 32bit version. I need it to open the 64bit version. The MMC of the ODBC administrator is pointing to the 64bit version, but Microsoft Access keeps opening the 32bit version. I need it to open the 64bit version. Thanks for help.

    Read the article

  • Rhino Mocks - Do we really need stubs?

    - by Marcelo Oliveira
    If it's possible to change mock behaviour in Rhino Mocks using mock.Stub().Return(), why do we need Stubs anyway? What do we lose by always using MockRepository.GenerateMock()? One big benefit of using Mocks instead of Stubs is that we will be able to reuse the same instance among all the tests keeping them cleaner and straightforward. The moq framework works in a similar way... we don't have different objects for mocks and stubs. (please, don't answer with a link to Fowler's "Mocks aren't stubs" article)

    Read the article

  • JavaScript Loop and wait for function

    - by Fluidbyte
    I have a simple single-dimension array, let's say: fruits = ["apples","bananas","oranges","peaches","plums"]; I can loop thru with with $.each() function: $.each(fruits, function(index, fruit) { showFruit(fruit); }); but I'm calling to another function which I need to finish before moving on to the next item. So, if I have a function like this: function showFruit(fruit){ $.getScript('some/script.js',function(){ // Do stuff }) } What's the best way to make sure the previous fruit has been appended before moving on?

    Read the article

  • Insertion sort invariant assertion fails

    - by user1661211
    In the following code at the end of the for loop I use the assert function in order to test that a[i+1] is greater than or equal to a[i] but I get the following error (after the code below). Also in c++ the assert with the following seems to work just fine but in python (the following code) it does not seem to work...anyone know why? import random class Sorting: #Precondition: An array a with values. #Postcondition: Array a[1...n] is sorted. def insertion_sort(self,a): #First loop invariant: Array a[1...i] is sorted. for j in range(1,len(a)): key = a[j] i = j-1 #Second loop invariant: a[i] is the greatest value from a[i...j-1] while i >= 0 and a[i] > key: a[i+1] = a[i] i = i-1 a[i+1] = key assert a[i+1] >= a[i] return a def random_array(self,size): b = [] for i in range(0,size): b.append(random.randint(0,1000)) return b sort = Sorting() print sort.insertion_sort(sort.random_array(10)) The Error: Traceback (most recent call last): File "C:\Users\Albaraa\Desktop\CS253\Programming 1\Insertion_Sort.py", line 27, in <module> print sort.insertion_sort(sort.random_array(10)) File "C:\Users\Albaraa\Desktop\CS253\Programming 1\Insertion_Sort.py", line 16, in insertion_sort assert a[i+1] >= a[i] AssertionError

    Read the article

  • Download multiple files in background in Android

    - by Addev
    Basically I'm trying to make a little app for watching offline content. So there's a moment where the user selects to download the contents (and the app should download about 300 small files and images). I'd like to show the user how does the process go if he enters the proper activity. Showing a list of all the files, telling what has been already downloaded, in progress or waiting for download. My problem is that I really don't know what approach to take for achieve this. Since the download should last until finished I imagine the solution is an Service, but whats best? an IntentService, a Bound Service or an Standard Service calling a startService() for each download? And how can I keep my objects updated for displaying them later? should I use a database or objects in memory? Thanks

    Read the article

  • How can I wait for the image to load in my new window before printing via child.print()?

    - by libertas
    $("#print").on('click', function () { var child = window.open("image.jpg", "_blank", "location=0,toolbar=0,scrollbars=1,fullscreen=1,menubar=0"); //any way to know/wait for image to load? child.print(); }); Any way for my parent window to know that the child window has completed loading the image prior to calling .print()? If they were trigger happy they would end up printing a blank page. I've tried both: child.attachEvent("onload", function () { child.print(); }); and child.attachEvent("DOMContentLoaded", function () { child.print(); }); //(found this online, apparently it's Firefox only, still didn't work)

    Read the article

  • Is it possible in Perl to require a subroutine call is made?

    - by MitchelWB
    I don't know enough about Perl to even know what I'm asking for exactly, but I'm writing a series of subroutines to be available for many individual scripts that all process different incoming flat files. The process is far from perfect, but it's what I've got to deal with and I'm trying to build myself a small library of subs that make it easier for me to manage it all. Each script handles a different incoming flat file with it's own formatting, sorting, grouping and outputting requirements. One common aspect is that we have small text files that house counters that are used to name the output files so that we have no duplicate file names. Because the processing of the data is different for each file, I need to open the file to get my counter value, because this is a common operation, I'd like to put it in a sub to retrieve the counter. But then need to write specific code to process the data. And would like a second sub that allows me to update the counter with the counter once I've processed the data. Is there a way to make the second sub call a requirement if the first one is called? Ideally if it could even be an error that would prevent the script from running at all much like a syntax error. EDIT: Here is a little [ugly and simplified] psuedo-code to give a better feel for what the current process is: require "importLibrary.plx"; #open data source file open DataIn, $filename; #call getCounterInfo from importLibrary.plx to get the counter value from counter file $counter = &getCounterInfo($counterFileName); while (<DataIn>) { #Process data based on unique formatting and requirements #output to task files based on requirements and name files using the $counter #increment $counter } #update counter file with new value of $counter &updateCounterInfo($counter);

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16  | Next Page >