Daily Archives

Articles indexed Tuesday June 12 2012

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

  • Is there an elegant way to track multiple domains under separate accounts with google analytics?

    - by J_M_J
    I have a situation where a content management system uses the same template for multiple websites with different domain names and I can't make a separate template for each. However, each website needs to be tracked with Google analytics. Would this be appropriate to track each domain like this by putting in some conditional code? And would this be robust enough not to break? Is there a more elegant way to do this? <script type="text/javascript"> var _gaq = _gaq || []; switch (location.hostname){ case 'www.aaa.com': _gaq.push(['_setAccount', 'UA-xxxxxxx-1']); break; case 'www.bbb.com': _gaq.push(['_setAccount', 'UA-xxxxxxx-2']); break; case 'www.ccc.com': _gaq.push(['_setAccount', 'UA-xxxxxxx-3']); break; } _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); })(); </script> Just to be clear, each website is a separate domain name and must be tracked separately, NOT different domains with same pages on one analytics profile.

    Read the article

  • How to make players be creative in a game, if the game cannot evaluate it?

    - by Mensonge
    I am working on a prototype game with several funny/visual effects that the player can trigger. The player can be quite creative in the way to use or combine these effects but it seems impossible to make detect/evaluate this creativity by the computer. So, from a game design perspective, I wonder what could be the features to drive the players to be creative (experiment various combinations). For the moment i think about "Draw something" where the result is evaluated by other players. I think about levels designed by "Little Big Planet" players but this aspect is out of the core game. I think also about "Minecraft" but I do not understand really how this game encourages the people to be creative (except of the open world). Please tell me if you have any ideas, articles or references that could help me coping with this problem.

    Read the article

  • How do I approach large companies if I have a killer mobile game idea?

    - by Balázs Dávid
    I have an idea for a game that has potential, but I'm not a programmer. How do I tell this to development companies without having my idea stolen? All I want from the company is for somebody to watch a three minute long video presentation about my idea and if they see potential in it then we can talk about the details. I have already sent an e-mail to several big companies that have the expertise needed to code the game, they haven't answered me. Actually the idea is nothing fancy, no 3D, but fun and unique.

    Read the article

  • Trying to use stencils in 2D while retaining layer depth

    - by Steve
    This is a screen of what's going on just so you can get a frame of reference. http://i935.photobucket.com/albums/ad199/fobwashed/tilefloors.png The problem I'm running into is that my game is slowing down due to the amount of texture swapping I'm doing during my draw call. Since walls, characters, floors, and all objects are on their respective sprite sheet containing those types, per tile draw, the loaded texture is swapping no less than 3 to 5+ times as it cycles and draws the sprites in order to layer properly. Now, I've tried throwing all common objects together into their respective lists, and then using layerDepth drawing them that way which makes things a lot better, but the new problem I'm running into has to do with the way my doors/windows are drawn on walls. Namely, I was using stencils to clear out a block on the walls that are drawn in the shape of the door/window so that when the wall would draw, it would have a door/window sized hole in it. This is the way my draw was set up for walls when I was going tile by tile rather than grouped up common objects. first it would check to see if a door/window was on this wall. If not, it'd skip all the steps and just draw normally. Otherwise end the current spriteBatch Clear the buffers with a transparent color to preserve what was already drawn start a new spritebatch with stencil settings draw the door area end the spriteBatch start a new spritebatch that takes into account the previously set stencil draw the wall which will now be drawn with a hole in it end that spritebatch start a new spritebatch with the normal settings to continue drawing tiles In the tile by tile draw, clearing the depth/stencil buffers didn't matter since I wasn't using any layerDepth to organize what draws on top of what. Now that I'm drawing from lists of common objects rather than tile by tile, it has sped up my draw call considerably but I can't seem to figure out a way to keep the stencil system to mask out the area a door or window will be drawn into a wall. The root of the problem is that when I end a spriteBatch to change the DepthStencilState, it flattens the current RenderTarget and there is no longer any depth sorting for anything drawn further down the line. This means walls always get drawn on top of everything regardless of depth or positioning in the game world and even on top of each other as the stencil has to happen once for every wall that has a door or window. Does anyone know of a way to get around this? To boil it down, I need a way to draw having things sorted by layer depth while also being able to stencil/mask out portions of specific sprites.

    Read the article

  • Performance of SHA-1 Checksum from Android 2.2 to 2.3 and Higher

    - by sbrichards
    In testing the performance of: package com.srichards.sha; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; import java.io.IOException; import java.io.InputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import com.srichards.sha.R; public class SHAHashActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView tv = new TextView(this); String shaVal = this.getString(R.string.sha); long systimeBefore = System.currentTimeMillis(); String result = shaCheck(shaVal); long systimeResult = System.currentTimeMillis() - systimeBefore; tv.setText("\nRunTime: " + systimeResult + "\nHas been modified? | Hash Value: " + result); setContentView(tv); } public String shaCheck(String shaVal){ try{ String resultant = "null"; MessageDigest digest = MessageDigest.getInstance("SHA1"); ZipFile zf = null; try { zf = new ZipFile("/data/app/com.blah.android-1.apk"); // /data/app/com.blah.android-2.apk } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } ZipEntry ze = zf.getEntry("classes.dex"); InputStream file = zf.getInputStream(ze); byte[] dataBytes = new byte[32768]; //65536 32768 int nread = 0; while ((nread = file.read(dataBytes)) != -1) { digest.update(dataBytes, 0, nread); } byte [] rbytes = digest.digest(); StringBuffer sb = new StringBuffer(""); for (int i = 0; i< rbytes.length; i++) { sb.append(Integer.toString((rbytes[i] & 0xff) + 0x100, 16).substring(1)); } if (shaVal.equals(sb.toString())) { resultant = ("\nFalse : " + "\nFound:\n" + sb.toString() + "|" + "\nHave:\n" + shaVal); } else { resultant = ("\nTrue : " + "\nFound:\n" + sb.toString() + "|" + "\nHave:\n" + shaVal); } return resultant; } catch (IOException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return null; } } On a 2.2 Device I get average runtime of ~350ms, while on newer devices I get runtimes of 26-50ms which is substantially lower. I'm keeping in mind these devices are newer and have better hardware but am also wondering if the platform and the implementation affect performance much and if there is anything that could reduce runtimes on 2.2 devices. Note, the classes.dex of the .apk being accessed is roughly 4MB. Thanks!

    Read the article

  • how to fix Facebook JSDK that sometimes loads twice, once, or doesnt load at all?

    - by user1108310
    Im using facebook javaSDK for my website and I have a weird problem. When I load the website with "internet explorer" it always runs fine. When I load the website with firefox it always loads TWICE, and when I use chrome the JSDK sometimes loads once and sometimes not loads at all , giving me the error "Uncaught ReferenceError: FB is not defined ". I tried using asynchronous loading for the SDK but still the same problem. btw I have firebug on firefox, could that be the reason the JSDK loads twice? Thanks

    Read the article

  • getView only shows Flagged Backgrounds for drawn Views, It does not show Flagged Background when scroll to view more items on list

    - by Leoa
    I am trying to create a listview that receives a flagged list of items to indicate a status to the user. I have been able to create the flag display by using a yellow background (see image at bottom). In Theory, the flagged list can have many flagged items in it. However in my app, only the first three flagged backgrounds are shown. I believe this is because they are initially drawn to the screen. The Flagged background that are not drawn initially to the screen do not show. I'd like to know how to get the remaining flags to show in the list. ListView Recycling: The backgrounds in the listView are being recycled in getView(). This recycling goes from position 0 to position 9. I have flags that need to match at positions 13, 14 and so on. Those positions are not being displayed. listView.getCheckedItemPositions() for multiple selections: This method will not work in my case because the user will not selected the flags. The flags are coming from the server. setNotifyOnChange() and/or public virtual void SetNotifyOnChange (bool notifyOnChange): I'm not adding new data to the list, so I don't see how this method would work for my program. Does this method communicate to getview when it is recycling data? I was unable to find an answer to this in my research. public void registerDataSetObserver: This may be overkill for my problem, but is it possible to have an observer object that keeps track of the all the positions in my items list and in my flag list no matter if the view is recycled and match them on the screen? Code: package com.convention.notification.app; import java.util.Iterator; import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.content.Context; import android.graphics.Color; import android.os.Bundle; import android.text.Html; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.TextView; public class NewsRowAdapter extends ArrayAdapter<Item> { private Activity activity; private List<Item> items; private Item objBean; private int row; private List<Integer> disable; View view ; int disableView; public NewsRowAdapter(Activity act, int resource, List<Item> arrayList, List<Integer> disableList) { super(act, resource, arrayList); this.activity = act; this.row = resource; this.items = arrayList; this.disable=disableList; System.out.println("results of delete list a:"+disable.toString()); } public int getCount() { return items.size(); } public Item getItem(int position) { return items.get(position); } public long getItemId(int position) { return position; } @Override public int getItemViewType(int position) { for(int k =0;k < disable.size();k++){ if(position==disable.get(k)){ //System.out.println( "is "+position+" value of disable "+disable.get(k)); disableView=disable.get(k); //AdapterView.getItemAtPosition(position); } } return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { View view = convertView; ViewHolder holder; if (view == null) { LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(row, null); getItemViewType(position); long id=getItemId(position); if(position==disableView){ view.setBackgroundColor(Color.YELLOW); System.out.println(" background set to yellow at position "+position +" disableView is at "+disableView); }else{ view.setBackgroundColor(Color.WHITE); System.out.println(" background set to white at position "+position +" disableView is at "+disableView); } //ViewHolder is a custom class that gets TextViews by name: tvName, tvCity, tvBDate, tvGender, tvAge; holder = new ViewHolder(); /* setTag Sets the tag associated with this view. A tag can be used to * mark a view in its hierarchy and does not have to be unique * within the hierarchy. Tags can also be used to store data within * a view without resorting to another data structure. */ view.setTag(holder); } else { //the Object stored in this view as a tag holder = (ViewHolder) view.getTag(); } if ((items == null) || ((position + 1) > items.size())) return view; objBean = items.get(position); holder.tv_event_name = (TextView) view.findViewById(R.id.tv_event_name); holder.tv_event_date = (TextView) view.findViewById(R.id.tv_event_date); holder.tv_event_start = (TextView) view.findViewById(R.id.tv_event_start); holder.tv_event_end = (TextView) view.findViewById(R.id.tv_event_end); holder.tv_event_location = (TextView) view.findViewById(R.id.tv_event_location); if (holder.tv_event_name != null && null != objBean.getName() && objBean.getName().trim().length() > 0) { holder.tv_event_name.setText(Html.fromHtml(objBean.getName())); } if (holder.tv_event_date != null && null != objBean.getDate() && objBean.getDate().trim().length() > 0) { holder.tv_event_date.setText(Html.fromHtml(objBean.getDate())); } if (holder.tv_event_start != null && null != objBean.getStartTime() && objBean.getStartTime().trim().length() > 0) { holder.tv_event_start.setText(Html.fromHtml(objBean.getStartTime())); } if (holder.tv_event_end != null && null != objBean.getEndTime() && objBean.getEndTime().trim().length() > 0) { holder.tv_event_end.setText(Html.fromHtml(objBean.getEndTime())); } if (holder.tv_event_location != null && null != objBean.getLocation () && objBean.getLocation ().trim().length() > 0) { holder.tv_event_location.setText(Html.fromHtml(objBean.getLocation ())); } return view; } public class ViewHolder { public TextView tv_event_name, tv_event_date, tv_event_start, tv_event_end, tv_event_location /*tv_event_delete_flag*/; } } Logcat: 06-12 20:54:12.058: I/System.out(493): item disalbed is at postion :0 06-12 20:54:12.058: I/System.out(493): item disalbed is at postion :4 06-12 20:54:12.069: I/System.out(493): item disalbed is at postion :5 06-12 20:54:12.069: I/System.out(493): item disalbed is at postion :13 06-12 20:54:12.069: I/System.out(493): item disalbed is at postion :14 06-12 20:54:12.069: I/System.out(493): item disalbed is at postion :17 06-12 20:54:12.069: I/System.out(493): results of delete list :[0, 4, 5, 13, 14, 17] 06-12 20:54:12.069: I/System.out(493): results of delete list a:[0, 4, 5, 13, 14, 17] 06-12 20:54:12.069: I/System.out(493): set adapaer to list view called; 06-12 20:54:12.128: I/System.out(493): background set to yellow at position 0 disableView is at 0 06-12 20:54:12.628: I/System.out(493): background set to white at position 1 disableView is at 0 06-12 20:54:12.678: I/System.out(493): background set to white at position 2 disableView is at 0 06-12 20:54:12.708: I/System.out(493): background set to white at position 3 disableView is at 0 06-12 20:54:12.738: I/System.out(493): background set to yellow at position 4 disableView is at 4 06-12 20:54:12.778: I/System.out(493): background set to yellow at position 5 disableView is at 5 06-12 20:54:12.808: I/System.out(493): background set to white at position 6 disableView is at 5 06-12 20:54:12.838: I/System.out(493): background set to white at position 7 disableView is at 5 This is a link to my first question a day ago: Change Background on a specific row based on a condition in Custom Adapter I appreciate your help!

    Read the article

  • Automation : Selenium iphone(Mobile) Driver To Capture Network using Xcode iPhone Simulator

    - by Sandeep
    I am using Xcode iPhone(Mobile) simulator to run Selenium iPhone WebDriver Automation scripts for mobile Websites. Is there anyway to capture Network-Traffic on iPhone simulator similar to Selenium RC Network capture or BrowserMob Proxy for Web Driver. Please let me know if you know way to capture Network traffic on iPhone simulator programmatically. I do see some tools like Wireshark or HTTPScoop to capture network traffic but I need in a pro grammatical way to automate. I need this scenario for pixel tracking. Thanks Sandeep

    Read the article

  • Chord Chart - Skip to key with a click

    - by Juan Gonzales
    I have a chord chart app that basically can transpose a chord chart up and down throughout the keys, but now I would like to expand that app and allow someone to pick a key and automatically go to that key upon a click event using a function in javascript or jquery. Can someone help me figure this out? The logic seems simple enough, but I'm just not sure how to implement it. Here are my current functions that allow the user to transpose up and down... var match; var chords = ['C','C#','D','D#','E','F','F#','G','G#','A','A#','B','C','Db','D','Eb','E','F','Gb','G','Ab','A','Bb','B','C']; var chords2 = ['C','Db','D','Eb','E','F','Gb','G','Ab','A','Bb','B','C','C#','D','D#','E','F','F#','G','G#','A','A#','C']; var chordRegex = /(?:C#|D#|F#|G#|A#|Db|Eb|Gb|Ab|Bb|C|D|E|F|G|A|B)/g; function transposeUp(x) { $('.chord'+x).each(function(){ ///// initializes variables ///// var currentChord = $(this).text(); // gatheres each object var output = ""; var parts = currentChord.split(chordRegex); var index = 0; ///////////////////////////////// while (match = chordRegex.exec(currentChord)){ var chordIndex = chords2.indexOf(match[0]); output += parts[index++] + chords[chordIndex+1]; } output += parts[index]; $(this).text(output); }); } function transposeDown(x){ $('.chord'+x).each(function(){ var currentChord = $(this).text(); // gatheres each object var output = ""; var parts = currentChord.split(chordRegex); var index = 0; while (match = chordRegex.exec(currentChord)){ var chordIndex = chords2.indexOf(match[0],1); //var chordIndex = $.inArray(match[0], chords, -1); output += parts[index++] + chords2[chordIndex-1]; } output += parts[index]; $(this).text(output); }); } Any help is appreciated. Answer will be accepted! Thank You

    Read the article

  • Cannot position Google +1 button with CSS?

    - by Bogdan Protsenko
    I'm having some trouble positioning the Google +1 button on my website. The div is as follows: <div class="g-plusone"></div> The CSS I'm using is pretty simple: .g-plusone { position: absolute; top:95px; left:715px; } I know for a fact that the div in question is being accessed. What's strange is that other social sharing buttons, such as the FB like below follow the same syntax and are positioned perfectly. .fb-like { position: absolute; top:62px; left:715px; } Any ideas?

    Read the article

  • Record audio via MediaRecorder

    - by Isuru Madusanka
    I am trying to record audio by MediaRecorder, and I get an error, I tried to change everything and nothing works. Last two hours I try to find the error, I used Log class too and I found out that error occurred when it call recorder.start() method. What could be the problem? public class AudioRecorderActivity extends Activity { MediaRecorder recorder; File audioFile = null; private static final String TAG = "AudioRecorderActivity"; private View startButton; private View stopButton; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); startButton = findViewById(R.id.start); stopButton = findViewById(R.id.stop); setContentView(R.layout.main); } public void startRecording(View view) throws IOException{ startButton.setEnabled(false); stopButton.setEnabled(true); File sampleDir = Environment.getExternalStorageDirectory(); try{ audioFile = File.createTempFile("sound", ".3gp", sampleDir); }catch(IOException e){ Toast.makeText(getApplicationContext(), "SD Card Access Error", Toast.LENGTH_LONG).show(); Log.e(TAG, "Sdcard access error"); return; } recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recorder.setAudioEncodingBitRate(16); recorder.setAudioSamplingRate(44100); recorder.setOutputFile(audioFile.getAbsolutePath()); recorder.prepare(); recorder.start(); } public void stopRecording(View view){ startButton.setEnabled(true); stopButton.setEnabled(false); recorder.stop(); recorder.release(); addRecordingToMediaLibrary(); } protected void addRecordingToMediaLibrary(){ ContentValues values = new ContentValues(4); long current = System.currentTimeMillis(); values.put(MediaStore.Audio.Media.TITLE, "audio" + audioFile.getName()); values.put(MediaStore.Audio.Media.DATE_ADDED, (int)(current/1000)); values.put(MediaStore.Audio.Media.MIME_TYPE, "audio/3gpp"); values.put(MediaStore.Audio.Media.DATA, audioFile.getAbsolutePath()); ContentResolver contentResolver = getContentResolver(); Uri base = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; Uri newUri = contentResolver.insert(base, values); sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, newUri)); Toast.makeText(this, "Added File" + newUri, Toast.LENGTH_LONG).show(); } } And here is the xml layout. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <Button android:id="@+id/start" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="146dp" android:onClick="startRecording" android:text="Start Recording" /> <Button android:id="@+id/stop" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/start" android:layout_below="@+id/start" android:layout_marginTop="41dp" android:enabled="false" android:onClick="stopRecording" android:text="Stop Recording" /> </RelativeLayout> And I added permission to AndroidManifest file. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="in.isuru.audiorecorder" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".AudioRecorderActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.RECORD_AUDIO" /> </manifest> I need to record high quality audio. Thanks!

    Read the article

  • Hashtable resizing leaks memory

    - by thpetrus
    I wrote a hashtable and it basically consists of these two structures: typedef struct dictEntry { void *key; void *value; struct dictEntry *next; } dictEntry; typedef struct dict { dictEntry **table; unsigned long size; unsigned long items; } dict; dict.table is a multidimensional array, which contains all the stored key/value pair, which again are a linked list. If half of the hashtable is full, I expand it by doubling the size and rehashing it: dict *_dictRehash(dict *d) { int i; dict *_d; dictEntry *dit; _d = dictCreate(d->size * 2); for (i = 0; i < d->size; i++) { for (dit = d->table[i]; dit != NULL; dit = dit->next) { _dictAddRaw(_d, dit); } } /* FIXME memory leak because the old dict can never be freed */ free(d); // seg fault return _d; } The function above uses the pointers from the old hash table and stores it in the newly created one. When freeing the old dict d a Segmentation Fault occurs. How am I able to free the old hashtable struct without having to allocate the memory for the key/value pairs again?

    Read the article

  • accessing object variables in javascript

    - by user1452370
    So, I just started javascript and everything was working fine till i came to objects. This peace of code is supposed to create a bouncing ball in a html canvas with javascript but it doesn't work. var canvas = document.getElementById("myCanvas"); var ctx = canvas.getContext("2d"); //clear function clear() { ctx.clearRect(0, 0, canvas.width, canvas.height); } here is my ball object //ball var ball = { x: canvas.width / 2, getX: function() { return x; }, setX: function(a) { x = a; }, y: canvas.height / 2, getY: function() { return y; }, setY: function(a) { y = a; }, mx: 2, getMx: function() { return mx; }, my: 4, getMy: function() { return my; }, r: 10, getR: function() { return r; } }; code to draw my ball function drawBall() { ctx.beginPath(); ctx.arc(ball.getX, ball.getY, ball.getR, 0, Math.PI * 2, true); ctx.fillStyle = "#83F52C"; ctx.fill(); } function circle(x, y, r) { ctx.beginPath(); ctx.arc(x, y, r, 0, Math.PI * 2, true); ctx.fillStyle = "#83F52C"; ctx.fill(); } //draws ball and updates x,y cords function draw() { clear(); drawBall(); if (ball.getX() + ball.getMx() >= canvas.width || ball.getX()+ ball.getMx() <= 0) { ball.setMx(-ball.getMx()); } if (ball.getY() + ball.getMy() >= canvas.height|| ball.getY()+ ball.getMy() <= 0) { ball.setMy(-ball.getMy()); } ball.setX(ball.getX() + ball.getMx()); ball.setY(ball.getY() + ball.getMy()); } set interval function init() { return setInterval(draw, 10); } init();

    Read the article

  • From me friends, know who is already using the app

    - by Toni Michel Caubet
    I got working to get all friends from 'me' user, like this: FB.api('/me/friends?fields=id,name,updated_time&date_format=U&<?=$access_token?>', {limit:3, function(response){ console.log('Friend name: '+response.data[0].name); } ); But i need to get if the user is in the app already or not, how can I alter the query to get an extra row in the object 'is_in_app' true/false? FB.api('/me/friends?fields=id,name,updated_time&date_format=U&<?=$access_token?>', {limit:3, function(response){ var text = 'is not in app'; if(response.data[0].is_in_app == true) text = 'is in app!!'; console.log('Friend name: '+response.data[0].name + ' ' + text); } ); How can i achieve this?

    Read the article

  • no more hitcollision at 1 life

    - by user1449547
    So I finally got my implementation of lives fixed, and it works. Now however when I collide with a ghost when I am at 1 life, nothing happens. I can fall to my death enough times for a game over. from what i can tell the problem is that hit collision is not longer working, because it does not detect a hit, I do not fall. the question is why? update if i kill myself fast enough it works, but if i play for like 30 seconds, it stops the hit collision detection on my ghosts. platforms and springs still work. public class World { public interface WorldListener { public void jump(); public void highJump(); public void hit(); public void coin(); public void dying(); } public static final float WORLD_WIDTH = 10; public static final float WORLD_HEIGHT = 15 * 20; public static final int WORLD_STATE_RUNNING = 0; public static final int WORLD_STATE_NEXT_LEVEL = 1; public static final int WORLD_STATE_GAME_OVER = 2; public static final Vector2 gravity = new Vector2(0, -12); public Hero hero; public final List<Platform> platforms; public final List<Spring> springs; public final List<Ghost> ghosts; public final List<Coin> coins; public Castle castle; public final WorldListener listener; public final Random rand; public float heightSoFar; public int score; public int state; public int lives=3; public World(WorldListener listener) { this.hero = new Hero(5, 1); this.platforms = new ArrayList<Platform>(); this.springs = new ArrayList<Spring>(); this.ghosts = new ArrayList<Ghost>(); this.coins = new ArrayList<Coin>(); this.listener = listener; rand = new Random(); generateLevel(); this.heightSoFar = 0; this.score = 0; this.state = WORLD_STATE_RUNNING; } private void generateLevel() { float y = Platform.PLATFORM_HEIGHT / 2; float maxJumpHeight = Hero.hero_JUMP_VELOCITY * Hero.hero_JUMP_VELOCITY / (2 * -gravity.y); while (y < WORLD_HEIGHT - WORLD_WIDTH / 2) { int type = rand.nextFloat() > 0.8f ? Platform.PLATFORM_TYPE_MOVING : Platform.PLATFORM_TYPE_STATIC; float x = rand.nextFloat() * (WORLD_WIDTH - Platform.PLATFORM_WIDTH) + Platform.PLATFORM_WIDTH / 2; Platform platform = new Platform(type, x, y); platforms.add(platform); if (rand.nextFloat() > 0.9f && type != Platform.PLATFORM_TYPE_MOVING) { Spring spring = new Spring(platform.position.x, platform.position.y + Platform.PLATFORM_HEIGHT / 2 + Spring.SPRING_HEIGHT / 2); springs.add(spring); } if (rand.nextFloat() > 0.7f) { Ghost ghost = new Ghost(platform.position.x + rand.nextFloat(), platform.position.y + Ghost.GHOST_HEIGHT + rand.nextFloat() * 3); ghosts.add(ghost); } if (rand.nextFloat() > 0.6f) { Coin coin = new Coin(platform.position.x + rand.nextFloat(), platform.position.y + Coin.COIN_HEIGHT + rand.nextFloat() * 3); coins.add(coin); } y += (maxJumpHeight - 0.5f); y -= rand.nextFloat() * (maxJumpHeight / 3); } castle = new Castle(WORLD_WIDTH / 2, y); } public void update(float deltaTime, float accelX) { updatehero(deltaTime, accelX); updatePlatforms(deltaTime); updateGhosts(deltaTime); updateCoins(deltaTime); if (hero.state != Hero.hero_STATE_HIT) checkCollisions(); checkGameOver(); checkFall(); } private void updatehero(float deltaTime, float accelX) { if (hero.state != Hero.hero_STATE_HIT && hero.position.y <= 0.5f) hero.hitPlatform(); if (hero.state != Hero.hero_STATE_HIT) hero.velocity.x = -accelX / 10 * Hero.hero_MOVE_VELOCITY; hero.update(deltaTime); heightSoFar = Math.max(hero.position.y, heightSoFar); } private void updatePlatforms(float deltaTime) { int len = platforms.size(); for (int i = 0; i < len; i++) { Platform platform = platforms.get(i); platform.update(deltaTime); if (platform.state == Platform.PLATFORM_STATE_PULVERIZING && platform.stateTime > Platform.PLATFORM_PULVERIZE_TIME) { platforms.remove(platform); len = platforms.size(); } } } private void updateGhosts(float deltaTime) { int len = ghosts.size(); for (int i = 0; i < len; i++) { Ghost ghost = ghosts.get(i); ghost.update(deltaTime); if (ghost.state == Ghost.GHOST_STATE_DYING && ghost.stateTime > Ghost.GHOST_DYING_TIME) { ghosts.remove(ghost); len = ghosts.size(); } } } private void updateCoins(float deltaTime) { int len = coins.size(); for (int i = 0; i < len; i++) { Coin coin = coins.get(i); coin.update(deltaTime); } } private void checkCollisions() { checkPlatformCollisions(); checkGhostCollisions(); checkItemCollisions(); checkCastleCollisions(); } private void checkPlatformCollisions() { if (hero.velocity.y > 0) return; int len = platforms.size(); for (int i = 0; i < len; i++) { Platform platform = platforms.get(i); if (hero.position.y > platform.position.y) { if (OverlapTester .overlapRectangles(hero.bounds, platform.bounds)) { hero.hitPlatform(); listener.jump(); if (rand.nextFloat() > 0.5f) { platform.pulverize(); } break; } } } } private void checkGhostCollisions() { int len = ghosts.size(); for (int i = 0; i < len; i++) { Ghost ghost = ghosts.get(i); if (hero.position.y < ghost.position.y) { if (OverlapTester.overlapRectangles(ghost.bounds, hero.bounds)){ hero.hitGhost(); listener.hit(); } break; } else { if(hero.position.y > ghost.position.y) { if (OverlapTester.overlapRectangles(hero.bounds, ghost.bounds)){ hero.hitGhostJump(); listener.jump(); ghost.dying(); score += Ghost.GHOST_SCORE; } break; } } } } private void checkItemCollisions() { int len = coins.size(); for (int i = 0; i < len; i++) { Coin coin = coins.get(i); if (OverlapTester.overlapRectangles(hero.bounds, coin.bounds)) { coins.remove(coin); len = coins.size(); listener.coin(); score += Coin.COIN_SCORE; } } if (hero.velocity.y > 0) return; len = springs.size(); for (int i = 0; i < len; i++) { Spring spring = springs.get(i); if (hero.position.y > spring.position.y) { if (OverlapTester.overlapRectangles(hero.bounds, spring.bounds)) { hero.hitSpring(); listener.highJump(); } } } } private void checkCastleCollisions() { if (OverlapTester.overlapRectangles(castle.bounds, hero.bounds)) { state = WORLD_STATE_NEXT_LEVEL; } } private void checkFall() { if (heightSoFar - 7.5f > hero.position.y) { --lives; hero.hitSpring(); listener.highJump(); } } private void checkGameOver() { if (lives<=0) { state = WORLD_STATE_GAME_OVER; } } }

    Read the article

  • How to loop an executable command in the terminal in Linux?

    - by user1452373
    Let me first describe my situation, I am working on a Linux platform and have a collection of .bmp files that add one to the picture number from filename0022.bmp up to filename0680.bmp. So a total of 658 pictures. I want to be able to run each of these pictures through a .exe file that operates on the picture then kicks out the file to a file specified by the user, it also has some threshold arguments: lower, upper. So the typical call for the executable is: ./filter inputfile outputfile lower upper Is there a way that I can loop this call over all the files just from the terminal or by creating some kind of bash script? My problem is similar to this: Execute a command over multiple files with a batch file but this time I am working in a Linux command line terminal. Thank you for your help, Luke H

    Read the article

  • Posting an action works... but no image

    - by Brian Rice
    I'm able to post an open graph action to facebook using the following url: https://graph.facebook.com/me/video.watches with the following post data: video=http://eqnetwork.com/home/video.html?f=8e7b4f27-8cbd-4430-84df-d9ccb46da45f.mp4 It seems to be getting the title from the open graph metatags at the "video" object. But, it's not getting the image (even though one is specified in the metatag "og:image"). Also, if I add this to the post data: picture=http://eqnetwork.com/icons/mgen/overplayThumbnail.ms?drid=14282&subType=ljpg&w=120&h=120&o=1&thumbnail= still no image. Any thoughts? Brian

    Read the article

  • jQuery Cloud Zoom Plugin and image zoom being actived by mouseenter or mouseover

    - by masimao
    I am using the jQuery Cloud Zoom Plugin and i need to add the "mouseenter" or "mouseover" event to activate the zoom when the user put the mouse over the thumbs. So i have made this change in the line 359 of the file cloud-zoom.1.0.2.js (Version 1.0.2) $(this).bind('mouseenter click', $(this) ... It works, but if i pass the mouse quickly over the thumbs the "Loading" text doesn't disapear. Someone knows what i have to change to solve this? Thanks for any help!

    Read the article

  • How to setup custom DNS with Azure Websites Preview?

    - by husainnz
    I created a new Azure Website, using Umbraco as the CMS. I got a page up and going, and I already have a .co.nz domain with www.domains4less.com. There's a whole lot of stuff on the internet about pointing URLs to Azure, but that seems to be more of a redirection service than anything (i.e. my URLs still use azurewebsites.net once I land on my site). Has anybody had any luck getting it to go? Here's the error I get when I try adding the DNS entry to Azure (I'm in reserved mode, reemdairy is the name of the website): There was an error processing your request. Please try again in a few moments. Browser: 5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5 User language: undefined Portal Version: 6.0.6002.18488 (rd_auxportal_stable.120609-0259) Subscriptions: 3aabe358-d178-4790-a97b-ffba902b2851 User email address: [email protected] Last 10 Requests message: Failure: Ajax call to: Websites/UpdateConfig. failed with status: error (500) in 2.57 seconds. x-ms-client-request-id was: 38834edf-c9f3-46bb-a1f7-b2839c692bcf-2012-06-12 22:25:14Z dateTime: Wed Jun 13 2012 10:25:17 GMT+1200 (New Zealand Standard Time) durationSeconds: 2.57 url: Websites/UpdateConfig status: 500 textStatus: error clientMsRequestId: 38834edf-c9f3-46bb-a1f7-b2839c692bcf-2012-06-12 22:25:14Z sessionId: 09c72263-6ce7-422b-84d7-4c21acded759 referrer: https://manage.windowsazure.com/#Workspaces/WebsiteExtension/Website/reemdairy/configure host: manage.windowsazure.com response: {"message":"Try again. Contact support if the problem persists.","ErrorMessage":"Try again. Contact support if the problem persists.","httpStatusCode":"InternalServerError","operationTrackingId":"","stackTrace":null} message: Complete: Ajax call to: Websites/GetConfig. completed with status: success (200) in 1.021 seconds. x-ms-client-request-id was: a0cdcced-13d0-44e2-866d-e0b061b9461b-2012-06-12 22:24:43Z dateTime: Wed Jun 13 2012 10:24:44 GMT+1200 (New Zealand Standard Time) durationSeconds: 1.021 url: Websites/GetConfig status: 200 textStatus: success clientMsRequestId: a0cdcced-13d0-44e2-866d-e0b061b9461b-2012-06-12 22:24:43Z sessionId: 09c72263-6ce7-422b-84d7-4c21acded759 referrer: https://manage.windowsazure.com/#Workspaces/WebsiteExtension/Website/reemdairy/configure host: manage.windowsazure.com message: Complete: Ajax call to: https://manage.windowsazure.com/Service/OperationTracking?subscriptionId=3aabe358-d178-4790-a97b-ffba902b2851. completed with status: success (200) in 1.887 seconds. x-ms-client-request-id was: a7689fe9-b9f9-4d6c-8926-734ec9a0b515-2012-06-12 22:24:40Z dateTime: Wed Jun 13 2012 10:24:42 GMT+1200 (New Zealand Standard Time) durationSeconds: 1.887 url: https://manage.windowsazure.com/Service/OperationTracking?subscriptionId=3aabe358-d178-4790-a97b-ffba902b2851 status: 200 textStatus: success clientMsRequestId: a7689fe9-b9f9-4d6c-8926-734ec9a0b515-2012-06-12 22:24:40Z sessionId: 09c72263-6ce7-422b-84d7-4c21acded759 referrer: https://manage.windowsazure.com/#Workspaces/WebsiteExtension/Website/reemdairy/configure host: manage.windowsazure.com message: Complete: Ajax call to: /Service/GetUserSettings. completed with status: success (200) in 0.941 seconds. x-ms-client-request-id was: 805e554d-1e2e-4214-afd5-be87c0f255d1-2012-06-12 22:24:40Z dateTime: Wed Jun 13 2012 10:24:40 GMT+1200 (New Zealand Standard Time) durationSeconds: 0.941 url: /Service/GetUserSettings status: 200 textStatus: success clientMsRequestId: 805e554d-1e2e-4214-afd5-be87c0f255d1-2012-06-12 22:24:40Z sessionId: 09c72263-6ce7-422b-84d7-4c21acded759 referrer: https://manage.windowsazure.com/#Workspaces/WebsiteExtension/Website/reemdairy/configure host: manage.windowsazure.com message: Complete: Ajax call to: Extensions/ApplicationsExtension/SqlAzure/ClusterSuffix. completed with status: success (200) in 0.483 seconds. x-ms-client-request-id was: 85157ceb-c538-40ca-8c1e-5cc07c57240f-2012-06-12 22:24:39Z dateTime: Wed Jun 13 2012 10:24:40 GMT+1200 (New Zealand Standard Time) durationSeconds: 0.483 url: Extensions/ApplicationsExtension/SqlAzure/ClusterSuffix status: 200 textStatus: success clientMsRequestId: 85157ceb-c538-40ca-8c1e-5cc07c57240f-2012-06-12 22:24:39Z sessionId: 09c72263-6ce7-422b-84d7-4c21acded759 referrer: https://manage.windowsazure.com/#Workspaces/WebsiteExtension/Website/reemdairy/configure host: manage.windowsazure.com message: Complete: Ajax call to: Extensions/ApplicationsExtension/SqlAzure/GetClientIp. completed with status: success (200) in 0.309 seconds. x-ms-client-request-id was: 2eb194b6-66ca-49e2-9016-e0f89164314c-2012-06-12 22:24:39Z dateTime: Wed Jun 13 2012 10:24:40 GMT+1200 (New Zealand Standard Time) durationSeconds: 0.309 url: Extensions/ApplicationsExtension/SqlAzure/GetClientIp status: 200 textStatus: success clientMsRequestId: 2eb194b6-66ca-49e2-9016-e0f89164314c-2012-06-12 22:24:39Z sessionId: 09c72263-6ce7-422b-84d7-4c21acded759 referrer: https://manage.windowsazure.com/#Workspaces/WebsiteExtension/Website/reemdairy/configure host: manage.windowsazure.com message: Complete: Ajax call to: Extensions/ApplicationsExtension/SqlAzure/DefaultServerLocation. completed with status: success (200) in 0.309 seconds. x-ms-client-request-id was: 1bc165ef-2081-48f2-baed-16c6edf8ea67-2012-06-12 22:24:39Z dateTime: Wed Jun 13 2012 10:24:40 GMT+1200 (New Zealand Standard Time) durationSeconds: 0.309 url: Extensions/ApplicationsExtension/SqlAzure/DefaultServerLocation status: 200 textStatus: success clientMsRequestId: 1bc165ef-2081-48f2-baed-16c6edf8ea67-2012-06-12 22:24:39Z sessionId: 09c72263-6ce7-422b-84d7-4c21acded759 referrer: https://manage.windowsazure.com/#Workspaces/WebsiteExtension/Website/reemdairy/configure host: manage.windowsazure.com message: Complete: Ajax call to: Extensions/ApplicationsExtension/SqlAzure/ServerLocations. completed with status: success (200) in 0.309 seconds. x-ms-client-request-id was: e1fba7df-6a12-47f8-9434-bf17ca7d93f4-2012-06-12 22:24:39Z dateTime: Wed Jun 13 2012 10:24:40 GMT+1200 (New Zealand Standard Time) durationSeconds: 0.309 url: Extensions/ApplicationsExtension/SqlAzure/ServerLocations status: 200 textStatus: success clientMsRequestId: e1fba7df-6a12-47f8-9434-bf17ca7d93f4-2012-06-12 22:24:39Z sessionId: 09c72263-6ce7-422b-84d7-4c21acded759 referrer: https://manage.windowsazure.com/#Workspaces/WebsiteExtension/Website/reemdairy/configure host: manage.windowsazure.com

    Read the article

  • What is the most elegant way to access current_user from the models? or why is it a bad idea?

    - by TheLindyHop
    So, I've implemented some permissions between my users and the objects the users modify.. and I would like to lessen the coupling between the views/controllers with the models (calling said permissions). To do that, I had an idea: Implementing some of the permission functionality in the before_save / before_create / before_destroy callbacks. But since the permissions are tied to users (current_user.can_do_whatever?), I didn't know what to do. This idea may even increase coupling, as current_user is specifically controller-level. The reason why I initially wanted to do this is: All over my controllers, I'm having to check if a user has the ability to save / create / destroy. So, why not just return false upon save / create / destroy like rails' .save already does, and add an error to the model object and return false, just like rails' validations? Idk, is this good or bad? is there a better way to do this?

    Read the article

  • How to make Android not to recycle my Bitmap until I don't need it?

    - by RankoR
    I'm getting drawing cache of the view, that is set as contentView to the Activity. Then I set new content view to the activity and pass that drawing cache to it. But Android recycles my bitmaps and I'm getting this exception: 06-13 01:58:04.132: E/AndroidRuntime(15106): java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@40e72dd8 Any way to fix it? I had an idea to extend Bitmap class, but it's final. Why GC is recycling it?

    Read the article

  • jQuery toggle div and text

    - by Jack
    I would like some help with this code, I have read similar questions & answers here on stackoverflow but I still can't get it right. I have a link that populated by .html("") to read more… when clicked it opens the hidden div and at the end the .html("") reads less. When I click close the div slides closed but the text still reads less… I have read many articles on how to do this but am confused and can't get past this last hurdle, any help would be much appreciated. // this is the intro div Ligula suspendisse nulla pretium, rhoncus tempor placerat fermentum, enim integer ad vestibulum volutpat. Nisl rhoncus turpis est, vel elit, congue wisi enim nunc ultricies sit, magna tincidunt. Maecenas aliquam maecenas ligula nostra, accumsan taciti. // this next div is hidden Ligula suspendisse nulla pretium, rhoncus tempor placerat fermentum, enim integer ad vestibulum volutpat. Nisl rhoncus turpis est, vel elit, congue wisi enim nunc ultricies sit, magna tincidunt. Maecenas aliquam maecenas ligula nostra, accumsan taciti. $(document).ready(function() { $(".overview-continued").hide(); $(".show-overview").html("more..."); $(".show-overview").click(function() { $(".overview-continued").slideToggle("1000"); $(".show-overview").html("less..."); return false; }); });

    Read the article

  • Sending buffered images between Java client and Twisted Python socket server

    - by PattimusPrime
    I have a server-side function that draws an image with the Python Imaging Library. The Java client requests an image, which is returned via socket and converted to a BufferedImage. I prefix the data with the size of the image to be sent, followed by a CR. I then read this number of bytes from the socket input stream and attempt to use ImageIO to convert to a BufferedImage. In abbreviated code for the client: public String writeAndReadSocket(String request) { // Write text to the socket BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); bufferedWriter.write(request); bufferedWriter.flush(); // Read text from the socket BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream())); // Read the prefixed size int size = Integer.parseInt(bufferedReader.readLine()); // Get that many bytes from the stream char[] buf = new char[size]; bufferedReader.read(buf, 0, size); return new String(buf); } public BufferedImage stringToBufferedImage(String imageBytes) { return ImageIO.read(new ByteArrayInputStream(s.getBytes())); } and the server: # Twisted server code here # The analog of the following method is called with the proper client # request and the result is written to the socket. def worker_thread(): img = draw_function() buf = StringIO.StringIO() img.save(buf, format="PNG") img_string = buf.getvalue() return "%i\r%s" % (sys.getsizeof(img_string), img_string) This works for sending and receiving Strings, but image conversion (usually) fails. I'm trying to understand why the images are not being read properly. My best guess is that the client is not reading the proper number of bytes, but I honestly don't know why that would be the case. Side notes: I realize that the char[]-to-String-to-bytes-to-BufferedImage Java logic is roundabout, but reading the bytestream directly produces the same errors. I have a version of this working where the client socket isn't persistent, ie. the request is processed and the connection is dropped. That version works fine, as I don't need to care about the image size, but I want to learn why the proposed approach doesn't work.

    Read the article

  • Can I version dotfiles within a project without merging their history into the main line?

    - by istrasci
    I'm sure this title is fairly obscure. I'm wondering if there is some way in git to tell it that you want a certain file to use different versions of a file when moving between branches, but to overall be .gitignored from the repository. Here's my scenario: I've got a Flash Builder project (for a Flex app) that I control with git. Flex apps in Flash Builder projects create three files: .actionScriptProperties, .flexProperties, and .project. These files contain lots of local file system references (source folders, output folders, etc.), so naturally we .gitignore them from our repo. Today, I wanted to use a new library in my project, so I made a separate git branch called lib, removed the old version of the library and put in the new one. Unfortunately, this Flex library information gets stored in one of those three dot files (not sure which offhand). So when I had to switch back to the first branch (master) earlier, I was getting compile errors because master was now linked to the new library (which basically negated why I made lib in the first place). So I'm wondering if there's any way for me to continue to .gitignore these files (so my other developers don't get them), but tell git that I want it to use some kind of local "branch version" so I can locally use different versions of the files for different branches.

    Read the article

  • How to find longest common substring using trees?

    - by user384706
    The longest common substring problem according to wiki can be solved using a suffix tree. From wiki: The longest common substrings of a set of strings can be found by building a generalised suffix tree for the strings, and then finding the deepest internal nodes which have leaf nodes from all the strings in the subtree below it I don't get this. Example: if I have: ABCDE and XABCZ then the suffix tree is (some branches from XABCZ omitted due to space): The longest common substring is ABC but it is not I can not see how the description of wiki helps here. ABC is not the deepest internal nodes with leaf nodes. Any help to understand how this works?

    Read the article

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