Search Results

Search found 2966 results on 119 pages for 'procedural generation'.

Page 17/119 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Use ASP.Net server control code generation from .ashx

    - by Matt Dawdy
    I'm trying to take an existing bunch of code that was previously on a full .aspx page, and do the same stuff in a .ashx handler. The code created an HtmlTable object, added rows and cells to those rows, then added that html table the .aspx's controls collection, then added it to a div that was already on the page. I am trying to keep the code in tact but instead of putting the control into a div, actually generate the html and I'll return that in a big chunk of text that can be called via AJAX client-side. HtmlTable errors out when I try to use the InnerHtml property (says it isn't supported), and when I try RenderControl, after making first a TextWriter and next an HtmlTextWriter object, I get the error that Page cannot be null. Has anyone done this before? Any suggestions?

    Read the article

  • Next generation of command shells?

    - by ignatius
    I am curious about if there is any project about a replacement for the current unix-shells (like bash, ash, rsh ...), at least adding some new ideas or paradigm in this area. I was searching but i found very few information, this project http://en.wikipedia.org/wiki/Friendly_interactive_shell seems interesting, but not so diferent from the nowadays solutions. What do you think? Do you imagine a linux-distribution on 2020 that still having bash? How can be an evolution of this programs? Br

    Read the article

  • Problem with Apache Commons Id UUID Version 1 generation

    - by Pekka Mattila
    My problem is to generate version 1 UUIDs. We use Jetty 6.x, Maven (to start Jetty among other things) and Apache Commons ID (to generate UUID version 1 from the current time). Apache Commons ID requires a configuration file that is told to the JVM, using a parameter, e.g. 'org.apache.commons.id.uuid.config.resource.filename=commons-id-uuid.xml'. I checked the Apache Commons ID code and it tries to find the file from the classpath. Jetty's documentation states that WEB-INF/lib and WEB-INF/classes are in the classpath. The 'commons-id-uuid.xml' can be found from the deployed war file from the root of WEB-INF/classes directory but Jetty cannot load it: Message: java.lang.RuntimeException: java.lang.IllegalStateException: commons-id-uuid.xml loaded as system resource is null Jetty was started using the following command: mvn jetty:run -Dorg.apache.commons.id.uuid.config.resource.filename=commons-id-uuid.xml Any idea what is going wrong? We just need to generate UUID version 1 identifiers. Any suggestions?

    Read the article

  • How to secure licensekey generation

    - by Jakob Gade
    Scenario, simplified for brevity: A developer creates an application for a customer. The customer sells this app to end-users. The app requires a license key to run, and this key is generated by the customer for each end-user with a simple tool created by the developer. The license key contains an expiry date for the license and is encrypted so the end-user can’t tamper with it. The problem here is that the developer (or anybody who has a copy of the license key generator) can easily create valid license keys. Should this generator fall into the wrong hands, it could spell disaster for the customers business. Ideally, the customer would have to use a password to create new license keys. And this password would be unknown to the developer, and somehow baked into the decryption algorithm in the application so it will fail if an attempt to use an unauthorized key is made. How would you implement a solution for this problem that is both transparent and secure?

    Read the article

  • Creating a spider using Scrapy, Spider generation error.

    - by Nacari
    I just downloaded Scrapy (web crawler) on Windows 32 and have just created a new project folder using the "scrapy-ctl.py startproject dmoz" command in dos. I then proceeded to created the first spider using the command: scrapy-ctl.py genspider myspider myspdier-domain.com but it did not work and returns the error: Error running: scrapy-ctl.py genspider, Cannot find project settings module in python path: scrapy_settings. I know I have the path set right (to python26/scripts), but I am having difficulty figuring out what the problem is. I am new to both scrapy and python so there is a good possibility that I have failled to do something important. Also, I have been using eclipse with the Pydev plugin to edit the code if that might cause some problems.

    Read the article

  • SSRS stop report generation on 0 records

    - by AmiT
    Hi All, I am creating a report from ssrs, and storing at local shared folder(MyReports) in excel format using data-driven subscription. It generates a report on scheduled time. But, I don't wanna create a report with zero records. How to stop SSRS to generate a report if no. of records is zero. Pls F1 me ... !

    Read the article

  • URL Generation Technique with PHP

    - by harigm
    I have a build a web portal based on the Cricket concept, I have build a Custom based CMS where I can upload the News for the site Once I upload the news, the URL Will be like this http://cricandcric.com/news/news.php?id=841&An-emotional-moment:-Dhoni.html But I am trying to have the above Url as follows (some thing like this) http://cricandcric.com/news/An-emotional-moment:-Dhoni.html Or similar to Stackoverflow.com, Can any one please help me how can i build that? Do I need to rewrite the URL ?

    Read the article

  • Jquery Json dynamic variable name generation

    - by PlanetUnknown
    I make a jquery .ajax call and I'm expecting a json result. The catch is, if there are say 5 authors, I'll get author_details_0, author_details_1, author_details_2, etc.... How can I dynamically construct the name of the variable to retrieve from json ? I don't know how many authors I'll get, there could be hundreds. $.ajax({ type: "POST", url: "/authordetails/show_my_details/", data: af_pTempString, dataType: "json", beforeSend: function() { }, success: function(jsonData) { console.log("Incoming from backend : " + jsonData.toSource()); if(jsonData.AuthorCount) { console.log("Number of Authors : " + jsonData.AuthorCount); for (i = 0; i < jsonData.AuthorCount; i++) { temp = 'author_details_' + i; <-------------------This is the name of the variable I'm expecting. console.log("Farm information : " + eval(jsonData.temp) ); <----- This doesn't work, how can I get jsonData.author_details_2 for example, 'coz I don't know how many authors are there, there could be hundreds. } } Please let me know if you have any idea how to solve this ! Much appreciated.

    Read the article

  • Concurrent Generation of Sequential Keys

    - by GenTiradentes
    I'm working on a project which generates a very large number of sequential text strings, in a very tight loop. My application makes heavy use of SIMD instruction set extensions like SSE and MMX, in other parts of the program, but the key generator is plain C++. The way my key generator works is I have a keyGenerator class, which holds a single char array that stores the current key. To get the next key, there is a function called "incrementKey," which treats the string as a number, adding one to the string, carrying where necessary. Now, the problem is, the keygen is somewhat of a bottleneck. It's fast, but it would be nice if it were faster. One of the biggest problems is that when I'm generating a set of sequential keys to be processed using my SSE2 code, I have to have the entire set stored in an array, which means I have to sequentially generate and copy 12 strings into an array, one by one, like so: char* keys[12]; for(int i = 0; i < 12; i++) { keys[i] = new char[16]; strcmp(keys[i], keygen++); } So how would you efficiently generate these plaintext strings in order? I need some ideas to help move this along. Concurrency would be nice; as my code is right now, each successive key depends on the previous one, which means that the processor can't start work on the next key until the current one has been completely generated. Here is the code relevant to the key generator: KeyGenerator.h class keyGenerator { public: keyGenerator(unsigned long long location, characterSet* charset) : location(location), charset(charset) { for(int i = 0; i < 16; i++) key[i] = 0; charsetStr = charset->getCharsetStr(); integerToKey(); } ~keyGenerator() { } inline void incrementKey() { register size_t keyLength = strlen(key); for(register char* place = key; place; place++) { if(*place == charset->maxChar) { // Overflow, reset char at place *place = charset->minChar; if(!*(place+1)) { // Carry, no space, insert char *(place+1) = charset->minChar; ++keyLength; break; } else { continue; } } else { // Space available, increment char at place if(*place == charset->charSecEnd[0]) *place = charset->charSecBegin[0]; else if(*place == charset->charSecEnd[1]) *place = charset->charSecBegin[1]; (*place)++; break; } } } inline char* operator++() // Pre-increment { incrementKey(); return key; } inline char* operator++(int) // Post-increment { memcpy(postIncrementRetval, key, 16); incrementKey(); return postIncrementRetval; } void integerToKey() { register unsigned long long num = location; if(!num) { key[0] = charsetStr[0]; } else { num++; while(num) { num--; unsigned int remainder = num % charset->length; num /= charset->length; key[strlen(key)] = charsetStr[remainder]; } } } inline unsigned long long keyToInteger() { // TODO return 0; } inline char* getKey() { return key; } private: unsigned long long location; characterSet* charset; std::string charsetStr; char key[16]; // We need a place to store the key for the post increment operation. char postIncrementRetval[16]; }; CharacterSet.h struct characterSet { characterSet() { } characterSet(unsigned int len, int min, int max, int charsec0, int charsec1, int charsec2, int charsec3) { init(length, min, max, charsec0, charsec1, charsec2, charsec3); } void init(unsigned int len, int min, int max, int charsec0, int charsec1, int charsec2, int charsec3) { length = len; minChar = min; maxChar = max; charSecEnd[0] = charsec0; charSecBegin[0] = charsec1; charSecEnd[1] = charsec2; charSecBegin[1] = charsec3; } std::string getCharsetStr() { std::string retval; for(int chr = minChar; chr != maxChar; chr++) { for(int i = 0; i < 2; i++) if(chr == charSecEnd[i]) chr = charSecBegin[i]; retval += chr; } return retval; } int minChar, maxChar; // charSec = character set section int charSecEnd[2], charSecBegin[2]; unsigned int length; };

    Read the article

  • Automatic database schema generation and migration with Perl

    - by pistacchio
    In Ror or Django or web2py you can "describe" a database (as a set of classes that remaps to tables) and the framework (having being provided with a connection string to the desired database) generates the tables, fields, relations and in the case of RoR and web2py it also keeps it up-to-date (eg, removing a class drops the table, adding a property to the class triggers an "alter table add" etc). Is there any Perl module that does the same? Eg, it takes the YAML/XML/JSON description of a database as input and modifies/generates the database schema accordingly?

    Read the article

  • Change in behaviour & generation of nullreference exception

    - by peril brain
    I made this program 2hr ago and it ran quit well when i confronted this to presaved .xls file. But when i closed that and started new instance,it started generating null refrence exception why??plz explain. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Threading; using Microsoft.Office.Interop; using Excel = Microsoft.Office.Interop.Excel; namespace svchost { class MainClass { Excel.Application oExcelApp; static void Main(string[] args) { MainClass mc = new MainClass(); while (true) { if (mc.chec()) { Console.WriteLine("RUNNING"); Thread.Sleep(4000); } else { Console.WriteLine("NOT RUNNING"); Thread.Sleep(8000); } } } public bool chec() { try { oExcelApp = (Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application"); Excel.Workbook xlwkbook = (Excel.Workbook)oExcelApp.ActiveWorkbook; //****PROBLEM FROM HERE********* Console.WriteLine(xlwkbook.Name + "\n"); ke kw = new ke(ref oExcelApp,ref xlwkbook); Console.WriteLine(xlwkbook.Author); xlwkbook = null; } catch (Exception ec) { oExcelApp = null; System.GC.Collect(); Console.WriteLine(ec); return false; } oExcelApp = null; System.GC.Collect(); return true; } } class ke { public ke(ref Excel.Application a1, ref Excel.Workbook b1) { Excel.Worksheet ws = (Excel.Worksheet)a1.ActiveSheet; Console.WriteLine(a1.ActiveWorkbook.Name + "\n" + ws.Name); Excel.Range rn; rn = ws.Cells.Find("657/07", Type.Missing, Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlPart, Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlNext, false, Type.Missing, Type.Missing); Console.WriteLine(rn.Text); } } }

    Read the article

  • Nagios - Custom Report Generation

    - by Naveen
    Hi, I want to generate a custom report in "Nagios-3.2.0". I have defined the work-hours in "timeperiods.cfg" as follows: 'workhours' timeperiod definition define timeperiod { timeperiod_name 0800-2000 alias full time monday 08:00-20:00 tuesday 08:00-20:00 wednesday 08:00-20:00 thursday 08:00-20:00 friday 08:00-20:00 saturday 08:00-20:00 } Now, if I replace "saturday" with "2010-03-27" or "march 27" as shown below: 'workhours' timeperiod definition define timeperiod { timeperiod_name 0800-2000 alias full time monday 08:00-20:00 tuesday 08:00-20:00 wednesday 08:00-20:00 thursday 08:00-20:00 friday 08:00-20:00 2010-03-27 08:00-20:00 } Nagios is not generating report for the given date (2010-03-27). How can I modify "timeperiods.cfg" so that I can generate reports for the given dates ?

    Read the article

  • Learning to create beautiful /next-generation GUI

    - by ShaChris23
    I really want to create a stunning-looking GUI desktop application that looks like, for example: Mac OS X interface Picasa desktop client on windows IPhone apps Office 2007 I've mostly been programming GUI using Qt/Swing/WinForm and I'm tired of creating so plain looking GUI, lol. So I was thinking about diving into stuff like: jQuery WPF/C# iPhone SDK Silverlight Adobe Air/Flex Just to get some ideas on how to create really cool looking UI. Does that sound like a good list? Any developers here that could share what platform they use to create very cool looking desktop app? On a sidenote, I really wonder what developers at Apple / Microsoft use to develop their own cool-looking software. EDIT A lot of responses talk about the importance of usability over "cool-looking".. I totally agree that usability and simplicity are the most important aspects of user interface design. I've been doing GUI development for a while now ( 3 years), so that I understand. But using cool-looking UI also improves user experience + it could make big difference on whether or not your software sells. I mean, otherwise why would Microsoft/Apple try to make their OS UI look "cooler" everytime there's a new version? Why would websites like pragprog.com, or versionsapp.com. make their websites look like that? Basically you kill 2 birds with one stone: stunnning-looking UI + super usability (because it looks simple and intuitive). That is what I'm striving for. And as far as I know, I cannot achieve that using Qt/Winform. Most of the books I have read just show you how to make average-looking (read: 1990's) UI. I want to learn how to create cool-looking UI. And the only place I see cool-looking UIs these days are the technology I list above. I'm not enamored with any technology; but I just want to know how things are done in other technology to see if I could apply them to the technology I'm using, or see if I could use those technology in my line of work. An example: if I were to pick between this UI and this UI, I probably would pick the latter, if just based on looks alone. Functionally, they are just the same UI; they both allow you to keep track of your time. They both contain buttons and textboxes, etc. But the fact that they look different, also differentiate them in terms of attractiveness. So in all, I think the "ice on the cake" is very important. I would say it's the thing you strive for after you are certain you have a totally intuitive, usable UI.

    Read the article

  • Dynamic/runtime method creation (code generation) in Python

    - by Eli Bendersky
    Hello, I need to generate code for a method at runtime. It's important to be able to run arbitrary code and have a docstring. I came up with a solution combining exec and setattr, here's a dummy example: class Viking(object): def __init__(self): code = ''' def dynamo(self, arg): """ dynamo's a dynamic method! """ self.weight += 1 return arg * self.weight ''' self.weight = 50 d = {} exec code.strip() in d setattr(self.__class__, 'dynamo', d['dynamo']) if __name__ == "__main__": v = Viking() print v.dynamo(10) print v.dynamo(10) print v.dynamo.__doc__ Is there a better / safer / more idiomatic way of achieving the same result?

    Read the article

  • No Binary File Generation

    - by Nathan Campos
    I've just bought a new laptop for me on the travel, then on my free time, I've started to test MinGW on it by trying to compile my own OS that is written in C++, then I've created all the files needed and the kernel.cpp: extern "C" void _main(struct multiboot_data* mbd, unsigned int magic); void _main( struct multiboot_data* mbd, unsigned int magic ) { char * boot_loader_name =(char*) ((long*)mbd)[16]; /* Print a letter to screen to see everything is working: */ unsigned char *videoram = (unsigned char *) 0xb8000; videoram[0] = 65; /* character 'A' */ videoram[1] = 0x07; /* forground, background color. */ } And tried to compile it with g++ G: g++ -o C:\kernel.o -c kernel.cpp -Wall -Wextra -Werror -nostdlib -nostartfiles -nodefaultlibs kernel.cpp: In function `void _main(multiboot_data*, unsigned int)': kernel.cpp:8: warning: unused variable 'boot_loader_name' kernel.cpp: At global scope: kernel.cpp:4: warning: unused parameter 'magic' G: But it don't create any binary file at C:/, what can I do?

    Read the article

  • GORM ID generation and belongsTo association ?

    - by fabien-barbier
    I have two domains : class CodeSetDetail { String id String codeSummaryId static hasMany = [codes:CodeSummary] static constraints = { id(unique:true,blank:false) } static mapping = { version false id column:'code_set_detail_id', generator: 'assigned' } } and : class CodeSummary { String id String codeClass String name String accession static belongsTo = [codeSetDetail:CodeSetDetail] static constraints = { id(unique:true,blank:false) } static mapping = { version false id column:'code_summary_id', generator: 'assigned' } } I get two tables with columns: code_set_detail: code_set_detail_id code_summary_id and code_summary: code_summary_id code_set_detail_id (should not exist) code_class name accession I would like to link code_set_detail table and code_summary table by 'code_summary_id' (and not by 'code_set_detail_id'). Note : 'code_summary_id' is define as column in code_set_detail table, and define as primary key in code_summary table. To sum-up, I would like define 'code_summary_id' as primary key in code_summary table, and map 'code_summary_id' in code_set_detail table. How to define a primary key in a table, and also map this key to another table ?

    Read the article

  • Castle ActiveRecord - schema generation without enforcing referential integrity?

    - by Simon
    Hi all, I've just started playing with Castle active record as it seems like a gentle way into NHibernate. I really like the idea of the database schema being generate from my classes during development. I want to do something similar to the following: [ActiveRecord] public class Camera : ActiveRecordBase<Camera> { [PrimaryKey] public int CameraId {get; set;} [Property] public int CamKitId {get; set;} [Property] public string serialNo {get; set;} } [ActiveRecord] public class Tripod : ActiveRecordBase<Tripod> { [PrimaryKey] public int TripodId {get; set;} [Property] public int CamKitId {get; set;} [Property] public string serialNo {get; set;} } [ActiveRecord] public class CameraKit : ActiveRecordBase<CameraKit> { [PrimaryKey] public int CamKitId {get; set;} [Property] public string description {get; set;} [HasMany(Inverse=true, Table="Cameras", ColumnKey="CamKitId")] public IList<Camera> Cameras {get; set;} [HasMany(Inverse=true, Table="Tripods", ColumnKey="CamKitId")] public IList<Camera> Tripods {get; set;} } A camerakit should contain any number of tripods and cameras. Camera kits exist independently of cameras and tripods, but are sometimes related. The problem is, if I use createschema, this will put foreign key constraints on the Camera and Tripod tables. I don't want this, I want to be able to to set CamKitId to null on the tripod and camera tables to indicate that it is not part of a CameraKit. Is there a way to tell activerecord/nhibernate to still see it as related, without enforcing the integrity? I was thinking I could have a cameraKit record in there to indicate "no camera kit", but it seems like oeverkill. Or is my schema wrong? Am I doing something I shouldn't with an ORM? (I've not really used ORMs much) Thanks!

    Read the article

  • Problems with generation of dynamic code

    - by user308344
    This code gif an exception: Invocation exception, please help, I don't know what happen, I think is some thing with the Add because he work when I push onto the stack intergers, and when i push lvalue It's didn't work, thanks static void Main(string[] args) { AppDomain dominioAplicacion = System.Threading.Thread.GetDomain(); AssemblyName nombre_Del_Ensamblado = new AssemblyName("ASS"); AssemblyBuilder ensambladoBld = dominioAplicacion.DefineDynamicAssembly(nombre_Del_Ensamblado, AssemblyBuilderAccess.RunAndSave); ModuleBuilder moduloBld = ensambladoBld.DefineDynamicModule("<MOD"); TypeBuilder claseContenedoraBld = moduloBld.DefineType("claseContenedora"); MethodBuilder mainBld = claseContenedoraBld.DefineMethod("main", MethodAttributes.Public | MethodAttributes.Static, typeof(void), Type.EmptyTypes); ILGenerator il = mainBld.GetILGenerator(); FieldBuilder campoBld = claseContenedoraBld.DefineField("x", typeof(int), FieldAttributes.Public | FieldAttributes.Static); il.Emit(OpCodes.Ldc_I4, 2); il.Emit(OpCodes.Stsfld, campoBld); FieldBuilder campoBld1 = claseContenedoraBld.DefineField("x1", typeof(int), FieldAttributes.Public | FieldAttributes.Static); il.Emit(OpCodes.Ldc_I4, 2); il.Emit(OpCodes.Stsfld, campoBld1); il.Emit(OpCodes.Ldftn, campoBld); //il.Emit(OpCodes.Unbox, typeof(int)); //il.Emit(OpCodes.Stloc_0); il.Emit(OpCodes.Ldloc_0); il.Emit(OpCodes.Ldftn, campoBld1); //il.Emit(OpCodes.Unbox, typeof(int)); il.Emit(OpCodes.Stloc_1); il.Emit(OpCodes.Ldloc_1); //il.Emit(OpCodes.Box, typeof(int)); //il.Emit(OpCodes.Ldftn, campoBld1); //il.Emit(OpCodes.Unbox, typeof(int)); il.Emit(OpCodes.Add); il.Emit(OpCodes.Pop); //il.Emit(OpCodes.Stsfld, campoBld1); il.Emit(OpCodes.Ret); Type t = claseContenedoraBld.CreateType(); object ptInstance = Activator.CreateInstance(t, new Type[] { }); t.InvokeMember("main", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.Public, null, ptInstance, new object[0]); var x = t.GetField("x"); }

    Read the article

  • uniform generation of points on 3D box

    - by Myx
    Hello: I would like to generate random points on a 3D box defined by its (minx, miny, minz) and (maxx, maxy, maxz) corners. I was thinking of generating a random point inside of the box and then somehow projecting it onto one of the box sides. However, I don't have explicit plane information for the box sides and this seems like it will not produce a uniform distribution of points since if some sides of the box are bigger than others, those sides should have more points generated on them. Any suggestions are appreciated. Thanks.

    Read the article

  • Random number generation

    - by Chandan Shetty SP
    I am using below code to generate random numbers in range... int randomNumberWithinRange(int min,int max) { int snowSize = 0; do { snowSize = rand()%max; } while( snowSize < min || snowSize > max ); return snowSize; } for(int i = 0; i < 10 ; i++) NSlog("@"%d",\t", randomNumberWithinRange(1,100)); If I quit my application and restart, same set of numbers are generated. How to generate different set of random numbers for every launching.

    Read the article

  • Ray Generation Inconsistency

    - by Myx
    I have written code that generates a ray from the "eye" of the camera to the viewing plane some distance away from the camera's eye: R3Ray ConstructRayThroughPixel(...) { R3Point p; double increments_x = (lr.X() - ul.X())/(double)width; double increments_y = (ul.Y() - lr.Y())/(double)height; p.SetX( ul.X() + ((double)i_pos+0.5)*increments_x ); p.SetY( lr.Y() + ((double)j_pos+0.5)*increments_y ); p.SetZ( lr.Z() ); R3Vector v = p-camera_pos; R3Ray new_ray(camera_pos,v); return new_ray; } ul is the upper left corner of the viewing plane and lr is the lower left corner of the viewing plane. They are defined as follows: R3Point org = scene->camera.eye + scene->camera.towards * radius; R3Vector dx = scene->camera.right * radius * tan(scene->camera.xfov); R3Vector dy = scene->camera.up * radius * tan(scene->camera.yfov); R3Point lr = org + dx - dy; R3Point ul = org - dx + dy; Here, org is the center of the viewing plane with radius being the distance between the viewing plane and the camera eye, dx and dy are the displacements in the x and y directions from the center of the viewing plane. The ConstructRayThroughPixel(...) function works perfectly for a camera whose eye is at (0,0,0). However, when the camera is at some different position, not all needed rays are produced for the image. Any suggestions what could be going wrong? Maybe something wrong with my equations? Thanks for the help.

    Read the article

  • Symfony forms: how to change default widget for form generation

    - by caymcorp
    I'm using a custom Widget for date fields, and I want to use it in all my forms. The problem is that symfony uses the default sfWidgetFormDate. What I want is to change this default widget in order to generate forms with my custom Widget. I don't want to change by hand all the forms generated. The only approach I have found is the treak of modify BaseFormDoctrine.php: public function setup() { foreach($this->getWidgetSchema()->getFields() as $name=>$widget) { if($widget instanceof sfWidgetFormDate) { $this->widgetSchema[$name] = new sfWidgetFormJQueryDate(array( 'config' => '{}', 'image'=>'/images/calendar.png', )); } } }

    Read the article

  • mysql to excel generation using php

    - by pmms
    <?php // DB Connection here mysql_connect("localhost","root",""); mysql_select_db("hitnrunf_db"); $select = "SELECT * FROM jos_users "; $export = mysql_query ( $select ) or die ( "Sql error : " . mysql_error( ) ); $fields = mysql_num_fields ( $export ); for ( $i = 0; $i < $fields; $i++ ) { $header .= mysql_field_name( $export , $i ) . "\t"; } while( $row = mysql_fetch_row( $export ) ) { $line = ''; foreach( $row as $value ) { if ( ( !isset( $value ) ) || ( $value == "" ) ) { $value = "\t"; } else { $value = str_replace( '"' , '""' , $value ); $value = '"' . $value . '"' . "\t"; } $line .= $value; } $data .= trim( $line ) . "\n"; } $data = str_replace( "\r" , "" , $data ); if ( $data == "" ) { $data = "\n(0) Records Found!\n"; } header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=your_desired_name.xls"); header("Pragma: no-cache"); header("Expires: 0"); print "$header\n$data"; ?> The code above is used for generating an Excel spreadsheet from a MySQL database, but we are getting following error: The file you are trying to open, 'users.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now? What is the problem and how do we fix it?

    Read the article

  • uniform generation of 3D points on cylinder/cone

    - by Myx
    Hello: I wish to randomly and uniformly generate points on a cylinder and a cone (separately). The cylinder is defined by its center, its radius and height. Same specifications for the cone. I am able to get the bounding box for each shape so I was thinking of generating points within the bounding box. However, I'm not sure how to project them onto the cylinder/cone or if this is the best idea. Any suggestions? Thanks.

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >