Daily Archives

Articles indexed Wednesday July 4 2012

Page 12/17 | < Previous Page | 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • arbitrary input from stdin to shell

    - by python_noob
    So I have this existing command that accepts a single argument, but I need something that accepts the argument over stdin instead. A shell script wrapper like the following works, but as I will be allowing untrusted users to pass arbitrary strings on stdin, I'm wondering if there's potential for someone to execute arbitary commands on the shell. #!/bin/sh $CMD "`cat`" Obviously if $CMD has a vulnerability in the way it processes the argument there's nothing I can do, so I'm concerned stuff like this: Somehow allow the user to escape the double quotes and pass input into argument #2 of $CMD Somehow cause another arbitary command to run

    Read the article

  • nodejs response speed and nginx

    - by user1502440
    I'm just started testing nodejs, and wanted to get some help in understanding following behavior: Example #1: var http = require('http'); http.createServer(function(req, res){ res.writeHeader(200, {'Content-Type': 'text/plain'}); res.end('foo'); }).listen(1001, '0.0.0.0'); Example #2: var http = require('http'); http.createServer(function(req, res){ res.writeHeader(200, {'Content-Type': 'text/plain'}); res.write('foo'); res.end('bar'); }).listen(1001, '0.0.0.0'); When testing response time in Chrome: example #1 - 6-10ms example #2 - 200-220ms But, if test both examples through nginx proxy_pass server{ listen 1011; location / { proxy_pass http://127.0.0.1:1001; } } i get this: example #1 - 4-8ms example #2 - 4-8ms I am not an expert on either nodejs or nginx, and asking if someone can explain this? nodejs - v.0.8.1 nginx - v.1.2.2

    Read the article

  • Prevent hash navigation url

    - by Koningh
    I have the following problem: I'm using a slider (coda) to let people navigate trough some 'pages'. The slider uses hash links to navigate to the next page/slide. If a user is at page one (#page1), there is a link which will lead the user to page 2 (#page2) and so on. At the top of the slider the numbers of the pages appear as a link, but only when the page is visited. So if there are six pages and the user navigates from the first to the second and then the third one, there are only three links at the top of the slider (to page one, two and three). The problem is that a user can navigate to page five (or any page actually) without first visiting the pages previous to page five by just using the hash URL and typing the whole link in their address bar. For example if I would type www.mydomain.com/slider/index.php#page5 the slider automatically navigates to the fifth slide/page of the slider and thereby skipping the first four. I want to allow users to navigate to #page5 only if they have visited the first four (So by clicking trough the slides). This means that if they would go to #page5 directly by typing the URL in the address bar, I would like them to be send to the first page (#page1). Does anyone have any idea on solving this?

    Read the article

  • Different icons and title for same iPad application

    - by trapo
    I'm developing an iPad application that will be distributed "in-house" ie only inside enterprise. They asked me if i can produce 2 different releases of the same application to be installed on the same iPad. The first one will communicate with a production server while the second will use a sandbox server and will be used by user to learn the system. Server url will be changed in app settings. They told me to differentiate these releases by icon and title (and also, of course, by title in navigation bar). What's the best way to get this goal avoiding duplication of the project?

    Read the article

  • How to parse invalid HTML with Perl?

    - by bodacydo
    I maintain a database of articles with HTML formatting. Unfortunately the editors who wrote articles didn't know proper HTML, so they often have written stuff like: <div class="highlight"><html><head></head><body><p>Note that ...</p></html></div> I tried using HTML::TreeBuilder to parse this HTML but after parsing it and dumping the resulting tree, all the elements between <div class="highlight">...</div> are gone. I'm left with just <div class="highlight"></div>. The editors often have also done things like: <div class="article"><style>@font-face { font-family: "Cambria"; }</style>Article starts here</div> Parsing this with HTML::TreeBuilder results in empty <div class="article"></div> again. Any ideas how to approach this broken HTML and actually make sense out of it?

    Read the article

  • Cannot extend a class located in another file, PHP

    - by NightMICU
    I am trying to set up a class with commonly used tasks, such as preparing strings for input into a database and creating a PDO object. I would like to include this file in other class files and extend those classes to use the common class' code. However, when I place the common class in its own file and include it in the class it will be used in, I receive an error that states the second class cannot be found. For example, if the class name is foo and it is extending bar (the common class, located elsewhere), the error says that foo cannot be found. But if I place the code for class bar in the same file as foo, it works. Here are the classes in question - Common Class abstract class coreFunctions { protected $contentDB; public function __construct() { $this->contentDB = new PDO('mysql:host=localhost;dbname=db', 'username', 'password'); } public function cleanStr($string) { $cleansed = trim($string); $cleansed = stripslashes($cleansed); $cleansed = strip_tags($cleansed); return $cleansed; } } Code from individual class include $_SERVER['DOCUMENT_ROOT'] . '/includes/class.core-functions.php'; $mode = $_POST['mode']; if (isset($mode)) { $gallery = new gallery; switch ($mode) { case 'addAlbum': $gallery->addAlbum($_POST['hash'], $_POST['title'], $_POST['description']); } } class gallery extends coreFunctions { private function directoryPath($string) { $path = trim($string); $path = strtolower($path); $path = preg_replace('/[^ \pL \pN]/', '', $path); $path = preg_replace('[\s+]', '', $path); $path = substr($path, 0, 18); return $path; } public function addAlbum($hash, $title, $description) { $title = $this->cleanStr($title); $description = $this->cleanStr($description); $path = $this->directoryPath($title); if ($title && $description && $hash) { $addAlbum = $this->contentDB->prepare("INSERT INTO gallery_albums (albumHash, albumTitle, albumDescription, albumPath) VALUES (:hash, :title, :description, :path)"); $addAlbum->execute(array('hash' => $hash, 'title' => $title, 'description' => $description, 'path' => $path)); } } } The error when I try it this way is Fatal error: Class 'gallery' not found in /home/opheliad/public_html/admin/photo-gallery/includes/class.admin_photo-gallery.php on line 10

    Read the article

  • Pass checkbox values with Jquery to PHP and display result in div

    - by user1343955
    I want to filter realtime results with jQuery (just like on this site http://shop.www.hi.nl/hi/mcsmambo.p?M5NextUrl=RSRCH). So when someones checks a checkbox the results should update realtime (in a div). Now I'm a newbie with jQuery and I've tried lots of examples but I can't get it to work. Here's my code, could anyone tell what I'm doing wrong? Thank you very much! HTML <div id="c_b"> Kleur:<br /> <input type="checkbox" name="kleur[1]" value="Blauw"> Blauw <br /> <input type="checkbox" name="kleur[2]" value="Wit"> Wit <br /> <input type="checkbox" name="kleur[3]" value="Zwart"> Zwart <br /> <br /> Operating System:<br /> <input type="checkbox" name="os[1]" value="Android"> Android <br /> <input type="checkbox" name="os[2]" value="Apple iOS"> Apple iOS <br /> </div> <div id="myResponse">Here should be the result</div> jQuery function updateTextArea() { var allVals = []; $('#c_b :checked').each(function() { allVals.push($(this).val()); }); var dataString = $(allVals).serialize(); $.ajax({ type:'POST', url:'/wp-content/themes/u-design/filteropties.php', data: dataString, success: function(data){ $('#myResponse').html(data); } }); } $(document).ready(function() { $('#c_b input').click(updateTextArea); updateTextArea(); }); PHP //Just to see if the var passing works echo var_export($_POST);

    Read the article

  • modalpopupextender.Show() wont fire

    - by Peter Lea
    I'm pretty new to developing for the web so bare with me. I have a company page with multiple locations and emails etc at each of these addresses. The idea is to have a single modalpopup to edit each type of data (one for email, one for urls, one for addresses etc). I link the modalpopupextender to a hiddenbutton and then call an edit function from various places where I can populate some hiddenfields and textboxes in the panel before showing it. The code executes but it just wont show the damn popup, I just see a flash and can't figure out if its my panel, my css or something I don't understand about ajax and postbacks etc. Things i've tried after reading various threads: Disable smart navigation in web.config Move ToolKitScriptManager up to master page and use proxy in content set hiddenbutton to use style="display:none" tried links etc instead of hidden button Heres my code CSS .modalBackground { position: absolute; z-index: 100; top: 0px; left: 0px; background-color: #000; filter: alpha(opacity=60); -moz-opacity: 0.6; opacity: 0.6; } .modalPopup { background-color: #FFD; border-width: 3px; border-style: solid; border-color: gray; padding: 3px;} Asp/html <ajaxToolkit:ModalPopupExtender runat="server" ID="mpe_email" BackgroundCssClass="modalBackground" PopupControlID="modal_email" CancelControlID="btn_cancel_email" TargetControlID="fake_btn_email" /> <asp:Button ID="fake_btn_email" runat="server" Text="email" style="display:none;" /> <asp:panel id="modal_email" runat="server" class="modalPopup" Width="500px" Height="500px"> <asp:HiddenField ID="hf_modal_email_location_id" runat="server" Value="" /> <asp:HiddenField ID="hf_modal_email_contact_id" runat="server" Value="" /> <asp:HiddenField ID="hf_modal_email_comms_id" runat="server" Value="" /> <table width="100%"> <tr> <td> <asp:Label ID="lbl_mpe_email_title" runat="server" Text="Edit Email Address" /> </td> </tr> <tr> <td> <table width="100%"> <tr> <td width="40px"><img src="../images/email.png" height="30px" width="30px"/></td> <td> <table width="100px"> <tr> <td><span>Quick Ref: <asp:TextBox ID="txb_mpe_email_qref" runat="server" Text="" /></span></td> </tr> <tr> <td><span>Email Address: <asp:TextBox ID="txb_mpe_email_address_full" runat="server" Text="" /></span></td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td width="40px" align="left"><asp:Button ID="btn_cancel_email" runat="server" Text="Cancel"/></td> <td align="right"><asp:Button ID="btn_save_email" runat="server" Text="Save" OnCommand="save_modal_email" /></td> </tr> <tr> <td colspan="2" align="right"><asp:Label ID="lbl_mpe_email_err" runat="server" Text="" /></td> </tr> </table> c# public void oloc_ocon_email_edit(object sender, RepeaterCommandEventArgs e) { switch (e.CommandName) { case "edit": hf_modal_email_location_id.Value = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_location_id")).Value; hf_modal_email_contact_id.Value = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_contact_id")).Value; hf_modal_email_comms_id.Value = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_comms_id")).Value; lbl_mpe_email_title.Text = "Edit Email Address"; txb_mpe_email_qref.Text = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_qref")).Value; txb_mpe_email_address_full.Text = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_email_full")).Value; lbl_mpe_email_err.Text = ""; mpe_email.Show(); break; case "new": hf_modal_email_location_id.Value = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_location_id_p")).Value; hf_modal_email_contact_id.Value = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_contact_id_p")).Value; hf_modal_email_comms_id.Value = "0"; lbl_mpe_email_title.Text = "New Email Address"; txb_mpe_email_qref.Text = ""; txb_mpe_email_address_full.Text = ""; lbl_mpe_email_err.Text = ""; mpe_email.Show(); break; } } Stuff makes so much more sense in a desktop environment, I hope someone can point me in the right direction. Thanks

    Read the article

  • Efficient way to call .Sum() on multiple properties

    - by SherCoder
    I have a function that uses Linq to get data from the database and then I call that function in another function to sum all the individual properties using .Sum on each individual property. I was wondering if there is an efficient way to sum all the properties at once rather than calling .Sum() on each individual property. I think the way I am doing as of right now, is very slow (although untested). public OminitureStats GetAvgOmnitureData(int? fnsId, int dateRange) { IQueryable<OminitureStats> query = GetOmnitureDataAsQueryable(fnsId, dateRange); int pageViews = query.Sum(q => q.PageViews); int monthlyUniqueVisitors = query.Sum(q => q.MonthlyUniqueVisitors); int visits = query.Sum(q => q.Visits); double pagesPerVisit = (double)query.Sum(q => q.PagesPerVisit); double bounceRate = (double)query.Sum(q => q.BounceRate); return new OminitureStats(pageViews, monthlyUniqueVisitors, visits, bounceRate, pagesPerVisit); }

    Read the article

  • serve static play2.x content from CDN

    - by Adam Lane
    In development mode I would like to have assets served locally and when deployed in production I would like them served from the CDN. Anyone using play2 and serving content from CDN be willing to share how they are doing it? // Thinking of something like this in the routes file... @if(play.Play.isDev()) { GET /assets/*file controllers.Assets.at(path="/public", file) } else { GET CDNPATH/assets/*file controllers.Assets.at(path="CDNPATH", file) } (Note: using 2.0.2 because of the headers fix https://github.com/playframework/Play20/pull/276)

    Read the article

  • disable horizontal scrolling by finger swipe

    - by codelove
    This may just be a mac issue, but I have a page with an element which is twice the size of the page and is moved into view dynamically. in my css I have overflow-x:hidden set so that this element won't create an ugly bottom scollbar, the problem is on my laptop (and probably on ipads and other devices) I can just swipe with two fingers to scroll and view this content. This breaks the whole layout and looks really bad, and I am looking for a way to completely disable this horizontal scrolling action with javascript or css. Thank you

    Read the article

  • Using Core Data Concurrently and Reliably

    - by John Topley
    I'm building my first iOS app, which in theory should be pretty straightforward but I'm having difficulty making it sufficiently bulletproof for me to feel confident submitting it to the App Store. Briefly, the main screen has a table view, upon selecting a row it segues to another table view that displays information relevant for the selected row in a master-detail fashion. The underlying data is retrieved as JSON data from a web service once a day and then cached in a Core Data store. The data previous to that day is deleted to stop the SQLite database file from growing indefinitely. All data persistence operations are performed using Core Data, with an NSFetchedResultsController underpinning the detail table view. The problem I am seeing is that if you switch quickly between the master and detail screens several times whilst fresh data is being retrieved, parsed and saved, the app freezes or crashes completely. There seems to be some sort of race condition, maybe due to Core Data importing data in the background whilst the main thread is trying to perform a fetch, but I'm speculating. I've had trouble capturing any meaningful crash information, usually it's a SIGSEGV deep in the Core Data stack. The table below shows the actual order of events that happen when the detail table view controller is loaded: Main Thread Background Thread viewDidLoad Get JSON data (using AFNetworking) Create child NSManagedObjectContext (MOC) Parse JSON data Insert managed objects in child MOC Save child MOC Post import completion notification Receive import completion notification Save parent MOC Perform fetch and reload table view Delete old managed objects in child MOC Save child MOC Post deletion completion notification Receive deletion completion notification Save parent MOC Once the AFNetworking completion block is triggered when the JSON data has arrived, a nested NSManagedObjectContext is created and passed to an "importer" object that parses the JSON data and saves the objects to the Core Data store. The importer executes using the new performBlock method introduced in iOS 5: NSManagedObjectContext *child = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType]; [child setParentContext:self.managedObjectContext]; [child performBlock:^{ // Create importer instance, passing it the child MOC... }]; The importer object observes its own MOC's NSManagedObjectContextDidSaveNotification and then posts its own notification which is observed by the detail table view controller. When this notification is posted the table view controller performs a save on its own (parent) MOC. I use the same basic pattern with a "deleter" object for deleting the old data after the new data for the day has been imported. This occurs asynchronously after the new data has been fetched by the fetched results controller and the detail table view has been reloaded. One thing I am not doing is observing any merge notifications or locking any of the managed object contexts or the persistent store coordinator. Is this something I should be doing? I'm a bit unsure how to architect this all correctly so would appreciate any advice.

    Read the article

  • Android - Correspondence between ImageView coordinates and Bitmap Pixels

    - by Matteo
    In my application I want the user to be able to select some content of an Image contained inside an ImageView. To select the content I subclassed the ImageView class making it implement the OnTouchListener so to draw over it a rectangle with borders decided by the user. Here is an example of the result of the drawing (to have an idea you can think of it as when you click with the mouse on your desktop and drag the mouse): Now I need to determine which pixels of the Bitmap image correspond to the selected part. It's kind of easy to determine which are the points of the ImageView belonging to the rectangle, but I don't know how to get the correspondent pixels, since the ImageView has a different aspect ratio than the original image. I followed the approach described especially here, but also here, but am not fully satisfied because in my opinion the correspondence made is 1 on 1 between pixels and points on the ImageView and does not give me all the correspondent pixels on the original image to the selected area. Calling hoveredRect the rectangle on the ImageView the points inside of it are: class Point { float x, y; @Override public String toString() { return x + ", " + y; } } Vector<Point> pointsInRect = new Vector<Point>(); for( int x = hoveredRect.left; x <= hoveredRect.right; x++ ){ for( int y = hoveredRect.top; y <= hoveredRect.bottom; y++ ){ Point pointInRect = new Point(); pointInRect.x = x; pointInRect.y = y; pointsInRect.add(pointInRect); } } How can I obtain a Vector<Pixels> pixelsInImage containing the correspondent pixels?

    Read the article

  • Parsing C# Script into Java

    - by pantaryl
    I'm looking for a way to easily read in a C# file and place it into a Java Object for database storage (storing the class name, functions, variables, etc). I'm making a Hierarchical State Machine AI Building Tool for a game I'm creating and need to be able to import an existing C# file and store it in a database for retrieval in the future. Does anyone know of any preexisting libraries for parsing C# files? Something similar to JavaParser? Thanks everyone! EDIT: This needs to be part of my Java Project. I'll be loading in the C# files through my Java Application and saving it into my db4o database.

    Read the article

  • Scala unsatisfiable cyclic dependency in "table-layout" library (Toolkit class)

    - by Atol
    When I try to compile with sbt some code containing an instance of a Table from this library I get this error: java.lang.AssertionError: assertion failed: unsatisfiable cyclic dependency in 'class Toolkit' It seems to work with Java so I don't understand why it fails in Scala. Here is the toolkit class: http://code.google.com/p/table-layout/source/browse/branches/v1/tablelayout/src/com/esotericsoftware/tablelayout/Toolkit.java As long as I get this error I'm totally stopped in my project :(.

    Read the article

  • design patterns for hierarchical structures

    - by JLBarros
    Anyone knows some design patterns for hierarchical structures? For example, to manage inventory categories, accounting chart of accounts, divisions of human resources, etc.. Thank you very much in advance EDIT: Thanks for your interest. I am looking for a better way of dealing with hierarchical items to which they should apply operations depending on the level of hierarchy. I have been studying the patterns by Martin Fowler, for example Accounting, but I wonder if there are other more generic. The problem is that operations apply to the items must be possible to change even at run time and may depend on other external variables. I thought of a kind of strategy pattern but would like to combine it with the fact that it is a hierarchical scheme. I would appreciate any reference to hierarchical patterns and you'll take care of them in depth.

    Read the article

  • Implementing a non-public assignment operator with a public named method?

    - by Casey
    It is supposed to copy an AnimatedSprite. I'm having second thoughts that it has the unfortunate side effect of changing the *this object. How would I implement this feature without the side effect? EDIT: Based on new answers, the question should really be: How do I implement a non-public assignment operator with a public named method without side effects? (Changed title as such). public: AnimatedSprite& AnimatedSprite::Clone(const AnimatedSprite& animatedSprite) { return (*this = animatedSprite); } protected: AnimatedSprite& AnimatedSprite::operator=(const AnimatedSprite& rhs) { if(this == &rhs) return *this; destroy_bitmap(this->_frameImage); this->_frameImage = create_bitmap(rhs._frameImage->w, rhs._frameImage->h); clear_bitmap(this->_frameImage); this->_frameDimensions = rhs._frameDimensions; this->CalcCenterFrame(); this->_frameRate = rhs._frameRate; if(rhs._animation != nullptr) { delete this->_animation; this->_animation = new a2de::AnimationHandler(*rhs._animation); } else { delete this->_animation; this->_animation = nullptr; } return *this; }

    Read the article

  • Load local Html file doesn't refer the js file in UIWebView

    - by Hero Vs Zero
    I am working with UIWebView project and I want to load an HTML file from a project resource. It is working fine when I run from the URL, but when I view the HTML file locally, JS files are not loaded. Loading the local HTML local file doesn't refer to js files in UIWebView. Here's my code to load the HTML file project local resource and does't refer the js file: NSString *path = [[NSBundle mainBundle] pathForResource:@"textfile" ofType:@"txt"]; NSError *error = nil; NSString *string = [[NSString alloc] initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error]; NSString *path1 = [[NSBundle mainBundle] bundlePath]; NSURL *baseURL = [NSURL fileURLWithPath:path1]; NSLog(@"%@ >>> %@",baseURL,path); [webview loadHTMLString:string baseURL:baseURL]; This code doesn't find JS files in UIWebView, even though it loads image files from the project resource successfully.

    Read the article

  • iOS: Assignment to iVar in Block (ARC)

    - by manmal
    I have a readonly property isFinished in my interface file: typedef void (^MyFinishedBlock)(BOOL success, NSError *e); @interface TMSyncBase : NSObject { BOOL isFinished_; } @property (nonatomic, readonly) BOOL isFinished; and I want to set it to YES in a block at some point later, without creating a retain cycle to self: - (void)doSomethingWithFinishedBlock:(MyFinishedBlock)theFinishedBlock { __weak MyClass *weakSelf = self; MyFinishedBlock finishedBlockWrapper = ^(BOOL success, NSError *e) { [weakSelf willChangeValueForKey:@"isFinished"]; weakSelf -> isFinished_ = YES; [weakSelf didChangeValueForKey:@"isFinished"]; theFinishedBlock(success, e); }; self.finishedBlock = finishedBlockWrapper; // finishedBlock is a class ext. property } I'm unsure that this is the right way to do it (I hope I'm not embarrassing myself here ^^). Will this code leak, or break, or is it fine? Perhaps there is an easier way I have overlooked? SOLUTION Thanks to the answers below (especially Krzysztof Zablocki), I was shown the way to go here: Define isFinished as readwrite property in the class extension (somehow I missed that one) so no direct ivar assignment is needed, and change code to: - (void)doSomethingWithFinishedBlock:(MyFinishedBlock)theFinishedBlock { __weak MyClass *weakSelf = self; MyFinishedBlock finishedBlockWrapper = ^(BOOL success, NSError *e) { MyClass *strongSelf = weakSelf; strongSelf.isFinished = YES; theFinishedBlock(success, e); }; self.finishedBlock = finishedBlockWrapper; // finishedBlock is a class ext. property }

    Read the article

  • Rails - Scalable calculation model

    - by H O
    I currently have a calculation structure in my rails app that has models metric, operand and operation_type. Presently, the metric model has many operands, and can perform calculations based on the operation_type (e.g. sum, multiply, etc.), and each operand is defined as being right or left (i.e. so that if the operation is division, the numerator and denominator can be identified). Presently, an operand is always an attribute of some model, e.g. @customer.sales.selling_price.sum. In order to make this scalable, in need to allow an operand to be either an attribute of some kind, or the results of a previous operation, i.e. an operand can be a metric. I have included a diagram of how my models currently look: Can anyone assist me with the most elegant way of allowing an operand to be an actual operand, or another metric? Thanks! EDIT: It seems based on the only answer so far that perhaps polymorphic associations are the way to go on this, but the answer is so brief I have no idea how they could be used in this way - can anyone elaborate? EDIT 2: OK, I think I'm getting somewhere - essentially i presently have a metric, which has_many operands, and an operand has_many metrics. I need a polymorphic self join, where a metric can also have many metrics - do I need to call this something else, perhaps calculated_metrics, so that the metric model can use itself? That would leave me with a situation where a metric has_many operands, and a metric has many calculated_metrics.

    Read the article

  • Don't know how to encrypt database using SQLCipher

    - by Armaan
    I have included SQLCipher into my project exactly like explained in this link: http://sqlcipher.net/ios-tutorial/ But I am not sure how to encrypt the database I have read description from above link but not getting. Actually what I am doing is if application is opening first time then it will copy the database(i.e. without encryption) to the document directory. One more thing my database is blank when copying from bundle to document directory. I have tried to use sqlite3_key function after opening the database but nothing is encrypted. But I didn't found something like how to encrypt database when copying from bundle to document directory. I am planning to use FMDB so it would be better to reply according to that. Please guide me how to do that or point to direction if is there any tutorial for it. Also suggest what should be the standard approach to do that.

    Read the article

  • how to distinct one column when using inner join

    - by kusha
    i am using two table postjob and job location want to distinct jobtitle The query is: select postjob.jobtitle, postjob.industry, postjob.companyname, postjob.jobdescription, postjob.postid, postjob.PostingDate, Job_Location.Location, Job_Location.PostigID from postjob inner join Job_Location on postjob.postid = Job_Location.PostigID Where postjob.industry=' Marketing, Advertising' output of this query http://www.justlocaldial.com/Industry_search.aspx?ind=Marketing,%20Advertising

    Read the article

  • Stop image from tiling

    - by Glen Morse
    I have a procedure: procedure DrawSolidHexImage(Target: TCanvas; { Canvas to draw hex on } Fillstyle : TBrushStyle; { How to fill the hex } Fillcolor : TColor; { Color to fill it } fillimage : Tbitmap; { Image to show} Linestyle : TPenStyle; { What kind of lines } LineColor : Tcolor; { What color for lines } x,y,radius: integer; { Position and size of Hex } button : boolean); { Make hexes look like buttons? } When I use this, the image is tiled to fill the area. Is there something I can add or must remove to make it not tile? Thus not repeating the image. Maybe make it center? The Code in which I use DrawSolidHexImage looks like: procedure THexMap.ImageAHex(ImageWanted : TBitmap; HexPatternWanted: TBrushStyle; MapLocation:TPoint); var p0:TPoint; begin if FHexMapOn and FDrawSolidMap and (not UseSavedMap) then begin with TempMap.canvas do p0 := ConvertCoords(Point(MapLocation.x,MapLocation.y),ptROWCOL); DrawSolidHexImage(TempMap.Canvas,HexPatternWanted,clGray, Imagewanted,psSolid,LineColor,p0.x,p0.y,hexradius,hex3d); Refresh; end; end;

    Read the article

  • Modify a php limit text function adding some kind of offset to it

    - by webmasters
    Maybe you guys can help: I have a variable called $bio with bio data. $bio = "Hello, I am John, I'm 25, I like fast cars and boats. I work as a blogger and I'm way cooler then the author of the question"; I search the $bio using a set of functions to search for a certain word, lets say "author" which adds a span class around that word, and I get: $bio = "Hello, I am John, I'm 25, I like fast cars and boats. I work as a blogger and I'm way cooler then the <span class=\"highlight\">author</span> of the question"; I use a function to limit the text to 85 chars: $bio = limit_text($bio,85); The problem is when there are more then 80 chars before the word "author" in $bio. When the limit_text() is applied, I won't see the highlighted word author. What I need is for the limit_text() function to work as normal, adding all the words that contain the span class highlight at the end. Something like this: *"This is the limited text to 85 chars, but there are no words with the span class highlight so I am putting to be continued ... **author**, **author2** (and all the other words that have a span class highlight around them separate by comma "* Hope you understood what I mean, if not, please comment and I'll try to explain better. Here is my limit_text() function: function limit_text($text, $length){ // Limit Text if(strlen($text) > $length) { $stringCut = substr($text, 0, $length); $text = substr($stringCut, 0, strrpos($stringCut, ' ')); } return $text; } UPDATE: $xturnons = str_replace(",", ", ", $xturnons); $xbio = str_replace(",", ", ", $xbio); $xbio = customHighlights($xbio,$toHighlight); $xturnons = customHighlights($xturnons,$toHighlight); $xbio = limit_text($xbio,85); $xturnons = limit_text($xturnons,85); The customHighlights function which adds the span class highlighted: function addRegEx($word){ // Highlight Words return "/" . $word . '[^ ,\,,.,?,\.]*/i'; } function highlight($word){ return "<span class='highlighted'>".$word[0]."</span>"; } function customHighlights($searchString,$toHighlight){ $searchFor = array_map('addRegEx',$toHighlight); $result = preg_replace_callback($searchFor,'highlight',$searchString); return $result; }

    Read the article

  • Eclipse > Javascript > Code highlighting not working with Object Notation

    - by Redsandro
    I am using Eclipse Helios with PDT, and when I am editing JavaScript files with the default JavaScript Editor (JSDT), code highlighting (Mark Occurrences) is not working for half of the code, for example JSON-style (or Object Literal if you will) declarations. Little example: Foo = {}; Foo.Bar = Foo.Bar || {}; Foo.Bar = { bar: function(str) { alert(str) }, baz: function(str) { this.bar(str); // This bar *is* highlighted though } }; Foo.Bar.baz('text'); No Bar, bar or baz is highlighted. For now, I humbly edit the JavaScript part of projects in Notepad++ because it just highlights every occurrence of whatever is currently selected. Is there a common practice for Eclipse JavaScript developers to get code highlighting work correctly, using the popular Object Literal notation? An option or update I missed? -update- I have found that code highlighting depends on the code being properly outlined. Altough commonly used, Object Literal outlining still seems rare in javascript editors. the Spket Javascript Editor does partial Object Literal outlining, and the Aptana Javascript Editor does full Object Literal outlining. But both loses other important functionality. A quest for the editor with the least loss of functionality is currently in progress in this question.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17  | Next Page >