Search Results

Search found 342 results on 14 pages for 'latif mohammad khan'.

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

  • How to I correctly add brackets to this code

    - by Mohammad
    This code removes whites paces, (fyi: it's credited to be very fast) function wSpaceTrim(s){ var start = -1, end = s.length; while (s.charCodeAt(--end) < 33 ); //here while (s.charCodeAt(++start) < 33 ); //here also return s.slice( start, end + 1 ); } The while loops don't have brackets, how would i correctly add brackets to this code? while(iMean){ like this; } Thank you so much!

    Read the article

  • Load a 6 MB binary file in a SQL Server 2005 VARBINARY(MAX) column using ADO/VC++?

    - by Feroz Khan
    How to load a binary file(.bin) of size 6 MB in a varbinary(MAX) column of SQL Server 2005 database using ADO in a VC++ application. This is the code I am using to load the file which I used to load a .bmp file: BOOL CSaveView::PutECGInDB(CString strFilePath, FieldPtr pFileData) { //Open File CFile fileImage; CFileStatus fileStatus; fileImage.Open(strFilePath,CFile::modeRead); fileImage.GetStatus(fileStatus); //Alocating memory for data ULONG nBytes = (ULONG)fileStatus.m_size; HGLOBAL hGlobal = GlobalAlloc(GPTR,nBytes); LPVOID lpData = GlobalLock(hGlobal); //Putting data into file fileImage.Read(lpData,nBytes); HRESULT hr; _variant_t varChunk; long lngOffset = 0; UCHAR chData; SAFEARRAY FAR *psa = NULL; SAFEARRAYBOUND rgsabound[1]; try { //Create a safe array to store the BYTES rgsabound[0].lLbound = 0; rgsabound[0].cElements = nBytes; psa = SafeArrayCreate(VT_UI1,1,rgsabound); while(lngOffset<(long)nBytes) { chData = ((UCHAR*)lpData)[lngOffset]; hr = SafeArrayPutElement(psa,&lngOffset,&chData); if(hr != S_OK) { return false; } lngOffset++; } lngOffset = 0; //Assign the safe array to a varient varChunk.vt = VT_ARRAY|VT_UI1; varChunk.parray = psa; hr = pFileData->AppendChunk(varChunk); if(hr != S_OK) { return false; } } catch(_com_error &e) { //get info from _com_error _bstr_t bstrSource(e.Source()); _bstr_t bstrDescription(e.Description()); _bstr_t bstrErrorMessage(e.ErrorMessage()); _bstr_t bstrErrorCode(e.Error()); TRACE("Exception thrown for classes generated by #import"); TRACE("\tCode= %08lx\n",(LPCSTR)bstrErrorCode); TRACE("\tCode Meaning = %s\n",(LPCSTR)bstrErrorMessage); TRACE("\tSource = %s\n",(LPCSTR)bstrSource); TRACE("\tDescription = %s\n",(LPCSTR)bstrDescription); } catch(...) { TRACE("***Unhandle Exception***"); } //Free Memory GlobalUnlock(lpData); return true; } But when I read the same file using Getchunk function it gives me all 0s but the size of the file I get is same as the one uploaded. Your help will be highly appreciated.

    Read the article

  • Passing a paramter/object to a ruby unit/test before running it using TestRunner

    - by Nahir Khan
    I'm building a tool that automates a process then runs some tests on it's own results then goes to do some other stuff. In trying to clean up my code I have created a separate file that just has the test cases class. Now before I can run these tests, I have to pass the class a couple of parameters/objects before they can be run. Now the problem is that I can't seem to find a way to pass a parameter/object to the test class. Right now I am thinking to generate a Yaml file and read it in the test class but it feels "wrong" to use a temporary file for this. If anyone has a nicer solution that would be great! *********Edit******* Example Code of what I am doing right now: #!/usr/bin/ruby require 'test/unit/ui/console/testrunner' require 'yaml' require 'TS_SampleTestSuite' automatingSomething() importantInfo = getImportantInfo() File.open('filename.yml', 'w') do |f| f.puts importantInfo.to_yaml end Test::Unit::UI::Console::TestRunner.run(TS_SampleTestSuite) Now in the example above TS_SampleTestSuite needs importantInfo, so the first "test case" is a method that just reads in the information from the Yaml file filname.yml. I hope that clears up some confusion.

    Read the article

  • Batch to move files in a folder to another folder?

    - by Mohammad
    Hello People, I want to create a batch file that moves all the files in this directory to its father directory. Like for example if I have a directory " Something " that contains files : ...New Folder/Something And I want to move the files in " Something " to New folder. Is there such a command? Thanks a bunch :)

    Read the article

  • Single user mode in mac

    - by khan
    I want to use the mac in single user mode. I want to use ctags and cscope in that mode. Could anyone help me with the setups required for this. Thank you. All i know is how to go to the single user mode so please tell me in a simple and easy to understand method. My mac is version 10.6(snow leopard)

    Read the article

  • How to detect that azure application is running development fabric?

    - by Hasan Khan
    How can I reliability detect whether my Azure application is running in development fabric and not in 'the cloud' ? RoleEnvironment.IsAvailable is true for both. I want something that is true in only one case. I'm asking this because I want users of my library to be able to use my library for free in dev fabric. Hence manually putting seperate identifier or flag in config file and keeping two configs for dev and deploy is not feasible.

    Read the article

  • android low memory issue

    - by Faisal khan
    1.Start Andorid app in my app there are 10 screens i navigate b/w the screens after that i press home button my app goes on the background now i play with other applications which cause system to run GC press home button select my app come back to my app when i press back button it throws exception and crashes. any idea for quick fix ?

    Read the article

  • Unable to bind with any property of UserControl

    - by Agha Khan
    I looked your answer where I was also using this.DataContext=this. I am unable to convince myself why I have to remove it? But I did In my UserControl control I have 6 int properties (RedCount, GreenCount …) I am using .NET 3.5 and basically I wanted to use StringFormat with Binding. In my xaml file I have 6 Labels with I would like to bind, and I did what exactly you told in last reply. For some strange reasons it didn’t work. I don't know why it does not work. I placed break point in converter where I never hit it. This imples Binding failed.

    Read the article

  • Patch to move files in a folder to another folder?

    - by Mohammad
    Hello People, I want to create a patch file that moves all the files in this directory to its father directory. Like for example if I have a directory " Something " that contains files : ...New Folder/Something And I want to move the files in " Something " to New folder. Is there such a command? Thanks a bunch :)

    Read the article

  • I am unable to upload file to my local host folder in php.

    - by Nauman khan
    Hi, I have the follwing code <form enctype="multipart/form-data" action="upload.php" method="POST"> Please choose a file: <input name="uploaded" type="file" /><br /> <input type="submit" value="Upload" /> </form> <?php $target = "upload/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; } ?> my page is in http://localhost/nausal/upload.php now I am having the follwing error though i have created a folder in site with name upload. Notice: Undefined index: uploaded in C:\wamp\www\Nausal\upload.php on line 15 Notice: Undefined index: uploaded in C:\wamp\www\Nausal\upload.php on line 17 Sorry, there was a problem uploading your file. Please help me I am very new to php. :(

    Read the article

  • 75 to 100% of CPU Usage in WPF?

    - by Khan
    Hi, Whenever application loads and any other usercontrol loads in the application, while loading and rendering the cpu usage touches 80 - 100%. How should i resolve this? Thanks and regards, Ershad

    Read the article

  • combine 2 files with AWK based last colums

    - by mohammad reshad
    i have two files file1 ------------------------------- 1 a t p b 2 b c f a 3 d y u b 2 b c f a 2 u g t c 2 b j h c file2 -------------------------------- 1 a b 2 p c 3 n a 4 4 a i want combine these 2 files based last columns (column 5 of file1 and column 3 of file2) using awk result ---------------------------------------------- 1 a t p 1 a b 2 b c f 3 n a 2 b c f 4 4 a 3 d y u 1 a b 2 b c f 3 n a 2 b c f 4 4 a 2 u g t 2 p c 2 b j h 2 p c

    Read the article

  • Grid does not get auto size wpf

    - by Jasim Khan Afridi
    I have a Grid inside a grid. I want it to to avail maximum size irrespective of window size. Main_Grid should be max width Grid_tool_bar should be max width but infact it is not. I am unable to find the reason. Plz help me out. <Window x:Class="SocialNetworkingApp.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Background="White" WindowStyle="None" HorizontalAlignment="Stretch" WindowState="Normal" AllowsTransparency="True" WindowStartupLocation="CenterScreen"> <Border Margin="0,0,0,0" BorderBrush="Black" BorderThickness="1,1,1,1" > <Grid x:Name="Main_Grid" Background="White" Width="Auto" Height="Auto" Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"> <Grid.RowDefinitions> <RowDefinition Height="30" /> <RowDefinition Height="25"/> <RowDefinition Height="50"/> <RowDefinition Height="Auto"/> <RowDefinition Height="20"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="1*"/> </Grid.ColumnDefinitions> <Grid Name="Title_Bar" Grid.Row="0" VerticalAlignment="Top" ShowGridLines="True" Grid.IsSharedSizeScope="True" MouseDown="Drag_Window" Background="#FF4FA2DA" HorizontalAlignment="Left" Width="766" Height="31"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="30"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="120" /> </Grid.ColumnDefinitions> </Grid> </Grid> </Border> </Window>

    Read the article

  • How to access view items inside a ListView android?

    - by Yasir Khan
    I have ListView. i am successfully able to populate that ListView but what is want now is when user long press on ListItem it should make a button visible which i made invisible when i am populating ListView. here is snippet i have tried. mItemListView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> adapterview, View arg1, int arg2, long arg3) { LinearLayout view=(LinearLayout) mItemListView.getChildAt(arg2); view.getChildAt(0).setVisibility(View.VISIBLE); return false; } }); My adapter is extending BaseAdapter

    Read the article

  • angular bootstrap typeahead bug

    - by Mohammad Akbari
    i use angular bootstrap typeahead (this lib ui-bootstrap-tpls.js ) in my app, when use two typeahead in one scope, only one work well, and other not work, this is my code angular.module('plunker', ['ui.bootstrap']); function TypeaheadCtrl($scope) { $scope.selected = undefined; $scope.selected2 = undefined; $scope.states = ['Alabama', 'Alaska','California', 'Hawaii', 'Wisconsin', 'Wyoming']; } <html ng-app="plunker"> <head> <title></title> <link href="lib/angular-bootstrap/bootstrap.css" rel="stylesheet" /> <script src="lib/angular/angular.js"></script> <script src="lib/angular-bootstrap/ui-bootstrap-tpls-0.3.0.min.js"></script> <script src="app.js"></script> </head> <body> <div class='container-fluid' ng-controller="TypeaheadCtrl"> <pre>Model: {{selected| json}}</pre> <input type="text" ng-model="selected" typeahead="state for state in states | filter:$viewValue"> <input type="text" ng-model="selected2" typeahead="state for state in states | filter:$viewValue"> </div> </body> please check this and help.

    Read the article

  • Java Function Analysis

    - by khan
    Okay..I am a total Python guy and have very rarely worked with Java and its methods. The condition is that I have a got a Java function that I have to explain to my instructor and I have got no clue about how to do so..so if one of you can read this properly, kindly help me out in breaking it down and explaining it. Also, i need to find out any flaw in its operation (i.e. usage of loops, etc.) if there is any. Finally, what is the difference between 'string' and 'string[]' types? public static void search(String findfrom, String[] thething){ if(thething.length > 5){ System.err.println("The thing is quite long"); } else{ int[] rescount = new int[thething.length]; for(int i = 0; i < thething.length; i++){ String[] characs = findfrom.split("[ \"\'\t\n\b\f\r]", 0); for(int j = 0; j < characs.length; j++){ if(characs[j].compareTo(thething[i]) == 0){ rescount[i]++; } } } for (int j = 0; j < thething.length; j++) { System.out.println(thething[j] + ": " + rescount[j]); } } }

    Read the article

  • How to add dimensions to dynamic img elements (Updated)

    - by Mohammad
    I use a Json call to get a list of image addresses, then I add them individually to a div like this. Unfortunately the image dimension is not part of the Json information. <div id="container"> <img src="A.jpg" alt="" /> <img src="B.jpg" alt="" /> ... </div> Do any of you JQuery geniuses know of a code that would flawlessly and dynamically add the true Width and Height to each img element in the container as soon as each individual one is rendered? I was thinking maybe the code could do a image width check width > 0 to evaluate when the image has actually been rendered, then fire. But I wouldn't know how to go about that and make it work stably. How is the best way of going about this? Thank you so much! Update, As the answers point out, adding Width or Height to the elements is pretty routine. The problem here is actually writing a code that would know when to do that. And evaluate that condition for each image not the page as a whole.

    Read the article

  • How to read and save data from text file with variable number of columns in a Matrix in Matlab

    - by khan
    I have a text file with integer values. each row contains information about specific object. But unfortunately each row has different number of column. because of which when i try to use file_content = load('txtfile.txt'); it gives me error message that previous number of columns does not match. i also tried to use fgetl, fscanf, etc function but was unsuccessful. Can anybody give me a piece of code, or help me how to read a txt file and save in matrix in matlab. Three sample rows are given below. 1 1 1 1 1 95 17 54 111 92 17 54 111 92 17 54 111 92 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 54 109 92 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 58 109 96 15 58 109 96 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 58 109 96 15 56 109 94 15 56 109 94 15 58 109 96 15 58 109 96 15 56 109 94 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 17 58 111 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 56 109 94 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 1 1 1 2 96 185 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 15 56 109 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 54 107 92 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 13 56 107 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 54 109 92 15 54 109 92 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 1 1 1 3 186 245 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 56 109 94 15 58 109 96 15 58 109 96 15 58 109 96 15 58 109 96 13 58 107 96 13 56 107 94 13 56 107 94 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 56 107 94 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 58 107 96 13 60 107 98 13 58 107 96 13 58 107 96 15 58 109 96 13 58 107 96 As you can see the rows doesn't have equal number of columns. So how can i read and save it in a Matrix. Any help in this regards will be highly appreciated. Thanks

    Read the article

  • Return numerical array in python

    - by khan
    Okay..this is kind of an interesting question. I have a php form through which user enters values for x and y like this: X: [1,3,4] Y: [2,4,5] These values are stored into database as varchars. From there, these are called by a python program which is supposed to use them as numerical (numpy) arrays. However, these are called as plain strings, which means that calculation can not be performed over them. Is there a way to convert them into numerical arrays before processing or is there something else which is wrong? Helpp!!

    Read the article

  • Fastest way to do a weighted tag search in SQL Server

    - by Hasan Khan
    My table is as follows ObjectID bigint Tag nvarchar(50) Weight float Type tinyint I want to get search for all objects that has tags 'big' or 'large' I want the objectid in order of sum of weights (so objects having both the tags will be on top) select objectid, row_number() over (order by sum(weight) desc) as rowid from tags where tag in ('big', 'large') and type=0 group by objectid the reason for row_number() is that i want paging over results. The query in its current form is very slow, takes a minute to execute over 16 million tags. What should I do to make it faster? I have a non clustered index (objectid, tag, type) Any suggestions?

    Read the article

  • Change Label Control Property Based on Data from SqlDataSource Inside a Repeater

    - by Furqan Muhammad Khan
    I am using a repeater control to populate data from SqlDataSource into my custom designed display-box. <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" OnDataBinding="Repeater_ItemDataBound"> <HeaderTemplate> </HeaderTemplate> <ItemTemplate> <div class="bubble-content"> <div style="float: left;"> <h2 class="bubble-content-title"><%# Eval("CommentTitle") %></h2> </div> <div style="text-align: right;"> <asp:Label ID="lbl_category" runat="server" Text=""><%# Eval("CommentType") %> </asp:Label> </div> <div style="float: left;"> <p><%# Eval("CommentContent") %></p> </div> </div> </ItemTemplate> <FooterTemplate> </FooterTemplate> </asp:Repeater> <asp:SqlDataSource ID="mySqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:myConnectionString %>" SelectCommand="SELECT [CommentTitle],[CommentType],[CommentContent] FROM [Comments] WHERE ([PostId] = @PostId)"> <SelectParameters> <asp:QueryStringParameter Name="PostId" QueryStringField="id" Type="String" /> </SelectParameters> </asp:SqlDataSource> Now, there can be three types of "CommentTypes" in the database. I want to change the CssClass property of "lbl_category" based on the value of [CommentType]. I tried doing this: <asp:Label ID="lbl_category" runat="server" CssClass="<%# Eval("CommentType") %>" Text=""><%# Eval("CommentType") %></asp:Label> But this gives an error: "The server control is not well formed" and haven't been able to find a way to achieve this in the code behind. Can someone please help?

    Read the article

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