Search Results

Search found 4119 results on 165 pages for 'bebe 17'.

Page 124/165 | < Previous Page | 120 121 122 123 124 125 126 127 128 129 130 131  | Next Page >

  • JavaScript text slideshow not working?

    - by I Build Websites
    I'm making a Javascript slideshow for my blog yet the array doesn't seem to be working. Can someone please say what I've been doing wrong <SCRIPT type="text/javascript"> var blog = new Array() blog[0]= "<h4>Sunday 17 of June 2012</h4><p title='Blog'>Donec tempus risus eget ligula viverra eget placerat odio tincidunt. Duis nisl sem, scelerisque faucibus congue vitae, accumsan at lectus. Cras vestibulum arcu ut lorem luctus eu pharetra tortor ultricies. Nam iaculis orci mauris. Etiam luctus, mauris sed adipiscing ullamcorper, augue enim volutpat sem, ut sagittis ipsum nibh ac nulla. Nam ultrices, quam eget sollicitudin porta, sapien mauris pulvinar augue, posuere hendrerit erat ligula ut magna. Maecenas laoreet nisi vitae magna consectetur a mollis purus tristique. Pellentesque elementum arcu non urna convallis eleifend. Aliquam eu lorem sed risus tempus tempor. Donec malesuada velit in odio vulputate iaculis. In tristique neque quis velit posuere adipiscing. Nullam dui neque, scelerisque non egestas feugiat, pellentesque vitae mauris.</p><hr>" and so the array continues till function display1() { document.getElementById(blogShow).innerHTML( blog[0]) } function display2() { document.getElementById(blogShow).innerHTML(blog[1]) } function display3() { document.getElementById(blogShow).innerHTML(blog[2]) } function display4() { document.getElementById(blogShow).innerHTML(blog[3]) } function display5() { document.getElementById(blogShow).innerHTML(blog[4]) } </SCRIPT> <div id="blogShow"> <SCRIPT type="text/javascript">display1()</SCRIPT> </div> <div id="blogNav"> <input type="button" onClick="display2()" value="1" class="button"> <input type="button" onClick="display3()" value="2" class="button"> <input type="button" onClick="display4()" value="3" class="button"> <input type="button" onClick="display5()" value="4" class="button"> </div> I know it's all inline and i will clean up after it works

    Read the article

  • c++ programming- Tryin to get a number within an array that is twice the average

    - by max
    i have been assigned to set up an array with points. I am told to get the maximum value, average, nd within this same array, if any point in the array is twice the average, i should cout an "outlier." So far i have gotten the average and maximum numbers in the array. but i am unable to set the programme to cout the outlier. Instead it gives me a multiple of the average. pls help! here is the programme; int main() { const int max = 10; int ary[max]={4, 32, 9, 7, 14, 12, 13, 17, 19, 18}; int i,maxv; double out,sum=0; double av; maxv= ary[0]; for(i=0; i } cout<<"maximum value: "< for(i=0; i sum = sum + ary[i]; av = sum / max; } cout<<"average: "< out = av * 2; if(ary[i]out) { cout<<"outlier: "< return 0; }

    Read the article

  • csv file upload and update mysql db

    - by Indra
    I am very to new to php. i am using the following code to open a csv file and update my database. i need to check the value of first row-first column of the csv file. if it is matching "some text 1", then i need to run code1, if it is "some text 2", run code2, else code3. I can use if else condition but since i am using while loop It fails. Can anyone help me. $handle = fopen($file_tmp,"r"); while(($fileop = fgetcsv($handle,",")) !== false) { // I need to check here $companycode = mysql_real_escape_string($fileop[0]); $Item = mysql_real_escape_string($fileop[3]); $pack = preg_replace('/[^A-Za-z0-9\. -]/', '', $fileop[4]); $lastmonth = mysql_real_escape_string($fileop[5]); $ltlmonth = mysql_real_escape_string($fileop[6]); $op = mysql_real_escape_string($fileop[9]); $pur = mysql_real_escape_string($fileop[10]); $sale = mysql_real_escape_string($fileop[12]); $bal = mysql_real_escape_string($fileop[17]); $bval = mysql_real_escape_string($fileop[18]); $sval = mysql_real_escape_string($fileop[19]); $sq1 = mysql_query("INSERT INTO `sas` (companycode,Item,pack,lastmonth,ltlmonth,op,pur,sale,bal,bval,sval) VALUES ('$companycode','$Item','$pack','$lastmonth','$ltlmonth','$op','$pur','$sale','$bal','$bval','$sval')"); }

    Read the article

  • AJAX help needed

    - by tharindu
    Hi guys.. i have problem in ajax.. im new comer for ajax...:) <script type="text/javascript"> $(document).ready(function() { $("#bcode").focus(); //prevents autocomplete in some browsers $("#bcode").attr('autocomplete', 'off').keyup(function(event) { var name = $("#bcode").val(); $("#status").empty(); if(name.length > 17 ) { selectAll(); $("#status").html('<img align="absmiddle" src="loading.gif" /> Checking availability...').show(); $.ajax({ type: "POST", url: "namecheck.php", data: "bcode="+ name, success: function(msg) { $("#status").html(msg).show(); } }); } else { $("#status").html('').addClass('err').show(); } }); }); //--> </script> i got text box value 'bcode' using '$_POST['bcode']' <input name="bcode" type="text" class="bcode" id="bcode" maxlength="18"; /> also i have menu/list in that form <select name="pallete" class="list_box" id="select"> <option value="P0" selected> </option> <option value="P1">P1</option> <option value="P2">P2</option> <option value="P3">P3</option> <option value="P4">P4</option> <option value="P5">P5</option> </select> How i can access selected item from php file by using '$_POST['pallete']' please help me. Thanks in advance..

    Read the article

  • Deleting list items via ProcessBatchData()

    - by q-tuyen
    You can build a batch string to delete all of the items from a SharePoint list like this: 1: //create new StringBuilder 2: StringBuilder batchString= new StringBuilder(); 3: 4: //add the main text to the stringbuilder 5: batchString.Append(""); 6: 7: //add each item to the batch string and give it a command Delete 8: foreach (SPListItem item in itemCollection) 9: { 10: //create a new method section 11: batchString.Append(""); 12: //insert the listid to know where to delete from 13: batchString.Append("" + Convert.ToString(item.ParentList.ID) + ""); 14: //the item to delete 15: batchString.Append("" + Convert.ToString(item.ID) + ""); 16: //set the action you would like to preform 17: batchString.Append("Delete"); 18: //close the method section 19: batchString.Append(""); 20: } 21: 22: //close the batch section 23: batchString.Append(""); 24: 25: //preform the batch 26: SPContext.Current.Web.ProcessBatchData(batchString.ToString()); The only disadvantage that I can think of right know is that all the items you delete will be put in the recycle bin. How can I prevent that? I also found the solution like below: // web is a the SPWeb object your lists belong to // Before starting your deletion web.Site.WebApplication.RecycleBinEnabled = false; // When your are finished re-enable it web.Site.WebApplication.RecycleBinEnabled = true; Ref [Here](http://www.entwicklungsgedanken.de/2008/04/02/how-to-speed-up-the-deletion-of-large-amounts-of-list-items-within-sharepoint/) But the disadvantage of that solution is that only future deletion will not be sent to the Recycle Bins but it will delete all existing items as well which user do not want. Any idea to prevent not to delete existing items? Many thanks in advance, TQT

    Read the article

  • Google Maps Controls panel size is displayed wrong

    - by Andrea Giachetto
    I have a weird problem with Google Maps Control. I've tested in a blank page my custom maps with custom markers and everything seems to be ok, also with the control panel. When I tried to import all my code in the page I'm working with ( I use a full screen fluid grid system ) the control panel is displayed with strange size. I tried everything for disable/enable the ui of the Google Maps but the problem remain. The code of my maps are exactly the same, both in my blank page and in my site, but in the site the ui control panel is displayed very strange. Here's the code: <div id="map_canvas2" style="height: 580px; width: 100%;"></div> <script> var image = 'path/to/your/image.png'; var mapOptions = { zoom: 17, center: new google.maps.LatLng(45.499290, 12.621510), mapTypeId: google.maps.MapTypeId.ROADMAP, scrollwheel: false } var map = new google.maps.Map(document.getElementById('map_canvas2'), mapOptions); var myPos = new google.maps.LatLng(45.499290,12.621510); var myMarker = new google.maps.Marker({position: myPos, map: map, icon: 'http://www.factory42.it/jtaca/wordpress/wp-content/uploads/2014/06/pin-map.png' }); </script> </div> Here's an img: http://www.factory42.it/jtaca/wordpress/wp-content/uploads/2014/06/img-maps.png

    Read the article

  • C++ Macro Arithmetric

    - by anon
    I have to do with Macros (it's macros calling macros; so templates are out of the question). Here's what I want: foo(3, a, b1, c1) --> foo1(a, b1, c1); foo(5, a, b1, c1, b2, c2) -> foo2(a, b1, c1, b2, c2); foo(7, a, b1, c1, b2, c2, b3, c3) -> foo3(a, b1, c1, b2, c2, b3, c3); So basically, what I want is to be able to execute the "function" n - (n-1)/2 at macro expansion time. Is this possible? Thanks! [PS, if you dislike my questions; I support your right to downvote; my worst question so far is only -17, so maybe we can break that record; however, please let me know why my question is technically invalid.] Thanks EDIT: Foo takes a variable # of arguments, of the form: foo(N, a1, b1, a2, b2, ... a_N, b_N) -> foo##N(a1, b1, a2, b2, ... a_N, b_N);

    Read the article

  • How do i close a socket after a timeout in node.js?

    - by rramsden
    I'm trying to close a socket after a connection times out after 1000ms. I am able to set a timeout that gets triggered after a 1000ms but I can't seem to destroy the socket... any ideas? var connection = http.createClient(80, 'localhost'); var request = connection.request('GET', '/somefile.xml', {'host':'localhost'}); var start = new Date().getTime(); request.socket.setTimeout(1000); request.socket.addListener("timeout", function() { request.socket.destroy(); sys.puts("socket timeout connection closed"); }); request.addListener("response", function(response) { var responseBody = []; response.setEncoding("utf8"); response.addListener("data", function(chunk) { sys.puts(chunk); responseBody.push(chunk); }); response.addListener("end", function() { }); }); request.end(); returns socket timeout connection closed node.js:29 if (!x) throw new Error(msg || "assertion error"); ^ Error: assertion error at node.js:29:17 at Timer.callback (net:152:20) at node.js:204:9

    Read the article

  • Strange Access Denied warning when running the simplest C++ program.

    - by DaveJohnston
    I am just starting to learn C++ (coming from a Java background) and I have come across something that I can't explain. I am working through the C++ Primer book and doing the exercises. Every time I get to a new exercise I create a new .cpp file and set it up with the main method (and any includes I think I will need) e.g.: #include <list> #include <vector> int main(int argc, char **args) { } and just to make sure I go to the command prompt and compile and run: g++ whatever.cpp a.exe Normally this works just fine and I start working on the exercise, but I just did it and got a strange error. It compiles fine, but when I run it it says Access Denied and AVG pops up telling me that a threat has been detected 'Trojan Horse Generic 17.CKZT'. I tried compiling again using the Microsoft Compiler (cl.exe) and it runs fines. So I went back, and added: #include <iostream> compiled using g++ and ran. This time it worked fine. So can anyone tell me why AVG would report an empty main method as a trojan horse but if the iostream header is included it doesn't?

    Read the article

  • How can I set the Jbuttons in a preferred order?

    - by Umzz Mo
    I have a grid of 30 buttons, and I want to have it from left to right then goes down, right to left, down again left to right. Basically the numbering would be as follow: 1 2 3 4 5 6 7 8 9 10 20 19 18 17 16 15 14 13 12 11 21 22 23 24 25 26 27 28 29 30 So if I have a piece on the button 10 and I instruct it to move up 2 bits it would land on 12 not 19. Below is my Code: //Creates the button using the loop, adds it into the panel and frame. JPanel panel = new JPanel(); panel.setLayout(new GridLayout(3,10)); JButton [] buttons = new JButton[30]; for(int i=0;i<30;i++){ buttons[i] = new JButton("label" + i); buttons[i].setBackground(Color.white); //Puts the player 1 piece on button 1,3,5,7,9 and player 2 piece on button 2,4,6,8,10 if (i < 10) { if (i%2 == 0) { buttons[i].setIcon(piece1); } else { buttons[i].setIcon(piece2); } } panel.add(buttons[i]); } frame.add(panel, BorderLayout.CENTER);

    Read the article

  • File name containing more than 16 characters inside parentheses failing

    - by Tom anMoney
    I am generating file names that contain a timestamp in the following format: "base_name (yyyy-mm-dd hhmmss).ext" This seems to cause a problem on Android. Here's my log: /storage/sdcard0/anMoney/transfer/Net worth over time _ Forecast (2012-11-19 110550).pdf E/Gmail (11802): java.io.FileNotFoundException: /storage/sdcard0/myapp/transfer/Net worth over time _ Forecast (2012-11-19 110550).pdf: open failed: ENOENT (No such file or directory) E/Gmail (11802): at libcore.io.IoBridge.open(IoBridge.java:416) E/Gmail (11802): at java.io.FileInputStream.<init>(FileInputStream.java:78) E/Gmail (11802): at java.io.FileInputStream.<init>(FileInputStream.java:105) E/Gmail (11802): at android.content.ContentResolver.openInputStream(ContentResolver.java:445) E/Gmail (11802): at com.google.android.gm.provider.MailEngine.cacheAttachment(MailEngine.java:3054) E/Gmail (11802): at com.google.android.gm.provider.MailEngine.sendOrSaveDraft(MailEngine.java:2746) E/Gmail (11802): at com.google.android.gm.provider.MailProvider.sendOrSaveDraft(MailProvider.java:477) E/Gmail (11802): at com.google.android.gm.provider.MailProvider.insert(MailProvider.java:534) E/Gmail (11802): at android.content.ContentProvider$Transport.insert(ContentProvider.java:201) E/Gmail (11802): at android.content.ContentResolver.insert(ContentResolver.java:864) E/Gmail (11802): at com.google.android.gm.provider.Gmail$MessageModification.sendOrSaveNewMessage(Gmail.java:3576) E/Gmail (11802): at com.google.android.gm.ComposeActivity$SendOrSaveTask$1.onInitializationComplete(ComposeActivity.java:1765) E/Gmail (11802): at com.google.android.gm.provider.MailEngine$5.run(MailEngine.java:1006) E/Gmail (11802): at android.os.Handler.handleCallback(Handler.java:615) E/Gmail (11802): at android.os.Handler.dispatchMessage(Handler.java:92) E/Gmail (11802): at android.os.Looper.loop(Looper.java:137) E/Gmail (11802): at android.os.HandlerThread.run(HandlerThread.java:60) E/Gmail (11802): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory) Now, if I trim the file name to have only 16 characters within the parentheses, everything is working as expected. I am able to send the file as a GMail attachment. The following file name is working fine: /storage/sdcard0/myapp/transfer/Net worth over time _ Forecast (2012-11-19 11070).pdf I tried the following troubleshooting: It's not the overall length of the file name, as if I shorten the base name, the same behavior remains It's not GMail, uploading the file to Google Drive fails similarly 16 characters inside the parentheses work, but not 17 It's not the space character inside the parentheses that causes the issue, as I replaced it with a dash and it's the same problem. Anybody has any ideas on what's going on here?

    Read the article

  • Choropleth mapping issue in R

    - by chasec
    I am trying to follow the tutorial described here: http://www.thisisthegreenroom.com/2009/choropleths-in-r/ The below code executes, but it is either not matching my dataset with the maps_counties data properly, or it isn't plotting it in the order I would expect. For example, the resulting areas for the greater NYC area show no density while random counties in PA show the highest density. The general format of my data table is: county state count fairfield connecticut 17 hartford connecticut 6 litchfield connecticut 3 new haven connecticut 12 ... ... westchester new york 70 yates new york 1 luzerne pennsylvania 1 Note this data is in order by state and then county and includes data for CT, NJ, NY, & PA. First, I read in my data set: library(maps) library(RColorBrewer) d <- read.table("gissum.txt", sep="\t", header=TRUE) #Concatenate state and county info to match maps library d$stcon <- paste(d$state, d$county, sep=",") #Color bins colors = brewer.pal(5, "PuBu") d$colorBuckets <- as.factor(as.numeric(cut(d$count,c(0,10,20,30,40,50,300)))) Here is my matching mapnames <- map("county",plot=FALSE)[4]$names colorsmatched <- d$colorBuckets [na.omit(match(mapnames ,d$stcon))] Plotting: map("county" ,c("new york","new jersey", "connecticut", "pennsylvania") ,col = colors[d$colorBuckets[na.omit(match(mapnames ,d$stcon))]] ,fill = TRUE ,resolution = 0 ,lty = 0 ,lwd= 0.5 ) map("state" ,c("new york","new jersey", "connecticut", "pennsylvania") ,col = "black" ,fill=FALSE ,add=TRUE ,lty=1 ,lwd=2 ) map("county" ,c("new york","new jersey", "connecticut", "pennsylvania") ,col = "black" ,fill=FALSE ,add=TRUE , lty=1 , lwd=.5 ) title(main="Respondent Home ZIP Codes by County") I am sure I am missing something basic re: the order in which the maps function plots items - but I can't seem to figure it out. Thanks for the help. Please let me know if you need any more information.

    Read the article

  • Fire Box doesnot support program based calling function

    - by manish
    on clicking any row of the following program... i am firinf on function mail file click....function just having alert message that shoes deffrent file name on the bases of clicking... *its working properly in IE .....FireBox N other browser function doesnot call on clicking on any row.. whats problem..please help me......i am writing code for your better awareness* For Each info In fsi Response.Write("<span id=" & " 'userijd'" & " onmouseup=" & "mailfileclick('" & info.Name & "')" & ";>") Response.Write("<td width=" & "16%" & " bgcolor=" & "#FFFFFF" & " style=" & "border-bottom-style:&nbsp;solid;&nbsp;border-bottom-width:&nbsp;1px" & " bordercolor=" & "#C0C0C0" & " nowrap" & ">") Response.Write("<font face=" & "Arial" & "style=" & "font-size:&nbsp;9pt" & " color=" & "#000000" & ">" & Mid(contents, InStr(contents, "Date: ") + Len("Date:"), 17) & "</font></td>") Response.Write("</span>") Next

    Read the article

  • Expose webservice directly to webclients or keep a thin server-side script layer in between?

    - by max
    Hi, I'm developing a REST webservice (Java, Jersey). The people I'm doing this for want to directly access the webservice via Javascript. Some instinct tells me this is not a good idea, but I cannot really explain that instinct. My natural approach would have been to have the webservice do the real logic and database access, but also have some (relatively thin) server-side script layer (e.g. in PHP). Clients would talk to the PHP layer which in turn would talk to the webservice. (The webservice would be pretty local to the apache/PHP server and implicitly trust calls from the script layer. The script layer would take care of session management.) (Btw, I am not talking about just hiding the webservice behind an Apache which simply redirects calls.) But as I find myself at a lack of words/arguments to explain my instinct, I wonder whether my instinct is right - note that while I have been developing all kinds of software in all kinds of languages and frameworks for like 17 years, this is the first time I develop a webservice. So my question is basically: what are your opinions? Are there any standard setups? Is my instinct totally wrong? Or partially? ;P Many thanks, Max PS: I might add a few bits of information about the planned usage of the whole application: will be accessed by different kinds of users, partly general public, partly privileged thus, all major OS/browser combinations can be expected as clients however, writing the client is not my responsibility will potentially have very high load/traffic logic of webservice will later be massively expanded for another product which is basically a superset of the functionality of the current project there is a significant likelihood that at some point an API should be exposed which can be used by 3rd party developers - obviously, with some restrictions at some point, the public view of the product should become accessible via smartphones, too (in other words, maybe a customized version of the site to adapt to the smaller display and different input methods)

    Read the article

  • Add new Formelemts and transform it with jqtransform

    - by user545782
    I'm just trying to change my formfields with jqtransform. With the following Javascript Code, i add new formfields: <script type="text/javascript"> $(function() { var scntDiv = $('#p_scents'); var i = $('#p_scents p').size() + 1; $('#addScnt').live('click', function() { if(i < 4){ $('<p>\n\ <label for="p_scnts">\n\ <input type="text" id="p_scnt" size="17" name="fmac' + i +'[]" value="" />\n\ <select name="fmac' + i +'[]" size="1" id="p_scnt_a">\n\ <option selected value="K">KABEL</option>\n\ <option value="W">WLAN</option>\n\ <option value="V">VPN</option>\n\ </select>\n\ </label>\n\ </p>').appendTo(scntDiv); i++; } if(i > 3 ){ $('#showaddmac').hide(); } return false; }); $('#remScnt').live('click', function() { if( i > 2 ) { $(this).parents('p').remove(); i--; } if(i < 4 ){ $('#showaddmac').show(); } return false; }); }); </script> this works with out problemes, but the new fields will be not transformed. Does anyone know a solution to the problem? Sry for my bad english :)

    Read the article

  • rendering a TextView in a Bitmap for an android widget

    - by foke
    I'm building a widget which displays some text. By widget I mean the kind which lies on the desktop. The problem is that I want to change text's font at runtime. There is several textview I would like, at runtime, to set the first as bold, the second blue and italic for example, etc. I came up with this : TextView tv = new TextView(context); tv.setText(stringToDisplay); tv.setTextColor(0xa00050ff); // example tv.setTextSize(30); // example Bitmap b = loadBitmapFromView(tv); updateViews.setImageViewBitmap(R.id.id_of_the_imageview, b); with private static Bitmap loadBitmapFromView(View v) { Bitmap b = Bitmap.createBitmap(v.getLayoutParams().width, v.getLayoutParams().height, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); v.layout(0, 0, v.getLayoutParams().width, v.getLayoutParams().height); v.draw(c); return b; } but it wont work (NullPointerException on first line of loadBitmap), until I replace v.getLayoutParams().width, v.getLayoutParams().height by fixed sizes like 250, 50 Bitmap b = Bitmap.createBitmap(250, 50, Bitmap.Config.ARGB_8888); // ... v.layout(0, 0, 250, 50); But that's not a good solution ... so I tried this : LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View row = li.inflate(R.layout.widget_text, null); TextView tv = (TextView) row.findViewById(R.id.id_of_the_textview); widget_text being a layout similar to the displayed one but with TextViews instead of ImageViews, in the hope to get some size information out of it .. but it's not working and I get this exception : 01-02 17:35:06.001: ERROR/AndroidRuntime(11025): Caused by: java.lang.IllegalArgumentException: width and height must be > 0 on the call to Bitmap.createBitmap() so, someone could point me in the right direction?

    Read the article

  • segmentation fault while using format string to scan input

    - by Aman Deep Gautam
    consider the code and its result: while ((row = mysql_fetch_row (table_info)) != NULL) { answer='\0'; printf ( "%s: ", row[0] ); scanf ( "%c", &answer ); getchar(); if ( answer == 'y') { printf ( "*****\n" ); table_name[index] = malloc ( strlen(row[0]) + 1 ); printf ( "*****\n" ); memcpy ( &table_name[index], &row[0], strlen(row[0]) + 1 ); } printf ( "finally inserted: %s \n", table_name[index]); } The result on execution: 1_time_access: y ***** ***** finally inserted: 1_time_access 2_time_access: y ***** ***** finally inserted: 2_time_access 39_time_access: y ***** ***** finally inserted: 39_time_access Explanation of result: row[0] has value 1_time_access, 2_time_access, 39_time_access. Now Consider a better way of doing it which is using a format string to escape the \n. I run the following code but it gives segentation fault, I cannot understand why. Code: while ((row = mysql_fetch_row (table_info)) != NULL) { answer='\0'; printf ( "%s: ", row[0] ); scanf ( "%[^\n]%*c", &answer ); if ( answer == 'y') { printf ( "*****\n" ); fflush(stdout); table_name[index] = malloc ( strlen(row[0]) + 1 ); printf ( "*****\n" ); fflush(stdout); memcpy ( &table_name[index], &row[0], strlen(row[0]) + 1 ); } printf ( "finally inserted: %s \n", table_name[index]); fflush(stdout); } Result: 1_time_access: y ***** ./set-env.sh: line 17: 15263 Segmentation fault (core dumped) ./exec dataset_one (do not worry about set-env.sh, it is the script running th program.) I canot understand why this is happening.

    Read the article

  • Finding and marking the largest of three values in a two dimensional array

    - by DavidYell
    I am working on a display screen for our office, and I can't seem to think of a good way to find the largest numerical value in a set of data in a two dimensional array. I've looked at using max() and also asort() but they don't seem to cope with a two dimensional array. I'm returning my data through our mysql class, so the rows are returned in a two dimensional array. Array( [0] => Array( [am] => 12, [sales] => 981), [1] => Array( [am] => 43, [sales] => 1012), [2] => Array( [am] => 17, [sales] => 876) ) I need to output a class when foreaching the data in my table for the AM with the highest sales value. Short of comparing them all in if statements. I have tried to get max() on the array, but it returns an array, as it's look within the dimension. When pointing it at a specific dimension it returns the key not the value. I figured that I could asort() the array and pop the top value off, store it in a variable and then compare against that in my foreach() loop, but that seems to have trouble sorting across two dimensions. Lastly, I figured that I could foreach() the values, comparing them against the previous one each time, untill I found the largest. This approach however means storing every value, luckily only three, but then comparing against them all again. Surely there must be a simpler way to achieve this, short of converting it into a single dimension array, then doing an asort() on that?

    Read the article

  • Run a shell script using cron

    - by Blanca
    Hi! I have this FeedIndexer.sh: #!/bin/sh java -jar FeedIndexer.jar Just to run FeedIndexer.jar which is in the same directory as the .sh, I would like to run it using crontab, so I did this: # /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields, # that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command 17 * * * * root cd / && run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) 01 01 * * * root run-parts --report /home/slosada/workspace/FeedIndexer/target/FeedIndexer.sh # But it doen't work. Have i made any mistake?? Thank you!

    Read the article

  • jQuery : how to determine that a div is scrolled down

    - by subtenante
    I have a div with defined height, and overflow:scroll;. Its content is too long so scrollbars appear. Now for the ichy part. Some of its inner HTML strangely appears all the time (to be precise, the footer of a table generated by the tableFilter plugin). I'd like to make this footer disappear when it is not needed (it actually appears out of the containing <div>'s border). I resolved to make it disappear but setting its z-index to -1000. But I want to make it appear when the containing <div> is totally scrolled down. How can I know the user has scrolled at the bottom ? Using the help from answers below, I used scrollTop attribute but the difference between scrollTop and innerHeight is the size of the scrollbar plus some unidentified delta. A scrollbar is 16 pixels high in most browsers under Windows, but I get a difference of 17 in Firefox and something like 20 in IE, where my <div> content's borders seems to be rendered bigger. A way (actually two ways...) to compute the scrollbar size has been given there.

    Read the article

  • How can I quickly parse large (>10GB) files?

    - by Andrew
    Hi - I have to process text files 10-20GB in size of the format: field1 field2 field3 field4 field5 I would like to parse the data from each line of field2 into one of several files; the file this gets pushed into is determined line-by-line by the value in field4. There are 25 different possible values in field2 and hence 25 different files the data can get parsed into. I have tried using Perl (slow) and awk (faster but still slow) - does anyone have any suggestions or pointers toward alternative approaches? FYI here is the awk code I was trying to use; note I had to revert to going through the large file 25 times because I wasn't able to keep 25 files open at once in awk: chromosomes=(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25) for chr in ${chromosomes[@]} do awk < my_in_file_here -v pat="$chr" '{if ($4 == pat) for (i = $2; i <= $2+52; i++) print i}' >> my_out_file_"$chr".query done

    Read the article

  • Return multiple IDs from a function and use the result in a query

    - by NewK
    I have this function that returns me all children of a tree node: CREATE OR REPLACE FUNCTION fn_category_get_childs_v2(id_pai integer) RETURNS integer[] AS $BODY$ DECLARE ids_filhos integer array; BEGIN SELECT array ( SELECT category_id FROM category WHERE category_id IN ( (WITH RECURSIVE parent AS ( SELECT category_id , parent_id from category WHERE category_id = id_pai UNION ALL SELECT t.category_id , t.parent_id FROM parent INNER JOIN category t ON parent.category_id = t.parent_id ) SELECT category_id FROM parent WHERE category_id <> id_pai ) ) ) into ids_filhos; return ids_filhos; END; and I would like to use it in a select statement like this: select * from teste1_elements where category_id in (select * from fn_category_get_childs_v2(12)) I've also tried this way with the same result: select * from teste1_elements where category_id=any(select * from fn_category_get_childs_v2(12))) But I get the following error: ERROR: operator does not exist: integer = integer[] LINE 1: select * from teste1_elements where category_id in (select *... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. The function returns an integer array, is that the problem? SELECT * from fn_category_get_childs_v2(12) retrieves the following array (integer[]): '{30,32,34,20,19,18,17,16,15,14}'

    Read the article

  • How to query an XML File with E4X in AS3?

    - by yens resmann
    I need to archive a database-driven flash as3 website. I exported a table to xml so now i have something like this: <RECORDS> <RECORD> <id>home</id> <msg>bodytext</msg> <type>0</type> <lastEditDate>0000/0/0 00:00:00</lastEditDate> <lastAccessDate>2009/6/17 11:37:21</lastAccessDate> <timesAccessed>855</timesAccessed> </RECORD> <RECORD> <id>contact</id> <msg>contact body text</msg> <type>0</type> <lastEditDate>0000/0/0 00:00:00</lastEditDate> <lastAccessDate>2010/5/6 20:40:46</lastAccessDate> <timesAccessed>831</timesAccessed> </RECORD> </RECORDS> Now I would like to select the RECORD where id is set to home. In SQL: SELECT * FROM table WHERE id='home' How can i do the same thing with E4X for AS3 ?

    Read the article

  • plot an item map (based on difficulties)

    - by Tyler Rinker
    I have a data set of item difficulties that correspond to items on a questionnaire that looks like this: item difficulty 1 ITEM_6: I DESTROY THINGS BELONGING TO OTHERS 2.31179818 2 ITEM_11: I PHYSICALLY ATTACK PEOPLE 1.95215238 3 ITEM_5: I DESTROY MY OWN THINGS 1.93479536 4 ITEM_10: I GET IN MANY FIGHTS 1.62610855 5 ITEM_19: I THREATEN TO HURT PEOPLE 1.62188759 6 ITEM_12: I SCREAM A LOT 1.45137544 7 ITEM_8: I DISOBEY AT SCHOOL 0.94255210 8 ITEM_3: I AM MEAN TO OTHERS 0.89941812 9 ITEM_20: I AM LOUDER THAN OTHER KIDS 0.72752197 10 ITEM_17: I TEASE OTHERS A LOT 0.61792597 11 ITEM_9: I AM JEALOUS OF OTHERS 0.61288399 12 ITEM_4: I TRY TO GET A LOT OF ATTENTION 0.39947791 13 ITEM_18: I HAVE A HOT TEMPER 0.32209970 14 ITEM_13: I SHOW OFF OR CLOWN 0.31707701 15 ITEM_7: I DISOBEY MY PARENTS 0.20902108 16 ITEM_2: I BRAG 0.19923607 17 ITEM_15: MY MOODS OR FEELINGS CHANGE SUDDENLY 0.06023317 18 ITEM_14: I AM STUBBORN -0.31155481 19 ITEM_16: I TALK TOO MUCH -0.67777282 20 ITEM_1: I ARGUE A LOT -1.15013758 I want to make an item map of these items that looks similar (not exactly) to this (I created this in word but it lacks true scaling as I just eyeballed the scale). It's not really a traditional statistical graphic and so I don't really know how to approach this. I don't care what graphics system this is done in but I am more familiar with ggplot2 and base. I would greatly appreciate a method of plotting this sort of unusual plot. Here's the data set (I'm including it as I was having difficulty using read.table on the dataframe above): DF <- structure(list(item = structure(c(17L, 3L, 16L, 2L, 11L, 4L, 19L, 14L, 13L, 9L, 20L, 15L, 10L, 5L, 18L, 12L, 7L, 6L, 8L, 1L ), .Label = c("ITEM_1: I ARGUE A LOT", "ITEM_10: I GET IN MANY FIGHTS", "ITEM_11: I PHYSICALLY ATTACK PEOPLE", "ITEM_12: I SCREAM A LOT", "ITEM_13: I SHOW OFF OR CLOWN", "ITEM_14: I AM STUBBORN", "ITEM_15: MY MOODS OR FEELINGS CHANGE SUDDENLY", "ITEM_16: I TALK TOO MUCH", "ITEM_17: I TEASE OTHERS A LOT", "ITEM_18: I HAVE A HOT TEMPER", "ITEM_19: I THREATEN TO HURT PEOPLE", "ITEM_2: I BRAG", "ITEM_20: I AM LOUDER THAN OTHER KIDS", "ITEM_3: I AM MEAN TO OTHERS", "ITEM_4: I TRY TO GET A LOT OF ATTENTION", "ITEM_5: I DESTROY MY OWN THINGS", "ITEM_6: I DESTROY THINGS BELONGING TO OTHERS", "ITEM_7: I DISOBEY MY PARENTS", "ITEM_8: I DISOBEY AT SCHOOL", "ITEM_9: I AM JEALOUS OF OTHERS" ), class = "factor"), difficulty = c(2.31179818110545, 1.95215237740899, 1.93479536058926, 1.62610855327073, 1.62188759115818, 1.45137543733965, 0.942552101641177, 0.899418119889782, 0.7275219669431, 0.617925967008653, 0.612883990709181, 0.399477905189577, 0.322099696946661, 0.31707700560997, 0.209021078266059, 0.199236065264793, 0.0602331732900628, -0.311554806052955, -0.677772822413495, -1.15013757942119)), .Names = c("item", "difficulty" ), row.names = c(NA, -20L), class = "data.frame") Thank you in advance.

    Read the article

  • SQL Server query

    - by carrot_programmer_3
    Hi, I have a SQL Server DB containing a registrations table that I need to plot on a graph over time. The issue is that I need to break this down by where the user registered from (e.g. website, wap site, or a mobile application). the resulting output data should look like this... [date] [num_reg_website] [num_reg_wap_site] [num_reg_mobileapp] 1 FEB 2010,24,35,64 2 FEB 2010,23,85,48 3 FEB 2010,29,37,79 etc... The source table is as follows... UUID(int), signupdate(datetime), requestsource(varchar(50)) some smple data in this table looks like this... 1001,2010-02-2:00:12:12,'website' 1002,2010-02-2:00:10:17,'app' 1003,2010-02-3:00:14:19,'website' 1004,2010-02-4:00:16:18,'wap' 1005,2010-02-4:00:18:16,'website' Running the following query returns one data column 'total registrations' for the website registrations but I'm not sure how to do this for multiple columns unfortunatly.... select CAST(FLOOR(CAST([signupdate]AS FLOAT ))AS DATETIME) as [signupdate], count(UUID) as 'total registrations' FROM [UserRegistrationRequests] WHERE requestsource = 'website' group by CAST(FLOOR(CAST([signupdate]AS FLOAT ))AS DATETIME)

    Read the article

< Previous Page | 120 121 122 123 124 125 126 127 128 129 130 131  | Next Page >