Daily Archives

Articles indexed Tuesday June 8 2010

Page 19/122 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Having a Link Only Appear If a Logged-In User Appears on a Dynamic List

    - by John
    Hello, For the function below, I would like the link <div class="footervote"><a href="http://www...com/.../footervote.php">Vote</a></div> to only appear if the logged in user currently appears on editorlist.php. (I. e. if the loginid in the function corresponds to any of the usernames that currently appear in editorlist.php.) Appearing on editorlist.php is something that is dynamic. How can I do this? Thanks in advance, John function show_userbox() { // retrieve the session information $u = $_SESSION['username']; $uid = $_SESSION['loginid']; // display the user box echo '<div id="userbox"> <div class="username">'.$u.'</div> <div class="submit"><a href="http://www...com/.../submit.php">Submit an item.</a></div> <div class="changepassword"><a href="http://www...com/.../changepassword.php">Change Password</a></div> <div class="logout"><a href="http://www...com/.../logout.php">Logout</a></div> <div class="footervote"><a href="http://www...com/.../footervote.php">Vote</a></div> </div>'; } On editorlist.php: $sqlStr = "SELECT l.loginid, l.username, l.created, DATEDIFF(NOW(), l.created) AS days, COALESCE(s.total, 0) AS countSubmissions, COALESCE(c.total, 0) AS countComments, COALESCE(s.total, 0) * 10 + COALESCE(c.total, 0) AS totalScore, DATEDIFF(NOW(), l.created) + COALESCE(s.total, 0) * 10 + COALESCE(c.total, 0) AS totalScore2 FROM login l LEFT JOIN ( SELECT loginid, COUNT(1) AS total FROM submission GROUP BY loginid ) s ON l.loginid = s.loginid LEFT JOIN ( SELECT loginid, COUNT(1) AS total FROM comment GROUP BY loginid ) c ON l.loginid = c.loginid GROUP BY l.loginid ORDER BY totalScore2 DESC LIMIT 10"; $result = mysql_query($sqlStr); $arr = array(); echo "<table class=\"samplesrec1edit\">"; while ($row = mysql_fetch_array($result)) { echo '<tr>'; echo '<td class="sitename1edit1"><a href="http://www...com/.../members/index.php?profile='.$row["username"].'">'.stripslashes($row["username"]).'</a></td>'; echo '<td class="sitename1edit2">'.($row["countSubmissions"]).'</td>'; echo '<td class="sitename1edit2">'.($row["countComments"]).'</td>'; echo '<td class="sitename1edit2">'.($row["days"]).'</td>'; echo '<td class="sitename1edit2">'.($row["totalScore2"]).'</td>'; echo '</tr>'; } echo "</table>";

    Read the article

  • how do I base encode a binary file (JPG) in ruby

    - by Angela
    I have a binary files which needs to be sent as a string to a third-party web-service. Turns out it requires that it needs to be base64 encoded. In ruby I use the following: body = body << IO.read("#{@postalcard.postalimage.path}") body is a strong which conists of a bunch of strings as parameters. So...how do I base64 encode it into this string? Thanks.

    Read the article

  • Problem connecting to remote mysql database

    - by user361024
    I am trying to connect to a mysql db on a shared server. I am using a java application to make the connection. Problem doesn't happen when I connect to localhost db. URL = "jdbc:mysql://SHARED HOST IP:3306/DBNAME"; USER = "dbUSER"; PASS = "dbPASS"; Connection conn = DriverManager.getConnection(URL, USER, PASS); java.sql.SQLException: Access denied for user 'DBUSER'@'mycomputersIP???' (using password: YES) It is strange that it says denied for dbuser@ mycomputersip instead of dbuser@sharedhostIP Is there a setting on my wireless router that is screwing things up?

    Read the article

  • Please help! Delegate returns null via Dipendency Injection.

    - by Raj Aththanayake
    Can someone please help? I use Google code’s Moq framework for mocking within my Unit Tests and Unity for Dependency Injection. In my Test class private Mock<ICustomerSearchService> CustomerSearchServiceMock = null; private CustomerService customerService = null; private void SetupMainData() { CustomerSearchServiceMock = new Mock<ICustomerSearchService>(); customerService = new CustomerService (); // CustomerSearchService is a property in CustomerService and dependency is configuered via Unity customerService.CustomerSearchService = CustomerSearchServiceMock.Object; Customer c = new Customer () { ID = "AT" }; CustomerSearchServiceMock.Setup(s => s.GetCustomer(EqualsCondition)).Returns(c); } [TestMethod] public void GetCustomerData_Test_Method() { SetupMainData() var customer = customerService.GetCustomerData("AT"); } public static bool EqualsCondition(Customer customer) { return customer.ID.Equals("AT"); } In my Test class CustomerService class public class CustomerService : ICustomerService { [Dependency] public ICustomerSearchService CustomerSearchService { get; set; } public IEnumerable<SomeObject> GetCustomerData(string custID) { I GET Null for customer ?????} var customer = CustomerSearchService.GetCustomer (c => c.ID.Equals(custID)); //Do more things } } When I debug the code I can see CustomerSearchService has a proxy object, but the customer returns as null. Any ideas? Or is there something missing here? Note: ICustomerSearchService I have implemented below method. Customer GetCustomer(Func<Customer, bool> predicate);

    Read the article

  • GTKSharp, Pango, set font size quirkiness

    - by nubela
    Hi guys, I'm using GTK Sharp to work on some GUI for my app. Take a look at this chunk of code: Pango.FontDescription fontdesc = new Pango.FontDescription(); fontdesc.Family = "Sans"; //fontdesc.Size = 12; fontdesc.Weight = Pango.Weight.Semibold; SyncInfo.ModifyFont(fontdesc); Gdk.Color fontcolor = new Gdk.Color(255,255,255); SyncInfo.ModifyFg(StateType.Normal, fontcolor); Notice fontdesc.Size is commented out. Because only when I comment it out, will I see the label with text. If I set any value to it, the label will not appear. Also, I did a Console.WriteLine, and the default Size is 0. So I tried frontdesc.Size = 0, and it still disappears, any idea? Thanks!

    Read the article

  • How can I highlight empty fields in ASP.NET MVC 2 before model binding has occurred?

    - by Richard Poole
    I'm trying to highlight certain form fields (let's call them important fields) when they're empty. In essence, they should behave a bit like required fields, but they should be highlighted if they are empty when the user first GETs the form, before POST & model validation has occurred. The user can also ignore the warnings and submit the form when these fields are empty (i.e. empty important fields won't cause ModelState.IsValid to be false). Ideally it needs to work server-side (empty important fields are highlighted with warning message on GET) and client-side (highlighted if empty when losing focus). I've thought of a few ways of doing this, but I'm hoping some bright spark can come up with a nice elegant solution... Just use a CSS class to flag important fields Update every view/template to render important fields with an important CSS class. Write some jQuery to highlight empty important fields when the DOM is ready and hook their blur events so highlights & warning messages can be shown/hidden as appropriate. Pros: Quick and easy. Cons: Unnecessary duplication of importance flags and warning messages across views & templates. Clients with JavaScript disabled will never see highlights/warnings. Custom data annotation and client-side validator Create classes similar to RequiredAttribute, RequiredAttributeAdapter and ModelClientValidationRequiredRule, and register the adapter with DataAnnotationsModelValidatorProvider.RegisterAdapter. Create a client-side validator like this that responds to the blur event. Pros: Data annotation follows DRY principle (Html.ValidationMessageFor<T> picks up field importance and warning message from attribute, no duplication). Cons: Must call TryValidateModel from GET actions to ensure empty fields are decorated. Not technically validation (client- & server-side rules don't match) so it's at the mercy of framework changes. Clients with JavaScript disabled will never see highlights/warnings. Clone the entire validation framework It strikes me that I'm trying to achieve exactly the same thing as validation but with warnings rather than errors. It needs to run before model binding (and therefore validation) has occurred. Perhaps it's worth designing a similar framework with annotations like Required, RegularExpression, StringLength, etc. that somehow cause Html.TextBoxFor<T> etc. to render the warning CSS class and Html.ValidationMessageFor<T> to emit the warning message and JSON needed to enable client-side blur checks. Pros: Sounds like something MVC 2 could do with out of the box. Cons: Way too much effort for my current requirement! I'm swaying towards option 1. Can anyone think of a better solution?

    Read the article

  • Gtk equivalent for winforms BindingSource

    - by AvatarOfChronos
    Does anybody out there know of a Gtk equivalent for a System.Windows.Forms BindingSource? I'm trying to get a windows based project to work under a gtk environment and can't use the Windows.Forms dll for this. So does anybody know of a BindingSource replacement either in mono or a third party dll? (I've looked at the gtk-databindings project didn't seem to have what i need)

    Read the article

  • ReSharper conventions for names of event handlers.

    - by Belousov Pavel
    Hello, When I add new event handler for any event, VS creates method like Button_Click. But ReSharper underlines this method as Warning, because all methods should not have any delimeters such as "_". How can I customize rules of ReSharper so that it doesn't underline such methods? Or may be I should rename such methods? Thanks in advance.

    Read the article

  • Gtk# property grid.

    - by AvatarOfChronos
    Does anybody out there know of a lgpl licensed Property Grid control for c#. I know there is a property grid control in the monodevelop source but I was wondering if there were other options?

    Read the article

  • WinForms vs GtkSharp with Mono

    - by Adam Haile
    When developing with Mono for an app to be run on Windows and Mac OSX (and maybe Linux) which would you suggest, WinForms or GtkSharp for the GUI and why? Specific examples and success/horror stories would be much appreciated.

    Read the article

  • Winforms for Mono on Mac, Linux and PC (Redux)

    - by yar
    (I asked this question in another way, and got some interesting responses but I'm not too convinced.) Is Mono's GtkSharp truly cross-platform? It seems to be Gnome based... how can that work with PC and Mac? Can someone give me examples of a working Mac/PC/Linux app that is written with a single codebase in Microsoft .Net?

    Read the article

  • SimpleModal, How to close pop up window with animation

    - by bhsstudio
    Hi, I am very new to jQuery. I have a questino about the SimpleModal. I am trying to close the pop up window with animation effect, but failed. Here is my code. $('#btnClose').click(function(e) { // Closing animations $("#content").modal({ onClose: function(dialog) { dialog.data.fadeOut('slow', function() { dialog.container.hide('slow', function() { dialog.overlay.slideUp('slow', function() { $.modal.close(); }); }); }); } }); }); <div id="content" style="display: none;"> <h1>Basic Modal Dialog</h1> <a href='#' id="btnCloset">Close</a> </div> When I click on the "Close" link, nothing happens. Any help please? Thank you very much!

    Read the article

  • Qt - QPushButton text formatting

    - by Narek
    I have a QPushButton and on that I have a text and and icon. I want to make the text on the button to be bold and red. Looked at other forums, googled and lost my hope. Seems there is no way to do that if the button has an icon (of course if you don't creat a new icon wich is text+former icon). Is that the only way? Anyone has a better idea?

    Read the article

  • SQL SERVER Merge Operations Insert, Update, Delete in Single Execution

    This blog post is written in response to T-SQL Tuesday hosted by Jorge Segarra (aka SQLChicken). I have been very active using these Merge operations in my development. However, I have found out from my consultancy work and friends that these amazing operations are not utilized by them most of the time. Here is my [...]...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Still cant find a solution... about ajax call

    - by booota
    Okay I have this ajax call $('.updatecom .registercomplaint').click(function(){ updatecomplaints(); }); This calls the function updatecomplaints() function updatecomplaints() { var tno = $(".updatecom #tno").val(); var status = $(".updatecom #status").val(); if(status=='DONE') { $(".updatecom #con").val(''); } var tname = $(".updatecom #tname").val(); var rg11 = $(".updatecom #crg11").val(); var rg06 = $(".updatecom #crg06").val(); var tvpins = $(".updatecom #tvpins").val(); var jointer = $(".updatecom #jointer").val(); var cquantity = $(".updatecom #conqty").val(); var nooftv = $(".updatecom #tvno").val(); var misc = $(".updatecom #misc").val(); var tcomments = $(".updatecom #tcomments").val(); var con = $(".updatecom #con").val(); //alert(tno+status+tname+rg11+rg06+tvpins+jointer+cquantity+nooftv+misc+tcomments+con); $.ajax( { type: "POST", url: "up_functions.php", data: "ticket="+ tno +"& opt=upcom" +"& status="+ status +"& tname="+ tname +"& rg11="+ rg11 +"& rg06="+ rg06 +"& tvpins="+ tvpins +"& jointer="+ jointer +"& cquantity="+ cquantity +"& nooftv="+ nooftv +"& misc="+ misc +"& tcomments="+ tcomments +"& con="+ con, success: function(response) { alert(response); } }); } here is my up_functions.php $tno = htmlspecialchars(trim($_REQUEST['ticket'])); $status = htmlspecialchars(trim($_REQUEST['status'])); $tname = htmlspecialchars(trim($_REQUEST['tname'])); $rg11 = htmlspecialchars(trim($_REQUEST['rg11'])); $rg06 = htmlspecialchars(trim($_REQUEST['rg06'])); $tvpins = htmlspecialchars(trim($_REQUEST['tvpins'])); $jointer = htmlspecialchars(trim($_REQUEST['jointer'])); $cquantity = htmlspecialchars(trim($_REQUEST['cquantity'])); $nooftv = htmlspecialchars(trim($_REQUEST['nooftv'])); $misc = htmlspecialchars(trim($_REQUEST['misc'])); $tcomments = htmlspecialchars(trim($_REQUEST['tcomments'])); $con = htmlspecialchars(trim($_REQUEST['con'])); $result=$ptr->upcomticketinfo($tno,$status,$tname,$rg11,$rg06,$tvpins,$jointer,$cquantity,$nooftv,$misc,$tcomments,$con); echo $result; and here is my upconticketinfo() php function function upcomticketinfo($tno,$status,$tname,$rg11,$rg06,$tvpins,$jointer,$cquantity,$nooftv,$misc,$tcomments,$con) { if($con!='' || $con!=NULL) { $this->query = "update `booking discription` set `STATUS`='$status',`CLOSED ON`='$con' where `TICKET NO`='$tno'"; $this->q_result = mysql_query($this->query,$this->conn) or die(mysql_error()); if($this->q_result) { $query = "update `tech detail` set `TECH NAME`='$tname',`CABLE RG11`='$rg11',`CABLE RG06`='$rg06',`TV PINS USED`='$tvpins',`JOINTER USED`='$jointer',`CONNECTOR QTY`='$cquantity',`NO OF TV`='$nooftv',`MISC`='$misc',`TECH COMMENTS`='$tcomments' where `BOOKING`='$tno'"; $q_result = mysql_query($query,$this->conn) or die(mysql_error()); if($q_result) { $response = "updated"; } else { $response = "error"; } } else { $response = "error"; } } else { $this->query = "update `booking discription` set `STATUS`='$status' where `TICKET NO`='$tno'"; $this->q_result = mysql_query($this->query,$this->conn) or die(mysql_error()); if($this->q_result) { $query = "update `tech detail` set `TECH NAME`='$tname',`CABLE RG11`='$rg11',`CABLE RG06`='$rg06',`TV PINS USED`='$tvpins',`JOINTER USED`='$jointer',`CONNECTOR QTY`='$cquantity',`NO OF TV`='$nooftv',`MISC`='$misc',`TECH COMMENTS`='$tcomments' where `BOOKING`='$tno'"; $q_result = mysql_query($query,$this->conn) or die(mysql_error()); if($q_result) { $response = "updated"; } else { $response = "error"; } } else { $response = "error"; } } return $response; } Question is that, this code is working just fine in IE8 i.e i am using... but it is not working in FF 3.6.3... I have checked each n everything... One thing is that the code works fine on FF too only when i debug the page with firebug debugger. Otherwise the alert in ajax success shows itself with nothing in it... Help me...

    Read the article

  • Using C# Type as generic

    - by I Clark
    I'm trying to create a generic list from a specific Type that is retrieved from elsewhere: Type listType; // Passed in to function, could be anything var list = _service.GetAll<listType>(); However I get a build error of: The type or namespace name 'listType' could not be found (are you missing a using directive or an assembly reference?) Is this even possible or am I setting foot onto C# 4 Dynamic territory? As a background: I want to automatically load all lists with data from the repository. The code below get's passed a Form Model whose properties are iterated for any IEnum (where T inherits from DomainEntity). I want to fill the list with objects of the Type the list made of from the repository. public void LoadLists(object model) { foreach (var property in model.GetType() .GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty)) { if (IsEnumerableOfNssEntities(property.PropertyType)) { var listType = property.PropertyType.GetGenericArguments()[0]; var list = _repository.Query<listType>().ToList(); property.SetValue(model, list, null); } } }

    Read the article

  • Why doesn't my android application show up in the launcher?

    - by rushinge
    I'm developing an application for the Android platform targeted for api level 4 (Android 1.6) but I can't get it to show up on my phone and I can't figure out why. Here's my AndroidManifest.xml is there a problem in here? Or is there something else I should be looking at? <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.sbe.app.hellocogen" android:versionCode="1" android:versionName="1.0"> <uses-permission android:name="android.permission.INTERNET" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".activity.ListPlants" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".activity.AddPlant" android:label="Add Plant"> <intent-filter> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> <activity android:name=".activity.UnitActivity" android:label="IP HERE, PLANT NAME"> <intent-filter> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="4"/> </manifest> When I started this application it didn't show up but I fixed it by setting the minimum api level to 4 instead of 7 then it started showing up but now it stopped showing up again and I don't know why.

    Read the article

  • How to R/W hard disk when CPU is in Protect Mode?

    - by smwikipedia
    I am doing some OS experiment. Until now, all my code utilized the real mode BIOS interrupt to manipulate hard disk and floppy. But once my code enabled the Protect Mode of the CPU, all the real mode BIOS interrupt service routine won't be available. How could I R/W the hard disk and floppy? I have a feeling that I need to do some hardware drivers now. Am I right? Is this why an OS is so difficult to develop? I know that hardwares are all controlled by reading from and writing to certain control or data registers. For example, I know that the Command Block Registers of hard disk range from 0x1F0 to 0x1F7. But I am wondering whether the register addresses of so many different hardwares are the same on the PC platform? Or do I have to detect that before using them? How to detect them?? For any responses I present my deep appreciation.

    Read the article

  • How do I update an xml file with msbuild with two namespaces?

    - by c3rin
    This msbuild below task can take into account one namespace, but in the case where I'm updating an mxml (flex) that has a mix of namespaces, can I use this task or another msbuild task to do the update? <XmlUpdate Prefix="fx" Namespace="http://ns.adobe.com/mxml/2009" XmlFileName="myFlexApp.mxml" Xpath="//mx:Application/fx:Declarations/fx:String[@id='stringId']" Value="xxxxx"> Here is the flex xml I'm trying to update: <mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark"> <fx:Declarations> <fx:String id="stringId">UPDATE_ME</fx:String> </fx:Declarations></mx:Application>

    Read the article

  • is it the right reqular expression

    - by girish
    i have following regular expression but it's not working properly it takes only three values after @ sign but i want it to be any number length "/^[a-zA-Z0-9_.-]+\@([a-zA-Z0-9-]+.)+[a-zA-Z0-9]{2,4}$/" this@thi This is validated this@this It is not validating this expression Can you please tell me what's the problem with the expression... Thanks

    Read the article

  • Weird problem: IE8 user can't authenticate with web service

    - by NovaJoe
    I have an asp.net app. It has a page that requires authentication. The authenticated user can view the page because he/she is authenticated. The page makes a jQuery Ajax call to a WCF service. The WCF service checks that the user is authenticated via HttpContext. I have a user that is using WinXP and IE8. This user can authenticate to the page, but when the Ajax call is made from the page to the wb service, the user recieves my "session not authenticated" message on the page, generated by the service and displayed on the page. When I use the same OS/browser combo, the page and service work just fine, as expected; no errors. What option in this user's IE settings would cause this behavior?

    Read the article

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