Search Results

Search found 30 results on 2 pages for 'ashraf hussein'.

Page 1/2 | 1 2  | Next Page >

  • Query to retrieve records by aplhabetic order, except for n predefined items which must be on top

    - by Ashraf Bashir
    I need to retrieve all records ordered alphabetically. Except for a predefined list of record's columns which their records should appear first in a given predefined order, then all other records should be sorted alphabetically based on the same column For instance, assume we have the following table which is called Names Lets assume the predefined list is ("Mathew", "Ashraf", "Jack"). I.e. these are the names of whom their records should be listed first as in the predefined order. So the desired query result should be: Which query could retrieve this custom order ? P.S, I'm using MySQL. Here's my trial based on comments' request: (SELECT * FROM Names WHERE Name in ('Mathew', 'Ashraf', 'Jack')) UNION (SELECT * FROM Names WHERE Name NOT IN ('Mathew', 'Ashraf', 'Jack') ORDER BY Name ASC); the first query result wasn't ordered as required.

    Read the article

  • wubi would not uninstalling

    - by swaleh hussein
    I installed wubi 12.04 with a username and password. It installed successfully but when I tried logging in, it said my password was incorrect. I then decided to uninstall but it kept giving me this error message: An error occurred: Permission denied For more information, please see the log file: c:\users\optimus\appdata\local\temp\wubi-12.04-rev266.log how can I then uninstall wubi from my laptop? Kindly assist.

    Read the article

  • What is wrong with the following Fluent NHibernate Mapping ?

    - by ashraf
    Hi, I have 3 tables (Many to Many relationship) Resource {ResourceId, Description} Role {RoleId, Description} Permission {ResourceId, RoleId} I am trying to map above tables in fluent-nHibernate. This is what I am trying to do. var aResource = session.Get<Resource>(1); // 2 Roles associated (Role 1 and 2) var aRole = session.Get<Role>(1); aResource.Remove(aRole); // I try to delete just 1 role from permission. But the sql generated here is (which is wrong) Delete from Permission where ResourceId = 1 Insert into Permission (ResourceId, RoleId) values (1, 2); Instead of (right way) Delete from Permission where ResourceId = 1 and RoleId = 1 Why nHibernate behave like this? What wrong with the mapping? I even tried with Set instead of IList. Here is the full code. Entities public class Resource { public virtual string Description { get; set; } public virtual int ResourceId { get; set; } public virtual IList<Role> Roles { get; set; } public Resource() { Roles = new List<Role>(); } } public class Role { public virtual string Description { get; set; } public virtual int RoleId { get; set; } public virtual IList<Resource> Resources { get; set; } public Role() { Resources = new List<Resource>(); } } Mapping Here // Mapping .. public class ResourceMap : ClassMap<Resource> { public ResourceMap() { Id(x => x.ResourceId); Map(x => x.Description); HasManyToMany(x => x.Roles).Table("Permission"); } } public class RoleMap : ClassMap<Role> { public RoleMap() { Id(x => x.RoleId); Map(x => x.Description); HasManyToMany(x => x.Resources).Table("Permission"); } } Program static void Main(string[] args) { var factory = CreateSessionFactory(); using (var session = factory.OpenSession()) { using (var tran = session.BeginTransaction()) { var aResource = session.Get<Resource>(1); var aRole = session.Get<Role>(1); aResource.Remove(aRole); session.Save(a); session.Flush(); tran.Commit(); } } } private static ISessionFactory CreateSessionFactory() { return Fluently.Configure() .Database(MsSqlConfiguration.MsSql2008 .ConnectionString("server=(local);database=Store;Integrated Security=SSPI")) .Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>() .Conventions.Add<CustomForeignKeyConvention>()) .BuildSessionFactory(); } public class CustomForeignKeyConvention : ForeignKeyConvention { protected override string GetKeyName(FluentNHibernate.Member property, Type type) { return property == null ? type.Name + "Id" : property.Name + "Id"; } } Thanks, Ashraf.

    Read the article

  • Unix LVM: how to resize root lvm

    - by Hussein Sabbagh
    I took over a virtual server at work after a co-worker left. He, however, setup the server incorrectly at multiple stages and im cleaning them up as I run into them... Currently I realized that the file system is broken in half onto 2 logical volumes both at 50gb. One is mounted as the root directory and the other as the /home directory. Saddly, the server has taken up 46gb of the root lv and i need to expand it. I have already shrunk and remounted the home lv. I resized the root lv, but I can't figure out how to unmount the root directory while the computer is on. Obviously this needs to be done before I can finalize the expansion, but I don't know how. I'd appreciate any help or pointing in the right direction. Thanks in advance. PS this is on a CentOS server.

    Read the article

  • Nginx redirects

    - by Ibrahim Hussein
    Let's say i have a virtual host in Nginx wtih name www.domain.com and root directory named public. Inside public i have 2 dirs dir1 and dir2. How i redirect the request to www.domain.com to dir1? I know it's a simple question, but i am new to nginx.

    Read the article

  • scheck_sip in nagios

    - by hussein abou esber
    hi when i try to check A SIP account the command returns (SIP timeout:No response from SIP server after 15 second) remark :the same result is observed on the nagios web interface and if i try from the command line it is the same any body had a solution plz im in a such a hurry since im preparing a project to be presented in my college thanks

    Read the article

  • Internet Explorer ignoring PHP setcookie() from CentOS server

    - by Hussein Sabbagh
    In the past we used a windows XAMPP server for an internal website. It worked fine but had some intermittent issues and we decided to move to a LAMP server on CentOS. We made the switch today but it turns out Internet Explorer ignores every attempt I make at saving a cookie. There is no underscore in the URL being used... the URL is actually the same as the one the XAMPP server used, where I was able to save cookies without any problems. It really doesn't make any sense to me, all of the code is the same. The only thing to change is the version of PHP and the server OS. The website works on all other browsers except IE. I can't even make a simple setcookie call. On a blank test page I use setcookie("test", "test", time()+36000, "/"); sleep(5); print_r($_COOKIE); and there is nothing there. Our users can't log into the website because of this and I have no idea what the issue is. If anyone can provide any clues or resolutions I would greatly appreciate it. Obviously the easy answer is to not use IE, but that is not an option in this case.

    Read the article

  • Can TP-Link router make phone calls?

    - by Umair Ashraf
    I have a TP-Link router with DSL service provided by a local company which serves it over the landline phone. My landline cord is plugged into an ethernet router which is then plugged into TP-Link wireless router. I can access internet with this wireless router all over my home with all computers. Landline Cord [into] Ethernet Router [into] TP-Link Wireless Router [air] Computers I would add that landline cord is also into a phone device which I use to make calls and that's not cordless. Now I am accessing internet via WiFi on my laptop and want to ask if is this possible to make landline calls via this same computer I am surfing internet through? What I am asking it to a dial-up via TP-Link router that goes through landline. You see the landline cord is the actual data gateway and is also used to make calls. So it can simultaneously send Data and Voice over the same wire.

    Read the article

  • codility challenge, test case OK , Evaluation report Wrong Answer

    - by Hussein Fawzy
    the aluminium 2014 gives me wrong answer [3 , 9 , -6 , 7 ,-3 , 9 , -6 , -10] got 25 expected 28 but when i repeated the challenge with the same code and make case test it gives me the correct answer Your test case [3, 9, -6, 7, -3, 9, -6, -10] : NO RUNTIME ERRORS (returned value: 28) what is the wrong with it ??? the challenge :- A non-empty zero-indexed array A consisting of N integers is given. A pair of integers (P, Q), such that 0 = P = Q < N, is called a slice of array A. The sum of a slice (P, Q) is the total of A[P] + A[P+1] + ... + A[Q]. The maximum sum is the maximum sum of any slice of A. For example, consider array A such that: A[0] = 3 A[1] = 2 A[2] = -6 A[3] = 3 A[4] = 1 For example (0, 1) is a slice of A that has sum A[0] + A[1] = 5. This is the maximum sum of A. You can perform a single swap operation in array A. This operation takes two indices I and J, such that 0 = I = J < N, and exchanges the values of A[I] and A[J]. To goal is to find the maximum sum you can achieve after performing a single swap. For example, after swapping elements 2 and 4, you will get the following array A: A[0] = 3 A[1] = 2 A[2] = 1 A[3] = 3 A[4] = -6 After that, (0, 3) is a slice of A that has the sum A[0] + A[1] + A[2] + A[3] = 9. This is the maximum sum of A after a single swap. Write a function: class Solution { public int solution(int[] A); } that, given a non-empty zero-indexed array A of N integers, returns the maximum sum of any slice of A after a single swap operation. For example, given: A[0] = 3 A[1] = 2 A[2] = -6 A[3] = 3 A[4] = 1 the function should return 9, as explained above. and my code is :- import java.math.*; class Solution { public int solution(int[] A) { if(A.length == 1) return A[0]; else if (A.length==2) return A[0]+A[1]; else{ int finalMaxSum = A[0]; for (int l=0 ; l<A.length ; l++){ for (int k = l+1 ; k<A.length ; k++ ){ int [] newA = A; int temp = newA[l]; newA [l] = newA[k]; newA[k]=temp; int maxSum = newA[0]; int current_max = newA[0]; for(int i = 1; i < newA.length; i++) { current_max = Math.max(A[i], current_max + newA[i]); maxSum = Math.max(maxSum, current_max); } finalMaxSum = Math.max(finalMaxSum , maxSum); } } return finalMaxSum; } } } i don't know what's the wrong with it ??

    Read the article

  • online MBA or MASTER studying

    - by Hussein Belal
    Hi all, would you please advice me to the best universities for online studying, I have graduated form Economic college and I really want to complete my high studying but the problem I can't since I am already working and there is no possibility to stop working for studying. thanks in advance.

    Read the article

  • ios saving uilabel and uiimageview as uiimage

    - by Ashraf Hussein
    I'm trying to add text to an image bu adding a uilabel as subview to a uiimageview I already did that but I want to save them as an image I'm using render in context but it's not working here's my code UIImage * img = [UIImage imageNamed:@"IMG_1650.JPG"]; float x = (img.size.width/imageView.frame.size.width) * touchPoint.x; float y = (img.size.height/imageView.frame.size.height) * touchPoint.y; CGPoint tpoint = CGPointMake(x, y); UIFont *font = [UIFont boldSystemFontOfSize:30]; context = UIGraphicsGetCurrentContext(); UIGraphicsBeginImageContextWithOptions(img.size, YES, 0.0); [[UIColor redColor] set]; for (UIView * view in [imageView subviews]){ [view removeFromSuperview]; } UILabel * lbl = [[UILabel alloc]init]; [lbl setText:txt]; [lbl setBackgroundColor:[UIColor clearColor]]; CGSize sz = [txt sizeWithFont:lbl.font]; [lbl setFrame:CGRectMake(touchPoint.x, touchPoint.y, sz.width, sz.height)]; lbl.transform = CGAffineTransformMakeRotation( -M_PI/4 ); [imageView addSubview:lbl]; [imageView bringSubviewToFront:lbl]; [imageView setImage:img]; [imageView.layer renderInContext:UIGraphicsGetCurrentContext()]; [lbl.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage * nImg = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(nImg, nil, nil, nil); THX

    Read the article

  • how I can overcome this error C2679: binary '>>' : no operator found which takes a right-hand oper

    - by hussein abdullah
    #include <iostream> using std::cout; using std::cin; using std::endl; #include <cstring> void initialize(char[],int*); void input(const char[] ,int&); void print ( const char*,const int); void growOlder (const char [], int* ); bool comparePeople(const char* ,const int*,const char*,const int*); int main(){ char name1[25]; char name2[25]; int age1; int age2; initialize (name1,&age1); initialize (name2,&age2); print(name1,age1); print(name2,age2); input(name1,age1); input(name2,age2); print(name1,age1); print(name2,age2); growOlder(name2,&age2); if(comparePeople(name1,&age1,name2,&age2)) cout<<"Both People have the same name and age "<<endl; return 0; } void input(const char name[],int &age) { cout<<"Enter a name :"; cin>>name ; cout<<"Enter an age:"; cin>>age; cout<<endl; } void initialize ( char name[],int *age) { name[0]='\0'; *age=0; } void print ( const char name[],const int age ) { cout<<"The Value stored in variable name is :" <<name<<endl <<"The Value stored in variable age is :" <<age<<endl<<endl; } void growOlder(const char name[],int *age) { cout<< name <<" has grown one year older\n\n"; *age++; } bool comparePeople (const char *name1,const int *age1, const char *name2,const int *age2) { return(*age1==*age2 && !strcmp(name1,name2)); }

    Read the article

  • how to solve the errors of this program

    - by hussein abdullah
    include using std::cout; using std::cin; using std::endl; include void initialize(char[],int*); void input(const char[] ,int&); void print ( const char*,const int); void growOlder (const char [], int* ); bool comparePeople(const char* ,const int*,const char*,const int*); int main(){ char name1[25]; char name2[25]; int age1; int age2; initialize (name1,&age1); initialize (name2,&age2); print(name1,*age1); print(name2,*age2); input(name1,age1); input(name2,age2); print(&name1,&age1); print(&name2,&age2); growOlder(name2,age2); if(comparePeople(name1,&age1,name2,&age2)) cout<<"Both People have the same name and age "<<endl; return 0; } void input(const char name[],int &age) { cout<<"Enter a name :"; cinname ; cout<<"Enter an age:"; cin>>age; cout<<endl; } void initialize ( char name[],int *age) { name=""; age=0; } void print ( const char name[],const int age ) { cout<<"The Value stored in variable name is :" < void growOlder(const char name[],int *age) { cout<< name <<" has grown one year older\n\n"; *age++; } bool comparePeople (const char *name1,const int *age1, const char *name2,const int *age2) { return(age1==age2 &&strcmp(name1,name2)); }

    Read the article

  • Validation does not work when I use Validator.TryValidateObject.

    - by ashraf
    DataAnnotations does not work with buddy class. The following code always validate true. Why ? var isValid = Validator.TryValidateObject(new Customer(), Context, results, true); and here is the buddy class. public partial class Customer { public string Name { get; set; } public int Age { get; set; } } [MetadataType(typeof(CustomerMetaData))] public partial class Customer { public class CustomerMetaData { [Required(ErrorMessage = "You must supply a name for a customer.")] public string Name { get; set; } } } Here is another thread with same question., but no answer. link text

    Read the article

  • Error when updating BlackBerry JDE Plug-in for Eclipse (v5.0 Beta 3) ?

    - by Ashraf Bashir
    I tried to update Blackberry JDE plug-in for eclipse from v4.5 to v5.0 Beta 3. I followed the instructions in this page: http://na.blackberry.com/eng/developers/devbetasoftware/updatesite.jsp but unfortunately I got the following error while updating: An error occurred while collecting items to be installed. No repository found containing: net.rim.eide.feature.componentpack5.0.0/org.eclipse.update.feature/5.0.0.14 How this could be solved ? Any suggestions ?

    Read the article

  • Scala type conversion error, need help!

    - by Mansoor Ashraf
    Hello I am getting a weird error when trying to use a Java map in Scala. This is the snippet of code val value:Double = map.get(name) if (value eq null) map.put(name, time) else map.put(name, value + time) the map is defined as val map=new ConcurrentHashMap[String,Double] and this is the error I am getting error: type mismatch; found : Double required: ?{val eq: ?} Note that implicit conversions are not applicable because they are ambiguous: both method double2Double in object Predef of type (Double)java.lang.Double and method doubleWrapper in object Predef of type (Double)scala.runtime.RichDouble are possible conversion functions from Double to ?{val eq: ?} if (value eq null) map.put(name, time) I am new to Scala so I am having a hard time parsing the stacktrace. Any help would be appreciated

    Read the article

  • Performance Hosting under WAS vs Host as Service?

    - by ashraf
    I have some performance issue when I host WCF service (net.tcp) under WAS (IIS 7). It is working fine when I host service under console application. The issue is WCF Become Slow After Being Idle For 15 Seconds and a solution. After applying Wenlong Dong workaround delay is gone, but it does not work in WAS (IIS 7). I tried to put "ThreadPoolTimeoutWorkaround.DoWorkaround()" in static AppInitialize() as suggested here, still no luck. Thanks

    Read the article

  • Optimize code perfromance when odd/even threads are doing different things in CUDA

    - by Ashraf
    Hi all! I have two large vectors, I am trying to do some sort of element multiplication, where an even-numbered element in the first vector is multiplied by the next odd-numbered element in the second vector .... and where the odd-numbered element in the first vector is multiplied by the preceding even-numbered element in the second vector Ex. vector 1 is V1(1) V1(2) V1(3) V1(4) vector 2 is V2(1) V2(2) V2(3) V2(4) V1(1) * V2(2) V1(3) * V2(4) V1(2) * V2(1) V1(4) * V2(3) I have written a Cuda code to do this: (Pds has the elements of the first vector in shared memory, Nds the second Vector) //instead of using %2 .. i check for the first bit to decide if number is odd/even -- faster if ((tx & 0x0001) == 0x0000) Nds[tx+1] = Pds[tx] * Nds[tx+1]; else Nds[tx-1] = Pds[tx] * Nds[tx-1]; __syncthreads(); Is there anyway to further accelerate this code or avoid divergence .. Thanks

    Read the article

  • Macintosh XCode Sharing

    - by Umair Ashraf
    I got a macbook pro and I want to share it with some of my friend located at the other side of internet. He can use Internet. Now I want him to give access to my whole Macbook (XCode for most) so he can do developments at his location using my macbook. Now I need to ask is there a way we can both utilize the samme macbook having two virtual OS (one for me and one for him) without affecting each others' privacy? Is it possible to share the macbook across more than 1 user? I don't mean Remote Desktop like of thing in Windows.

    Read the article

  • What's wrong with this JAVA code for android?

    - by Umair Ashraf
    I have written this piece of code to break an image into 9 pieces and it gives me runtime error. There is no error in LogCat and I am stuck. The error comes at line 7 line from bottom (Bitmap.createBitmap(...);). public Bitmap[] getPieces(Bitmap bmp) { Bitmap[] bmps = new Bitmap[9]; int width = bmp.getWidth(); int height = bmp.getHeight(); int rows = 3; int cols = 3; int cellHeight = height / rows; int cellWidth = width / cols; int piece = 0; for (int x = 0; x <= width; x += cellWidth) { for (int y = 0; y <= height; y += cellHeight) { Bitmap b = Bitmap.createBitmap(bmp, x, y, cellWidth, cellHeight, null, false); bmps[piece] = b; piece++; } } return bmps; }

    Read the article

  • PHP Missing Function In Older Version

    - by Umair Ashraf
    My this PHP function converts a datetime string into more readable way to represent passed date and time. This is working perfect in PHP version 5.3.0 but on the server side it is PHP version 5.2.17 which lacks this function. Is there a way I can fix this efficiently? This is not only a function which needs this "diff" function but there are many more. public function ago($dt1) { $interval = date_create('now')->diff(date_create($dt1)); $suffix = ($interval->invert ? ' ago' : '-'); if ($v = $interval->y >= 1) return $this->pluralize($interval->y, 'year') . $suffix; if ($v = $interval->m >= 1) return $this->pluralize($interval->m, 'month') . $suffix; if ($v = $interval->d >= 1) return $this->pluralize($interval->d, 'day') . $suffix; if ($v = $interval->h >= 1) return $this->pluralize($interval->h, 'hour') . $suffix; if ($v = $interval->i >= 1) return $this->pluralize($interval->i, 'minute') . $suffix; return $this->pluralize($interval->s, 'second') . $suffix; }

    Read the article

1 2  | Next Page >