Search Results

Search found 490 results on 20 pages for 'ali azam rana'.

Page 18/20 | < Previous Page | 14 15 16 17 18 19 20  | Next Page >

  • Does my function right on python?

    - by Ali Ismayilov
    Write a function which takes a string argument, and creates and returns an Employee object containing details of the employee specified by the string. The string should be assumed to have the format 12345 25000 Consultant Bart Simpson The first three items in the line will be the payroll number, salary and job title and the rest of the line will be the name. There will be no spaces in the job title but there may be one or more spaces in the name. My function: def __str__(self): return format(self.payroll, "d") + format(self.salary, "d") + ' ' \ + self.jobtitle + self.name

    Read the article

  • Annonymous functions accessing local variables [ActionScript - Flex 3.5]

    - by Ali
    Hi All, I am having a situation with my actionscript/flex front end. for each (var sym:String in ["A","B","C"]) { const handler = function (data:Object):void { Alert.show(sym); } asyncCallback(handler); } I am expecting to have 3 Alert windows containing A, B and C. But the actual result is 3 alert windows all showing C ! I appreciate your comments. -A

    Read the article

  • PHP class_exists always returns true

    - by Ali
    I have a PHP class that needs some pre-defined globals before the file is included: File: includes/Product.inc.php if (class_exists('Product')) { return; } // This class requires some predefined globals if ( !isset($gLogger) || !isset($db) || !isset($glob) ) { return; } class Product { ... } The above is included in other PHP files that need to use Product using require_once. Anyone who wants to use Product must however ensure those globals are available, at least that's the idea. I recently debugged an issue in a function within the Product class which was caused because $gLogger was null. The code requiring the above Product.inc.php had not bothered to create the $gLogger. So The question is how was this class ever included if $gLogger was null? I tried to debug the code (xdebug in NetBeans), put a breakpoint at the start of Product.inc.php to find out and every time it came to the if (class_exists('Product')) clause it would simply step in and return thus never getting to the global checks. So how was it ever included the first time? This is PHP 5.1+ running under MAMP (Apache/MySQL). I don't have any auto loaders defined.

    Read the article

  • getting another website data to manipulate it's value in perl

    - by aun ali
    use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser warningsToBrowser); our @a=param(src="http://fxrates.forexpros.com/index.php?pairs_ids=1525=last_update"); print header(),start_html('results.pl'); $a=http://fxrates.forexpros.com/index.php?pairs_ids=1525=last_update; '<iframe frameborder="0" scrolling="no" height="95" width="213" allowtransparency="true" marginwidth="0" marginheight="0" src="http://fxrates.forexpros.com/index.php?pairs_ids=1525;&header-text-color=%23FFFFFF&curr-name-color=%230059b0&inner-text-color=%23000000&green-text-color=%232A8215&green-background=%23B7F4C2&red-text-color=%23DC0001&red-background=%23FFE2E2&inner-border-color=%23CBCBCB&border-color=%23cbcbcb&bg1=%23F6F6F6&bg2=%23ffffff&bid=hide&ask=hide&last=hide&high=hide&low=hide&change=hide&change_in_percents=hide&last_update=show"></iframe><br /><div style="width:213"><span style="float:left"><span style="font-size: 11px;color: #333333;text-decoration: none;">The <a href="http://www.forexpros.com/quotes" target="_blank" style="font-size: 11px;color: #06529D; font-weight: bold;" class="underline_link">Forex Quotes</a> are Powered by Forexpros - The Leading Financial Portal.</span></span></div>'; print '<br/>'; print "$a"; print end_html();' getting error: Can't modify constant item in scalar assignment at livedata.pl line 4, near ""http://fxrates.forexpros.com/index.php?pairs_ids=1525=last_update")" syntax error at livedata.pl line 6, near "http:" Execution of livedata.pl aborted due to compilation errors.

    Read the article

  • Angularjs throws TypeError: Cannot read property 'indexOf' of undefined

    - by Ali
    I'm trying to debug the above code which I feel like this is very useful .< I can't even find what is wrong in my code and don't really know where to start since Angularjs still very new to me. I'm trying to localize Angularjs app. I know this is missing a lot of context in order to get a help, but I'm trying to see what information that I should give that would help on this debugging. I've gone through any indexOf in angularjs file and I can see few things is undefined but don't know if that would be helpful. So I've traced the problem here and this is what I have figured is the problem, but still counldn't figure out why... config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) { $routeProvider.when('/:locale?/:username/badges', { templateUrl: '_partials/badges.html', controller: 'badges' }) .when('/:username/badges', { templateUrl: '_partials/badges.html', controller: 'badges' }) .when('/:username/teaching-resources', { templateUrl: '_partials/teaching-resources.html', controller: 'teachingResources' }) .when('/:username/makes', { templateUrl: '_partials/makes.html', controller: 'makes' }) .when('/:username/likes', { templateUrl: '_partials/likes.html', controller: 'likes' }) .when('/:username/events', { templateUrl: '_partials/events.html', controller: 'events' }) .when('/:username', { templateUrl: '_partials/badges.html', controller: 'badges' }); $routeProvider.otherwise({ redirectTo: '/error/404' }); The URL that I'm visiting for default page is: This will fail and throw the error. http://localhost:1969/en-US/user/someUserName This will work fine http://localhost:1969/user/someUserName UPDATE I figured out! This is the problem: $locationProvider.html5Mode(true); But why!?

    Read the article

  • UIFileSharingEnabled use folders

    - by Ali Shafai
    I want to allow users add files to the application document folder, so I used the iTunes file sharing. The problem is they can only add single files with a flat structure. I want to drag and drop whole folder (even with sub folders) and keep the structure. Questions I have: is it possible with iTunes file sharing? if not, is there an open source project that helps me with writing a pc side app that talks to the iPhone side app and pushes the files into it?

    Read the article

  • information hiding in python

    - by ali
    in python tutorial added that python cannot hide its attributes from other classes. some thing such as private data in C++ or java..But also i know that we can use _ or __ to set some variables as privated one but it is not enogh. I think it is a week if it is not any thing to do it.

    Read the article

  • Query executes with no error but not in trigger

    - by liaqat ali
    I am facing a strange problem in creating trigger in MS SQL. I have a query that executes with out an error but when I place it within trigger body, it gives error Invalid column name 'ScreenName'. I am placing whole trigger code here. Please trace the issue. CREATE TRIGGER [dbo].[tr_tbFieldLabels_FieldLabelLength] ON [dbo].[tbFieldLabels] AFTER INSERT AS Update tbFieldLabels Set TextBoxLength = (SELECT top 1 TextboxLength FROM tbFieldLabelsSource FLS WHERE FLS.ScreenName = Inserted.ScreenName AND tbFieldLabelsSource.SystemName = Inserted.SystemName) FROM tbFieldLabels , Inserted WHERE tbFieldLabels.ID = Inserted.ID GO Please help me ASAP.

    Read the article

  • Binary Search Tree can't delete the root

    - by Ali Zahr
    Everything is working fine in this function, but the problem is that I can't delete the root, I couldn't figure out what's the bug here.I've traced the "else part" it works fine until the return, it returns the old value I don't know why. Plz Help! node *removeNode(node *Root, int key) { node *tmp = new node; if(key > Root->value) Root->right = removeNode(Root->right,key); else if(key < Root->value) Root->left = removeNode(Root->left, key); else if(Root->left != NULL && Root->right != NULL) { node *minNode = findNode(Root->right); Root->value = minNode->value; Root->right = removeNode(Root->right,Root->value); } else { tmp = Root; if(Root->left == NULL) Root = Root->right; else if(Root->right == NULL) Root = Root->left; delete tmp; } return Root; }

    Read the article

  • possible way to attach database to exe

    - by ali
    i created a small application using c# winforms that uses mssql as a database. is there a way to attach the database to the exe file so i won't need to install sqlserver on all the machines that i want to run the program on?

    Read the article

  • Autoclick security for a like button

    - by Ali Davut
    Hi everyone I want to develop a button like 'facebook like button'. I am going to use it on my website and thinking it to share as iframe like facebook but I cannot think its securty because someone can develop a script that can click on it automatically. I thought a solution using sessions but I couldn't make an algorithm completely. How can I disallow autoclicks and which solution is the best? It can be any language I just want algorithm. Thanks, have a nice day.

    Read the article

  • not able to draw image on canvas of surface view in Android

    - by Fayaz Ali
    I am drawing an image using drawbitmap method on a canvas of surface view which is an overlay surface on my camera preview.The image drawn is a portion of captured image to guide the user to capture next image with a proper overlap.Now when I am launching the activity as the application start activity i.e it is my first activity,it works fine and draws the image.But when I launch the same activity from some other activity,the surface view is not show anything. Is there any difference between launching an activity from another activity and from the application launch. Anyone help here please!

    Read the article

  • Getting visitors country from their IP

    - by Ali Abdulkarim Salem
    i want to get visitors country via their IP.. right now I'm using this ( http://api.hostip.info/country.php?ip=...... ) here's my code <?php if (isset($_SERVER['HTTP_CLIENT_IP'])) { $real_ip_adress = $_SERVER['HTTP_CLIENT_IP']; } if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $real_ip_adress = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $real_ip_adress = $_SERVER['REMOTE_ADDR']; } $cip = $real_ip_adress; $iptolocation = 'http://api.hostip.info/country.php?ip=' . $cip; $creatorlocation = file_get_contents($iptolocation); ?> Well, it's working properly, but the thing is, this returns the country code like US or CA., and not the whole country name like United States or Canada So, is there any good alternative to hostip.info offers this? I know that I can just write some code that will eventually turn this two letters to whole country name, but I'm just too lazy to write a code that contains all countries... P.S: For some reason I don't want to use any ready made CSV file or any code that will grab this information for me, something like ip2country ready made code and CSV.

    Read the article

  • Call static properties within another class in php

    - by ali A
    I have problem about calling a static property of a class inside another class. Class A { public $property; public function __construct( $prop ) { $this->property = $prop; } public function returnValue(){ return static::$this->property; } } Class B extends A { public static $property_one = 'This is first property'; public static $property_two = 'This is second property'; } $B = new B( 'property_one' ); $B->returnValue(); I expect to return This is first property But the Output is just the name a parameter input in __construct; When I print_r( static::$this->property ); the output is just property_one

    Read the article

  • Minimum 4 Characters or Show Nothing - PHP

    - by ali
    Hi, I want to show up only words with minimum 4 Characters, actually I can limit the hits and show only words with min. 100 hits - but how can I set a min. character length? thank you! function sm_list_recent_searches($before = '', $after = '', $count = 20) { // List the most recent successful searches. global $wpdb, $table_prefix; $count = intval($count); $results = $wpdb->get_results( "SELECT `terms`, `datetime` FROM `{$table_prefix}searchmeter_recent` WHERE 100 < `hits` ORDER BY `datetime` DESC LIMIT $count"); if (count($results)) { foreach ($results as $result) { echo '<a href="'. get_settings('home') . '/search/' . urlencode($result->terms) . '">'. htmlspecialchars($result->terms) .'</a>'.", "; } } }

    Read the article

  • PHP cannot verify if directory exists

    - by ali
    I am going crazy with this one I have this folders and files structure / /projects /mytest /install /index.php /product /resources So, inside my install/index.php file I am trying to verify if /product folder does exist. I know that the folder exists, but looks like PHP doesn't. My code: if(file_exists('../../mytest/product') && is_dir('../../mytest/product')) { echo 'Folder exists!'; } else { echo 'PHP is blind or something!'; } Maybe I am very tired, but I just cannot figure out what is wrong. Some rested minds here maybe will see the problem. Thanks!

    Read the article

  • Javascript OOP - accessing the inherited property or function from a closure within a subclass

    - by Ali
    Hi All, I am using the javascript inheritance helper provided here: http://ejohn.org/blog/simple-javascript-inheritance/ I have the following code, and I have problem accessing the inherited property or function from a closure within a subclass as illustrated below. I am new to OOP javascript code and I appreciate your advice. I suppose within the closure, the context changes to JQuery (this variable) hence the problem. I appreciate your comments. Thanks, -A PS - Using JQuery 1.5 var Users = Class.extend({ init: function(names){this.names = names;} }); var HomeUsers = Users.extend({ work:function(){ // alert(this.names.length); // PRINTS A // var names = this.names; // If I make a local alias it works $.map([1,2,3],function(){ var newName = this.names.length; //error this.names is not defined. alert(newName); }); } }); var users = new HomeUsers(["A"]); users.work();

    Read the article

  • limiting the rate of emails using python

    - by Ali
    I have a python script which reads email addresses from a database for a particular date, example today, and sends out an email message to them one by one. It reads data from MySQL using the MySQLdb module and stores all results in a dictionary and sends out emails using : rows = cursor.fetchall () #All email addresses returned that are supposed to go out on todays date. for row is rows: #send email However, my hosting service only lets me send out 500 emails per hour. How can I limit my script from making sure only 500 emails are sent in an hour and then to check the database if more emails are left for today or not and then to send them in the next hour. The script is activated using a cron job.

    Read the article

  • Controlling youtube traffic path ingoing to multihoming network

    - by Hamdy Ali
    Scenario: I've network multihoming (dual ISP) setup. each ISP bandwidth 500Mbps Currently ISP-A link bandwidth almost fully utilized then the second ISP-B link From our investigation, it is because youtube server cache response to link ISP-A. Some time the utilization of link ISP B increased because at that time youtube server cached is response to ISP B. My question how/Why did this happen? how do I force youtube cache server using ISP link B?

    Read the article

  • Cant update table in using isset

    - by Ali Munandar
    I have a table called settings, when I would change or enter data into the form it did not change the data in the table. In addition on form an image upload file is not running, There may be the wrong code below. <div class="maintitle">Site Settings</div> <?php $act=isset($_GET['act'])?$_GET['act']:""; if($act=='sub'){ $name=isset($_POST['site'])?$_POST['site']:""; $keys=isset($_POST['keywords'])?$_POST['keywords']:""; $desc=isset($_POST['descrp'])?$_POST['descrp']:""; $email=isset($_POST['email'])?$_POST['email']:""; $fbpage=isset($_POST['fbpage'])?$_POST['fbpage']:""; $twitter=isset($_POST['twitter'])?$_POST['twitter']:""; $gplus=isset($_POST['gplus'])?$_POST['gplus']:""; $disclaimer=isset($_POST['disclaimer'])?$_POST['disclaimer']:""; $template=isset($_POST['template'])?$_POST['template']:""; mysql_query("UPDATE settings SET site='$name',keywords='$keys',descrp='$desc',email='$email',fbpage='$fbpage',twitter='$twitter',gplus='$gplus',disclaimer='$disclaimer',template='$template' WHERE id=1"); if($_FILES["file"]["name"]!=''){ move_uploaded_file($_FILES["file"]["tmp_name"], "../images/logo.png"); }?> <div class="infomsgbox">Settings updated successfully.</div> <?php } $q=mysql_query("select * from settings where id=1"); $s=mysql_fetch_assoc($q); ?> <div class="box"> <div class="inbox"> <!--form--> <form action="index.php?act=sub" method="post" enctype="multipart/form-data"> <label class="artlbl">Site Name</label> <div class="formdiv"> <input type="text" name='site' value='<?php echo $s['name']?>'/> </div> <label class="artlbl">Logo (264px x 85px)</label> <div class="formdiv"> <input type='file' class="file" name='file'/> </div> <div class="clear"></div> <label class="artlbl">Meta Keywords (Separated by Commas)</label> <div class="formdiv"> <textarea name='keywords' cols=40 rows=5 ><?php echo $s['keywords']?></textarea> </div> <label class="artlbl">Meta Description</label> <div class="formdiv"> <textarea name='descrp' cols=40 rows=5 ><?php echo $s['descrp']?></textarea> </div> <label class="artlbl">Email</label> <div class="formdiv"> <input type="text" name='email' value='<?php echo $s['email']?>'/> </div> <label class="artlbl">Facebook Fan Page</label> <div class="formdiv"> <input type="text" name='fbpage' value='<?php echo $s['fbpage']?>'/> </div> <label class="artlbl">Twitter URL</label> <div class="formdiv"> <input type="text" name='twitter' value='<?php echo $s['twitter']?>'/> </div> <label class="artlbl">Google+ URL</label> <div class="formdiv"> <input type="text" name='gplus' value='<?php echo $s['gplus']?>'/> </div> <label class="artlbl">Site Disclaimer</label> <div class="formdiv"> <textarea name='disclaimer' cols=40 rows=5 ><?php echo $s['disclaimer']?></textarea> </div> <label class="artlbl">Template</label> <div class="formdiv"> <select name="template" id="template"> <option value="<?php echo $s['template'];?>"><?php echo ucfirst($s['template']);?></option> <?php foreach(glob('../templates/*', GLOB_ONLYDIR) as $dir) { $TemplateDir = substr($dir, 13); $TemplateName = ucfirst($TemplateDir) ?> <option value="<?php echo $TemplateDir;?>"><?php echo $TemplateName;?></option> <?php }?> </select> </div> <div class="clear"></div> </br> <div class="formdiv"> <div class="sbutton"><input type="submit" id="submit" value="Update Site Settings"/></div> </div> </form> </div> </div><!--box--> Maybe someone can help me Related to this.

    Read the article

  • javascript complex recurrsion [on hold]

    - by Achilles
    Given Below is my data in data array. What i am doing in code below is that from that given data i have to construct json in a special format which i also gave below. //code start here var hierarchy={}; hierarchy.name="Hierarchy"; hierarchy.children=[{"name":"","children":[{"name":"","children":[]}]}]; var countryindex; var flagExist=false; var data = [ {country :"America", city:"Kansas", employe:'Jacob'}, {country :"Pakistan", city:"Lahore", employe:'tahir'}, {country :"Pakistan", city:"Islamabad", employe:'fakhar'} , {country :"Pakistan", city:"Lahore", employe:'bilal'}, {country :"India", city:"d", employe:'ali'} , {country :"Pakistan", city:"Karachi", employe:'eden'}, {country :"America", city:"Kansas", employe:'Jeen'} , {country :"India", city:"Banglore", employe:'PP'} , {country :"India", city:"Banglore", employe:'JJ'} , ]; for(var i=0;i<data.length;i++) { for(var j=0;j<hierarchy.children.length;j++) { //for checking country match if(hierarchy.children[j].name==data[i].country) { countryindex=j; flagExist=true; break; } } if(flagExist)//country match now no need to add new country just add city in it { var cityindex; var cityflag=false; //hierarchy.children[countryindex].children.push({"name":data[i].city,"children":[]}) //if(hierarchy.children[index].children!=undefined) for(var k=0;k< hierarchy.children[countryindex].children.length;k++) { //for checking city match if(hierarchy.children[countryindex].children[k].name==data[i].city) { // hierarchy.children[countryindex].children[k].children.push({"name":data[i].employe}) cityflag=true; cityindex=k; break; } } if(cityflag)//city match now add just empolye at that city index { hierarchy.children[countryindex].children[cityindex].children.push({"name":data[i].employe}); cityflag=false; } else//no city match so add new with employe also as this is new city so its emplye will be 1st { hierarchy.children[countryindex].children.push({"name":data[i].city,children:[{"name":data[i].employe}]}); //same as above //hierarchy.children[countryindex].children[length-1].children.push({"name":data[i].employe}); } flagExist=false; } else{ //no country match adding new country //with city also as this is new city of new country console.log("sparta"); hierarchy.children.push({"name":data[i].country,"children":[{"name":data[i].city,"children":[{"name":data[i].employe}]}]}); // hierarchy.children.children.push({"name":data[i].city,"children":[]}); } //console.log(hierarchy); } hierarchy.children.shift(); var j=JSON.stringify(hierarchy); //code ends here //here is the json which i seccessfully formed from the code { "name":"Hierarchy", "children":[ { "name":"America", "children":[ { "name":"Kansas", "children":[{"name":"Jacob"},{"name":"Jeen"}]}]}, { "name":"Pakistan", "children":[ { "name":"Lahore", "children": [ {"name":"tahir"},{"name":"bilal"}]}, { "name":"Islamabad", "children":[{"name":"fakhar"}]}, { "name":"Karachi", "children":[{"name":"eden"}]}]}, { "name":"India", "children": [ { "name":"d", "children": [ {"name":"ali"}]}, { "name":"Banglore", "children":[{"name":"PP"},{"name":"JJ"}]}]}]} Now the orignal problem is that currently i am solving this problem for data of array of three keys and i have to go for 3 nested loops now i want to optimize this solution so that if data array of object has more than 3 key say 5 {country :"America", state:"NewYork",city:"newYOrk",street:"elm", employe:'Jacob'}, or more than my solution will not work and i cannot decide before how many keys will come so i thought recursion may suit best here. But i am horrible in writing recurrsion and the case is also complex. Can some awesome programmer help me writing recurrsion or suggest some other solution.

    Read the article

< Previous Page | 14 15 16 17 18 19 20  | Next Page >