w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Cant create array with information I need
Your problem (aside from code typos) is revealed in your comment: I created and initialized the variable outside, and I am modifying the student after each student information has gone through and student is replaced with new student information You only have one student object which you add repeatedly to the same array, changing it's data each time you pass through the loop. The array ends up containing a sequence of pointers to the same single student object, which only contains data from the last iteration through the loop. You need to create and initialise a new student object on each loop. That student object will get added to the array, then next time through the loop you will make a new student object to hold the next student's data. Aside from that your code contains errors

Categories : Iphone

Visual Basic - Storing information from an array to a two dimensional array
Here's one approach: Module Module1 Public Map As New List(Of List(Of Char)) Public Sub Main() CreateMap() DisplayMap() Console.ReadLine() End Sub Public Sub DisplayMap() Console.Clear() ' this demonstrates how you can access each char separately: For y As Integer = 0 To Map.Count - 1 For x As Integer = 0 To Map(y).Count - 1 Console.SetCursorPosition(x, y) Console.Write(Map(y)(x)) Next Next ' ... or you could do ... Console.Clear() ' this demonstrates how you can convert each row to a string For y As Integer = 0 To Map.Count - 1 Console.SetCursorPosition(0, y) Console.Write(New String(Map(y).ToArray))

Categories : Arrays

How to create PIP (Policy Information Point) in WSO2IS 4.1.0
There are some config file and API changes with Identity server 4.x.x version. It seems to be that blog post has been updated by mentioning it [1]. Please check it again. However you can find the sample from here [2] [1] http://xacmlinfo.com/2011/12/18/writing-jdbc-pip-module/ [2] https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.0.0/components/identity/org.wso2.carbon.identity.samples.entitlement.pip/

Categories : Wso2

Python: how to create a file .txt and record information in it
You can use the open built-in to get a file object with writing permissions, and then fill the content using the write function: file = open('<FILENAME>.txt', 'w') file.write('first line ') file.write('second line ') file.close() Check out the linked docs for more info about the open arguments and other useful functions like writelines.

Categories : Python

Should I create 2 tables: first for usernames and passwords, and other for user information like dob, name, etc?
In most cases you should use a separate table to store user attributes. The way I typically do this is with a User table and a UserProfile table. The user table typically contains username, password, last login time, etc that's related to logging into the website. The profile typically has things like name, email address, dob, etc. I can't speak on the optimization part of things but I can speak on the organization side of things. This layout keeps things much cleaner in the long run. If you're sifting through records, it's much easier to have all "login related" things on one side, and "profile related" on another. It also just smells bad to have everything grouped into one table. How is a user's dob related to their login credentials? They're not, really. Just put a foreign key field

Categories : Mysql

How do I create a Google Script to move information from one sheet to another?
I would start by working through the spreadsheet tutorial for reading/writing. It should walk you through creating the script and the code to access your spreadsheets. From there you might figure out what more specific questions you have: https://developers.google.com/apps-script/guides/sheets

Categories : Google Apps Script

How to create a view which has consolidated information from multiple tables?
One way of doing it is using correlated sub-queries in CASE statements: SELECT * , CASE WHEN EXISTS (SELECT * FROM dbo.Member m WHERE m.TeamID = t.TeamID AND m.Age > 35) THEN 1 ELSE 0 END AS IsAbove35 , CASE WHEN (SELECT SUM(Earned) FROM Job j WHERE j.TeamID = t.TeamID) > 0 THEN 1 ELSE 0 END AS HasEarnings , CASE WHEN EXISTS (SELECT * FROM Job j WHERE j.TeamID = t.TeamID AND Status = 'Complete') AND NOT EXISTS (SELECT * FROM Job j WHERE j.TeamID = t.TeamID AND Status <> 'Complete') THEN 1 ELSE 0 END AS AllJobsComplete FROM dbo.Team t SQLFiddle DEMO

Categories : SQL

How to use an html form to gather information to create a link
Try writing a dynamic web page where the link in the HTML is constructed on the server-side based on the information provided in your form on the previous page. Some popular dynamic web page languages are JSP, ASP, and PHP. Note that dynamic web pages have to be hosted on a web server.

Categories : HTML

Is it possible to create group_id using repeating text information from another column
You could try to use HEX function: SELECT id, HEX(Text) as group_id, Text FROM Tbl If you want decimal value, you can conver it from hex: SELECT id, CONV(HEX(Text), 16, 10) as group_id, Text FROM Tbl Result: ID GROUP_ID TEXT 1 5128769 NBA 2 5128769 NBA 3 5130316 NHL 4 5130312 NHH 5 5130316 NHL 8 4342081 BAA 9 4342081 BAA SQLFiddle

Categories : Mysql

Create a console like information display in a windows form
You could use a multiline textbox and then make it read only and uneditable. You'd just append the line and add carriage returns ( ) TextBox1.text += "More text" + " ";

Categories : C#

how long does it take to create an Azure Cloud Service? How to view log information?
Something "bad" has happened. Service Spin up time should be at most a few minutes. I've seen it take up to 10-15 minutes depending on the hosting center and the number of scaled instances that need to come up but 10 hrs something has definitely gone wrong. I would delete the service and start again. If you experience the same problem, have a look in your service start up code and make sure that there's no exceptions/infinite loops, other problems in there that might be causing problems.

Categories : Azure

Getting indices from numpy array and applying to 2nd lower dimensional array to create new array
This should do the trick: levs_low=levs[k_low] >>> Gamma=np.random.rand(20,7,90,144) >>> k_low = np.argmax(Gamma > .3, axis=1) >>> levs=np.random.rand(7) >>> levs_low=levs[k_low] >>> levs_low.shape (20, 90, 144) For a small example: >>> g=np.random.randint(0,5,(4,4)) >>> g array([[2, 0, 2, 2], [2, 0, 1, 0], [3, 3, 0, 3], [3, 0, 4, 4]]) >>> k=np.arange(5)*-1 >>> k array([ 0, -1, -2, -3, -4]) >>> k[g] #Uses indices of g to select values from k. Also same as np.take(k,g) array([[-2, 0, -2, -2], [-2, 0, -1, 0], [-3, -3, 0, -3], [-3, 0, -4, -4]]) @Saullo Castro's answer is interesting. Strange that there would be a ~5x difference in timings between

Categories : Python

Information about dtype of array
I don't think NumPy provides such a function. Just define the function yourself, put it in a module, and import it as necessary. Note that in general using bare except is a bad practice. Using except ValueError here would be better.

Categories : Python

How do I retrive information from this array?
The only thing remaining is to "undo" the following calls to get ppUnmanagedBuffer to point to the type of data you are expecting: GCHandle handle = GCHandle.Alloc(p_Buffer, GCHandleType.Pinned); IntPtr ppUnmanagedBuffer = (IntPtr)handle.AddrOfPinnedObject(); If C# has managed to give you the equivalent of int** by this mechanism, then you need to dereference it once to get an equivalent to int[], like so: Marshal.Copy((IntPtr)(GCHandle.FromIntPtr(ppUnmanagedBuffer).target), arrayRes, 0, word_count); (The syntax may be off a bit, but that's the general idea...)

Categories : C#

Accessing information in array
Change the query, like, $query = "SELECT * FROM movies WHERE title LIKE " . $db->quote($search); use limit, $query = "SELECT * FROM movies WHERE title LIKE " . $db->quote($search) limit $start,$numbers; http://php.about.com/od/mysqlcommands/g/Limit_sql.htm

Categories : PHP

Check information from another array
Try the single SQL query for this and then try with one while loop. Select A.gossip from gossips A, circle B where A.userid=B.idto and B.idfrom="{$pageuserid}" order by A.id DESC; NOTE: you can also compare the COOKIE value by adding the extra comparison on the query, like and B.userid=$_COOKIE["id"] (better to save the cookie value in a variable)

Categories : PHP

CodeIgnighter array information
$back, in your view, is an array. You're going to need to access the specific item by index <?=$back[0]->back_photo?>, or change the signature of custom_query to only return one item.

Categories : PHP

How to create a view model object that gets information from multiple database tables
If you have created an entity framework model from your database schema you should have: An AccountDefinition class with an AccountDefinition.SDOrganization reference navigation property because the relationship between the two is apparently one-to-one A SDOrganization.AaaPostAddresses collection navigation property because the relationship is many-to-many. The SDOrgPostalAddr table should not appear as model entity because it is only the many-to-many link table With this model and changing your view model to... public class CustomerDetails { public AccountDefinition AccountDefinition {get; set;} public SDOrganization SDOrganization {get; set;} public ICollection<AaaPostalAddress> AaaPostalAddresses { get; set; } } ...you should be able to get the result using: v

Categories : C#

When finished create user using (CreateUserWizard control) add profile information in the same process
After creating the User, You need to fetch the profile of recently created user to start updating values. Since No profile is Loaded, it won't allow to set these values for anonymous users. string strUsername = (sender as CreateUserWizard).UserName; ProfileCommon p = Profile.GetProfile(strUsername); //update the field and save p.AdminAddress= txtAdminAddress.Text; p.Save(); The ProfileBase object (provided by the Page.Profile property) includes a useful GetProfile() function that retrieves, by user name, the profile information for a specific user. GetProfile() returns a ProfileCommon object. [ Note: The profile properties set in Config file doesn't allow setting values for Anonymous users. If you want to allow this for anonymous users also use: <add name="AdminAddress" type="Sy

Categories : Asp Net

Need to create and write information entered by user in swing application to a file
Not quite sure about the spinner object question as it's been quite some time since I've used it, but as for writing to a file: public void writeToFile() { try { String content = "This is the content to write into file"; File file = new File("filename.txt"); // if file doesnt exists, then create it if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(content); bw.close(); System.out.println("Done writing to file."); } catch (IOException e) { e.printStackTrace(); } } Please reply if there are any problems. S

Categories : Java

Manipulating information stored in array
So, this line: sw.WriteLine("{0}, {1}", seqNum2, answer); outputs System.String[], NaN. seqNum2 is an array, that's why you get System.String[] in the output. You probably wanted seqNum2[i] if you want to see the element of seqNum2 which is currently being processed. Of course, since you are not initializing the array elements (see below), even with this change you won't see what you expect, as the value is null and it is formatted to an empty string, so you will get , Nan as output. The reason you get NaN in output is line: double answer = (first - second) / first; I guess that first and second are both 0. If only first were 0, you would get Infinity, and otherwise you would get 0. These values are set to 0 most likely because you don't set string values in netOil and netOil2 arr

Categories : C#

Putting Struct information into one big array
Your size calculation for the structInfo array is not really portable - although it's very unlikely in practice, there could be padding between the members of MyDeviceData. short structInfo[100 + 4 + 6]; memcpy(structInfo, devicePtr->powerLevel, 100*sizeof(short)); memcpy(structInfo + 100, devicePtr->unitInfo, 4*sizeof(short)); memcpy(structInfo + 100 + 4, devicePtr->unitSN, 6*sizeof(short)); This is portable. Anything beyond that is probably not. It would of course be good if you had some constants to replace those magic numbers.

Categories : C++

I am trying to create a link on an HTML page using information that a user inputs via JavaScript alert box
What you have is almost correct. var favoriteSiteName = '', favoriteSiteURL = ''; favoriteSiteName = prompt('What is your favorite web site?'); favoriteSiteURL = prompt('What is the URL of that site?'); document.write('<a href="' + favoriteSiteURL + '">' + favoriteSiteName + '</a>'); You were missing the semi-colons to indicate the end of the lines and adding the site name to the link. Also, the h1 and h2 elements don't belong inside the script element. JSFiddle.

Categories : Javascript

Visual Basic enter information in an array
Basically like this .. Dim LName as New List(Of String) Dim LMark as New List(Of Integer) So, if you want to add your textbox into .. LName.Add(Textbox1.Text) LMark.Add(TextBox2.Text) For Next you have to learn about List Of .. I'm sure Mr. Google will help you .. To resulting in ListBox .. better you use ViewListBox with 2 columns ..

Categories : Vb.Net

Using an array of iterators for reading sparse information
If any vector in *train is empty, the corresponding iterator in spikeIt is never initialized - but you are dereferencing and incrementing it anyhow. This exhibits undefined behavior. Further, there is no attempt to prevent iterators from incrementing past the end of their vectors.

Categories : C++

Array to return information in the order it was found
Try this {=INDEX(BX:BX,SMALL(IF(ISNUMBER(BX45:BX599),ROW(BX45:BX599),""),ROW()))} This assumes the range the formula is in starts in row 1. If it starts in another row, use {=INDEX(BX:BX,SMALL(IF(ISNUMBER(BX45:BX599),ROW(BX45:BX599),""),ROW()-x))} where x = starting row number - 1

Categories : Excel

how to create a server which can reply to a SMS from cell phone and search relevant information back to that number?
I think your biggest problem is doing this securely. If someone forgets their password, a safer alternative is to have them reset it after confirming their identity. However, if you want to look into this further, a quick Google search yielded this result: http://research.microsoft.com/en-us/downloads/2bdeb3c6-9945-4804-a9bc-0d53704d35da/

Categories : Sql Server

Adding row and column in a multidimensional array if a new information is being added
I would suggest you to replace the Multidimensional Array with a Dictionary (see this) Using Dicitonary<K, V> you will be able to add "new rows" (KeyValuePairs<K, V> (see this) to be precise), find, remove and modify. They are represented with a unique Key that will give you a value. For example: public class Program { public void Main() { Dictionary<int, Meeting> meetingDictionary = new Dictionary<int, Meeting>(); //`int` on the left will be the key, and `Meeting` on the right is the value //int represents a unique Id of the meet event. //To add a new meeting: var date = new DateTime(2013, 7, 21); //date representor of the meet var meetingA = new Meeting("Obamba Blackinson", date); //object

Categories : C#

A reliable way of sorting an array and passing that information to a view
Your double-loop preserves the order of paintingJobs in customerRecords, though unless you have duplicate customerList ID's, looks somewhat inefficient (why no break?). This means changes to the order of paintingJobs before your double loop will be reflected in customerRecords. Changes after will not. paintingJobs.sort(however); for(var i=0; i<paintingJobs.length; i++) { for(j=0; j<customerList.length; j++) { if (customerList[j].ID == paintingJobs[i].CustomerID) { customerRecords.push(customerList[j]); break; // next paintingJob } } } It looks like the items in customerList are Objects, so if you make a change to an Object in customerList, this change will also appear in customerRecords even after your double loop.

Categories : Javascript

Return information schema column comments into a php array
loop through the query results with a while loop, store the results in an array outside of the scope of the while loop... for example: function table_description($t,$c,$d){ $t = mysql_real_escape_string($t); //prevent sql injection $c = mysql_real_escape_string($c); $sql = "SELECT column_comment,column_name FROM information_schema.columns WHERE table_name = '$t' AND column_name LIKE '$c'"; $query = mysql_query($sql,$d) or die(mysql_error()); $columnArray = array(); while($result = mysql_fetch_array($query)){ $columnArray[] = array('column_comment' => $result['column_comment'], 'column_name' => $result['column_name']); } return $columnArray; } $columnArray[0]['column_name'] would return the column name of the first eleme

Categories : PHP

How to save an array of information coming from a hash in Ruby
Hash's have 2 very nice methods, hash.values hash.keys in your case - h = {"statuses"=>[{"metadata"=>{"result_type"=>"recent", "iso_language_code"=>"tl"}, "lang"=>"tl"}]} p h.values p.keys These output arrays of each type. This might be what you want. Also, this question will very well be closed. 1 Google search reported several Hash to Array SO questions. Ruby Hash to array of values Converting Ruby hashes to arrays

Categories : Ruby

JavaScript to store jquery result set information in an array
you can use $.each to iterate over the elements. var arr = []; $('.option').each(function() { arr.push( $(this).text() ); }); console.log(arr.join()); Check Fiddle You can also use the .map method var arr = $('.option').map(function () { return this.innerHTML }).get().join(); console.log(arr);

Categories : Javascript

How would I create a single landing page so that it displays custom information based off of an agents generated "6-digit code"
I would do it the following way (assuming that you are using just pure php and mysql): Suppose you have the database table agent which has various information about each of the agents stored as table rows. For example: Table agent: id first_name last_name country Then you can write a php function, lets say get_agent_details($agent_id) that will fetch the corresponding record from the mysql database. function get_agent_details($agent_id) { $con = mysql_connect("localhost","mysql_username","mysql_pwd"); if (!$con) { die('Could not connect: ' . mysql_error()); } // Now run your query $agent_data = "SELECT * FROM agent where id=" . $agent_id; mysql_query($agent_data,$con); mysql_close($con); return $agent_data; } Now you can display th

Categories : PHP

How to create a proper list to hold information, permanently save it then be able to edit or delete form CSV file anytime
First usually you do not publish fields //Holds Customer Info. List<Customer> custInfo = new List<Customer>();****THIS ONE******* You would create an property. public List<Customer> CustInfo {get;set;} But you have to instantiate the Property! CustInfo = new List<Customer>(); Also you dont use getter and setter methods in c# (like in java), here you use also properties. // retrieve the customer name public string getCustomerName() { return custName; }//end of getCustomerName method // set the customer name public void setCustomerName(string customerName) { custName = customerName; }//end of setCustomerName method would be public string CustomerName { get{ return custName; } set{ custName = value; } Read here and here for more information

Categories : C#

Does an array of bytes with negative values lose information when converted to String?
Your effectively converting arbitrary byte data into a String. That's not what that constructor is for. The String constructor that takes a byte[] is meant to convert text in the platform default encoding into a String. Since what you have is not text, the behaviour will be "bad". If, for example, your platform default encoding is a 8-bit encoding (such as ISO-8859-*), then you'll "only" get random characters. If your platform default encoding is UTF-8 you'll probably get random characters and some replacement characters for malformed byte sequences. To summarize: don't do that. I can't tell you what to do instead, since it's not obvious what you're trying to achieve.

Categories : Java

fpdf error, Warning: in_array() expects parameter 2 to be array - Cannot modify header information
The problem is your PHP configuration. You are outputting warnings to the output stream. This affects the PDF output. You need to disable the warnings. An easy change would be to go into your php.ini file, and look for "error_reporting" error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING Alternatively you can set it yourself in the PHP code at the top of your file: error_reporting(E_ALL ^ (E_NOTICE | E_WARNING)); http://ca2.php.net/manual/en/function.error-reporting.php Alternatively you could fix the error by initializing $arrSR and $dirct before their use $arrSR = array(); $dirct = array();

Categories : PHP

VBA to Copy Information From a Folder of Files and Compile Information to a Single Workbook
This is not the full code, but it should help you. When you work with multiple workbooks keep track of them. For example start with: Dim CurrWB As Workbook Set CurrWB = ActiveWorkbook Then in the cycle: Dim WB As Workbook For Each StrFile In var Set WB = Workbooks.Open(loc & StrFile) ... WB.Close Next StrFile Inside the cycle you can find the area to copy doing something like: R1 = 1 Do While WB.Sheets("Sheet name").Cells(R, 2) <> "Starting text" R1 = R1 + 1 Loop R2 = R1 + 1 Do While WB.Sheets("Sheet name").Cells(R2, 2) <> "Ending text" R = R + 1 Loop For R = R1 to R2 CurrWB.Sheets("Report").Cells(RReport, 3) = WB.Sheets("Report").Cells(R, 3) RReport = RReport + 1 Next R

Categories : Excel

How to create a variable sized array, pass a variable 2d array to a function and return another 2d array?
You have a memory leak. Why do you creating two arrays instead one? Do like this: char *SpunArray = malloc(image->x * image->y * sizeof(PGMPixel)); Rotate90Array(image->x, image->y, CreatedArray, SpunArray); void Rotate90Array(int width, int height, char *array, char *RotatedArray) { int i = 0; int j = 0; for (i = 0; i < width; i++) { for (j = 0; j < height; j++) { // check this line on correct RotatedArray[i * height + j] = array[j * width + width - i - 1]; } } }

Categories : C

How to create a multi-dimensional array and have a property attached to a class determine where values are in the array? C#
First, you can define your 2d map array like this: int[,] map = new int[5, 5]; See MSDN on Multidimensional Arrays for more. Yes I would suggest putting the map into a class although if you are just learning this stuff do whatever you can to cobble it together in the short term I guess! Second, I think your player could have an X, Y position. So keeping with your style above, maybe add this to your player class: public int x_pos { get; set; } public int y_pos { get; set; } You can then use a function to update his location and afterward say map[player.x_pos, player.y_pos] = 1, or whatever the code for "player" is. Third, consider that maybe a square on your map has lava. And a monster is standing there. Or a certain square is shallow water, and the player is standing

Categories : C#

Reply mail structure information: how to retrieve sent and received information
There's no standard for the structure of a reply email. It's not usually done using multipart email, it just uses human-readable text, often with > prefixes to denote quoted text. This allows replies to be interspersed inline with the quoted material. The only standard features of replies are a couple of headers: In-Reply-To: <ID> and References: <ID1>, <ID2>, <ID3>, ... In-Reply-To contains the message ID of the message that was replied to. References is a growing list of message IDs -- when you reply, you take the original message's reference list and append the ID of the message being replied to at the end. See RFC 5322 for more details about these headers.

Categories : PHP



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