w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Facebook object API - duplicate objects created
The issue here is that when the user clicks the "Peace" button on your site, two Open Graph actions are published and that's against our policy - one user action should not publish multiple stories. If you log in as your Open Graph Test User and check the Activity Log, you'll see the following two published actions with the same timestamp: https://www.facebook.com/100006264788511/activity/1388570951361718 https://www.facebook.com/100006264788511/activity/1388570924695054 Are you sure your code is only making a single call to the Graph API when publishing the action?

Categories : Facebook

Localize Facebook OG Tags
Have you tried the 'locale' og pseudo? Check this out: https://developers.facebook.com/docs/opengraph/guides/internationalization/

Categories : HTML

Dynamically Created Audio Object not playing in Android Chrome browser
Methods 1, 2 & 3 will not work on iOS. Unfortunately most mobile devices limit HTML5 audio to a single source playing at a time. iOS requires user interaction to initiate any media playback (onload doesn't count).

Categories : Javascript

create JSON object in jquery, to many objects are created
I think what you need is, one object to be added to info array for each item element in the xml with the properties stage, title, description, location, billtype, linkurl and thedate info.push({ 'stage' : stage, 'title' : title, 'description' : desc, 'location' : location, 'billtype' : billtype, 'linkurl' : linkurl, 'thedate' : thedate });

Categories : Jquery

Can list objects be created in R that name themselves based on input object names?
A random idea: a1<-1 a2<-20 a3<-1:20 my_list <- function(...){ names <- as.list(substitute(list(...)))[-1L] result <- list(...) names(result) <- names result } > my_list(a1,a2,a3) $a1 [1] 1 $a2 [1] 20 $a3 [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 (The idea is stolen from the code in data.frame.)

Categories : R

How to add array of objects to a newly created object with a hasMany relationship in Ember?
I'd tried all manner of ways of getting my array onto the 'children' property of the parent object, but I stumbled across this in a pull request code snippet on Github and it's now working. I guess my array was the wrong type for the parent object property, I still don't know how I'd create a seperate array to later pass to the object, but pushing directly onto it works! var child1 = App.Child.createRecord({ name: "Test" }); var child2 = App.Child.createRecord({ name: "Test2" }); /*var newChildrenArray = []; newChildrenArray.pushObject(child1); newChildrenArray.pushObject(child2);*/ var parent = App.Parent.createRecord({ name: "Hello :-)" }); parent.get('children').pushObject(child1); parent.get('children').pushObject(child2);

Categories : Ember Js

jQuery doesn't see newly created object. How to refresh list of DOM objects?
If you're selecting your ellipse element using its ID, make sure to set it correctly with a valid value. With CSS (and therefore with jQuery too) you would use #obj0 to select the element having the ID obj0, but you don't have such element as what you have is an element with an ID defined to #obj0, which is an invalid value. To solve your problem, replace the following: $("#div1 svg").append("<ellipse id='#obj0' class='svgobjects'>"); With this: $("#div1 svg").append("<ellipse id='obj0' class='svgobjects'>"); Edit: In HTML5 the ID #obj0 is actually valid (see http://www.w3.org/TR/html-markup/global-attributes.html), but in this case you will have to select it using $("##obj0") instead of $("#obj0").

Categories : Javascript

How can I localize a dynamic object?
As far as I know, NSLocalizedString() and all variants thereof work within your app bundle. You could, in theory, use them (more precisely, NSLocalizedStringFromTable(), if it was possible to serialize the contents of your object into a .strings file inside the app bundle. Unfortunately, the app bundle is not writable, so I'm pretty confident you can't use these functions macros. What you can do is you obtain the current system language identifier, then you use it as an index into your deserialized dictionary: NSString *curSysLang = [NSLocale preferredLanguages][0]; NSString *headline = jsonObject[0][@"Headline"][curSysLang];

Categories : Objective C

Facebook page link open in facebook app instead of safari browser
make it this way if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString: @"fb://profile/<page id>"]]){ [[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"fb://profile/<page id>"]]; }else{ [[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://www.facebook.com/<page name>"]]; }

Categories : Iphone

Facebook SDK 3.0 with old Facebook app version redirects to browser and gets stuck
We've found that Facebook version 1.9.8+ works, which is version code version code 40477+. As we are using the deprecated Facebook.java class, we modified validateAppSignatureForPackage(). It seems to work for all versions of the facebook app now. private boolean validateAppSignatureForPackage(Context context, String packageName) { PackageInfo packageInfo; try { packageInfo = context.getPackageManager().getPackageInfo(packageName, PackageManager.GET_SIGNATURES); if(packageInfo.versionCode<40477) { Log.i("validateAppSignatureForPackage", "Your facebook app version is prior to 1.9.8. Update your facebook app"); return false; } } catch (NameNotFoundException e) {

Categories : Android

How to distinguish between new objects created and found objects with mongo
The documentation to which you refer is not specific to the ruby driver. Try adding the :full_response=>true option as documented here: http://api.mongodb.org/ruby/current/Mongo/Collection.html#find_and_modify-instance_method It should return a hash with the requested document ("value") and a "lastErrorObject" hash with a field "updatedExisting" that you can check. Hope that helps.

Categories : Mongodb

Keeping track of objects created by other objects?
Your solution seems to be the one, you just need to be sure that all monster have the same pointer on ContainerLiaison, you can use a reference if you want. Another solution is to have a reference on the Containter in each monster, but I think your ContainerLiason is better. A last solution is static element and function, but I don't like it. I suggest that you keep your solution

Categories : C++

Share via facebook/twitter application in android , don't open browser if facebook/twitter is installed on the device
To post something using Facebook than integrate Facebook android sdk Getting Started with the Facebook SDK for Android Use Feed Dialog to post on Facebook. It automatically open fb app if it is installed otherwise open in browser Post to wall public class PhotoViewer extends Activity implements StatusCallback{ Button btnShare; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_photo_viewer); btnShare = (Button) findViewById(R.id.btnShare); btnShare.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Session.openActiveSession(PhotoViewer.this, true, PhotoViewer.this); }

Categories : Android

Facebook session not being created
in both cases you are using getloginurl shouldn't it be if ($fb_session) { try { $args = array( 'message' => $_GET['by'], 'link' => 'linkhere/', 'caption' => $_GET['test'] ); $post_id = $facebook->api("/me/feed", "post", $args); } catch (Exception $e) { $fb_logout_url = $facebook->getLogoutUrl; . . .

Categories : PHP

Facebook API: Is there way to know who/what created an Event
You can get to know who the ID belongs to by requesting the profile FQL table. Type: the type of profile, one of user, group, page, event, or application Example: SELECT name, type FROM profile WHERE id=11239244970 Result: { "data": [ { "name": "stackoverflow", "type": "page" } ] }

Categories : PHP

logging out the user if new session is created on the same browser using php
You'll want to destroy the old session: session_regenerate_id(TRUE); $_SESSION=array(); Or use the example on the php manual for session_destroy (http://php.net/manual/en/function.session-destroy.php)

Categories : PHP

how to see the project you have created using django/ mongo engine on browser?
First of all, open your system console and enter command mongo or enter with full path. In my case is /opt/mongodb/bin/mongo If all right you should see: MongoDB shell version: 2.2.2 connecting to: test > If you enter show dbs you see all databases into MongoDB Secondly, check your settings file. It should be as: DATABASES = { 'default': { 'ENGINE': 'django_mongodb_engine', 'NAME': 'db_into_mongo' } } or from mongoengine import connect MONGO_HOST = 'localhost' try: connect('db_into_mongo', host=MONGO_HOST) except: pass Third, exit from MongoDB console or open a new system console. Move to Django's folder and enter ./manage.py shell If all right you should see Python console with enviroment of Django: Python 2.7.3 (default, Oct 22 2012, 06:12:2

Categories : Django

Choose between facebook app and browser?
This is how I check if Google Maps is installed. Modified for checking the Facebook app status. // CHECK IF THE FACEBOOK APP IS INSTALLED PackageManager pkManager = activity.getPackageManager(); try { PackageInfo pkgInfo = pkManager.getPackageInfo("com.facebook.katana", 0); String getPkgInfo = pkgInfo.toString(); if (getPkgInfo.equals("com.facebook.katana")) { // OPEN THE PAGE IN THE FACEBOOK APP String strPage = "fb://profile/" + YOUR_PAGE_ID; // CHECK IF THE "fb://profile/" IS CORRECT | REPLACE WITH "fb://page/" // NOT ENTIRELY SURE WHICH ONE WORKS Intent showPageInFB = new Intent(Intent.ACTION_VIEW, Uri.parse(facebookScheme)); startActivity(showPageInFB ); } else { // OPEN THE PAGE IN A BROWSER Intent

Categories : Java

why can't objects be created without a constructor?
Say you have a simple class : class Foo { int bar; } What is the value of bar exactly? Maybe you don't care when your object gets its memory allocated, but the machine running your program needs to give it some value. That's what the constructor is for : initializing class members to some value.

Categories : C++

How do I send Excel file created in Interop to browser in Razor MVC?
You should use FileResult for this purpose. [HttpPost] public FileResult ExcelDownload(ReportDownloadRequest reportRequest) { //Code to generate Excel file with GemBox.Spreadsheet return new FileStreamResult(report, "application/ms-excel") { FileDownloadName = "SalesReport.xls" }; } For Excel sheets, you can use GemBox.Spreadsheet Free version delivers the same performance and set of features as the Professional version. However, the following limitations are imposed: Maximum number of rows per sheet is 150. Maximum number of sheets per workbook is 5. GemSheet Sample Code: // Set license key to use GemBox.Spreadsheet in a Free mode. SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY"); // Create new empty Excel

Categories : C#

Unity3d Facebook SDK login with browser
You better ask them here instead of asking people on StackOverflow. Ask them on forum, PM or Email them on their page.

Categories : Facebook

How to call the mainwindow object from a second object created from main window in c# .net
Use price.ShowDialog() to show second form as modal dialog. Main form will be disabled until you close second form: private void priceControllToolStripMenuItem_Click(object sender, EventArgs e) { using(SecondWindow price = new SecondWindow()) price.ShowDialog(); }

Categories : C#

How can one object call methods from an object created in another class
No need to make it accessible to all classes, simply pass a reference in the constructor of GoFishPlayer: public class GoFishPlayer { private Deck deck; public GoFishPlayer(Deck deck) { this.deck = deck; } ... } public class StartGame { public static void start(){ Deck deck = new Deck(1); GoFishHumanPlayer player = new GoFishHumanPlayer(deck); GoFishAiPlayer ai = new GoFishAiPlayer(deck); player.drawHand(); ai.drawHand(); player.turn(); } }

Categories : Java

how to loop through object property's created by Object.defineProperty
Change statsHtml += "<p id = 'displayPlayerHealth'>" + prop + "</p>"; To something like statsHtml += "<p id = 'displayPlayer" + prop + "'>" + prop + "</p>"; Add the enumerable flag to the properties defined by Object.defineProperty Also consider safeguarding your for..in loop with hasOwnProperty for ( var prop in player ) { if (player.hasOwnProperty(prop)) { // do something } }

Categories : Javascript

How to automatically call a function when a new object is created within an object
Problem 2 can be solved by generating a different getter and setter function for each property. function setterFunc(prop) { return function(value) { x._private[prop] = value; x.initializer(prop, value); } } function getterFunc(prop) { return function() { return x._private[prop]; } } Object.defineProperty(x, 'newProp', { get: getterFunc('newProp'), set: setterFunc('newProp'), configurable: true, enumerable: true });

Categories : Javascript

c# delete dynamically created objects
You need to remove them from the controls collection. var toDelete = Controls.OfType<Label>() .Where(c => (c.Tag ?? "").ToString() != "non-disposal") .ToList(); //need a list or array to avoid changing the collection as we remove from it foreach (var ctrl in toDelete) { Controls.Remove(ctrl); ctrl.Dispose(); } //if this is part of a long method, also clear the list right away // so the garbage collector can see them toDelete.Clear();

Categories : C#

Javascript objects parsed vs created
The parse version basically does the same with the added overhead of breaking the text up and translating it ( which isn't slow ). I would consider it better programming using the first method, you don't want raw JSON hanging around your code :) JSON.parse will create a very basic object from the data you give it, there's no problem with that Using the first method allows you to define and extend the object before-hand, giving it methods and attributes allowing for better use of the data it contains.

Categories : Javascript

How many objects are created due to inheritance in java?
In Code only one object will be created and super call the parent class constructor . Prove of object creation : package one; public class A { public static A super_var; public A() { super_var = this; System.out.println("Constrcutor of A invoked"); } } package two; public class B extends A { public static A sub_var; public B() { sub_var = this; System.out.println("Constructor of B invoked"); } public void confirm() { if (sub_var == A.super_var) System.out.println("There is only one object is created"); else System.out.println("There are more than one object created"); } public static void main(String Args[]) { B x = new B(); x.confirm(); } } This will

Categories : Java

Can I store objects created in a DLL after unloading the DLL?
I hope you are not returning a local object on stack from DLL. It will definitely crash your system because the local object is destroyed after function returns from the DLL. It has nothing to do with the concept of DLL. If you try to reference a local object after its containing function returns, you'll see the same problem. If the memory is dynamically allocated on heap inside DLL, it's still valid after the DLL is uninitialized. You can still use the memory in your main application, because DLL itself doesn't own anything. Remember, the heap belongs to the process, not DLL. However, the general rule is that the owner of that memory(who creates that memory, e.g. the DLL in your case) is responsible to release the same memory. Allocating memory in DLL and deallocating it in the other si

Categories : C++

Get objects created in last 30 days, for each past day
items = Foo.objects.filter(createdate__lte=datetime.datetime.today(), createdate__gt=datetime.datetime.today()-datetime.timedelta(days=30)). values('createdate').annotate(count=Count('id')) This will (1) filter results to contain the last 30 days, (2) select just the createdate field and (3) count the id's, grouping by all selected fields (i.e. createdate). This will return a list of dictionaries of the format: [ {'createdate': <datetime.date object>, 'count': <int>}, {'createdate': <datetime.date object>, 'count': <int>}, ... ] EDIT: I don't believe there's a way to get all dates, even those with count == 0, with just SQL. You'll have to insert each missing date through python code, e.g.: import datetime # needed to use .append() later on it

Categories : Django

Add created objects to List automatically
You should look into creating an EmployeeFactory object to take care of that work for you. public class EmployeeFactory { private readonly IList<Employee> empList; public EmployeeFactory(IList<Employee> empList) { // guard clause to protect from null lists this.empList = empList; } public Employee Create(/* optional employee data used to instatiate */) { var newEmp = new Employee(); this.empList.Add(newEmp); return newEmp; } } Then where ever you need to create an employee just use the factory and when you need the list you can provided that where needed as well var empList = new List<Employee>(); var empFactory = new EmployeeFactory(empList); var emp1 = empFactory.Create(); var emp2 = empFactory.C

Categories : C#

Who creates event objects and where are they created?
Why do you think you need to know this? What problem are you trying to solve?. If you are curious then search the Java source code for something like new MouseEvent. If you don't find a match then it is probably done is some lower level code that we don't have access to. You can also take a look at Global Event Dispatching.

Categories : Java

how to call objects created in a loop?
You can access them via their index (the order they have been put on the stage). So something like: DisplayObject(getChildAt(1)).x = 100; // Where the 1 is the index (starting at 0)

Categories : Actionscript

How can I retrieve objects in the order they were created?
I hope it will help you PFQuery *query = [PFQuery queryWithClassName:@"ChatMessage" ]; [query orderByDescending:@"createdAt"]; query.limit =10; [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) { if (!error) { //you will get all your objectsas per u created ur object in parse. } }];

Categories : Iphone

Keep track of all objects created using a form
My first thought would be to have a separate class/method/function that keeps track of the PurchaceOrder's in each form. The ID could be tied to the result through a database or array/linked list that is auto-incremented when a new PurchaceOrder is created. As far as instantiating the list, have it instantiated when the class is first called, or have it as a separate class. After writing that, a separate class makes more sense, which is probably why I posted it that way originally.

Categories : Django

How to auto load a plugin (which i created using firebreath) when i open a file with .abc extension in browser?
You can register plugins for file extensions (although you can't override built-in support that way): set(FBSTRING_FileExtents "XXX") Plugins can be opened in the two relevant modes: embedded as an element in the page or as full-page - e.g. when you navigate to http://foo.com/bar.pdf or request a document who's mimetype your plugin handles. The Acrobat Reader plugin is most often seen as a full-page plugin and rarely actually embedded somewhere.

Categories : Firefox

When is objects assigned to instance variables created
private final List<ArrayList<Integer>> adjList = new ArrayList<ArrayList<Integer>>(); private final int vertexCount; private int edgeCount; public Graph(int vertexCount) { this.vertexCount = vertexCount; } becomes: private final List<ArrayList<Integer>> adjList; private final int vertexCount; private int edgeCount; public Graph(int vertexCount) { adjList = new ArrayList<ArrayList<Integer>>(); edgeCount = 0; this.vertexCount = vertexCount; } The default memory is allocated right after new is called and after that the constructor is called by JVM. From there, all instance variables are instantiated in the constructor. And explicit definitions are moved inside the co

Categories : Java

Newly created objects don't render in Flash
As well as creating the object with new, it needs to be added to the display list (see here: http://www.adobe.com/devnet/flash/quickstart/display_list_programming_as3.html) before it is rendered, so use stage.addChild(mouse) to do this.

Categories : Actionscript

Passing a parameter to objects created by defaultdict
defaultdict takes any callable, so you can create a new function that doesn't take a parameter and returns an object instantiated with the parameter you want. d = defaultdict(lambda: myobj(param1)) Another option is to use functools.partial, which creates a function with one (or more) of the parameters predefined: import functools d = defaultdict(functools.partial(myobj, param1))

Categories : Python

Django -- Only Displaying Objects A User Created
In your user_create view, def user_create(request): if request.method == 'POST': list_form = forms.ListForm(request.POST) if list_form.is_valid(): list_create = list_form.save() messages.success(request, 'List {0} created'.format(list_create.list_id)) up, _ = UserProfile.objects.get_or_create(user=request.user, list_id=list_create) return redirect(reverse('user_dashboard', args=(2,))) # 2 is just an example #rest of the code Basically, all you need to do is create a userprofile object.

Categories : Python



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.