Search Results

Search found 2396 results on 96 pages for 'alex nauda'.

Page 74/96 | < Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >

  • How to peform an external request in Kohana 3?

    - by alex
    I've always used cURL for this sort of stuff, but this article got me thinking I could request another page easily using the Request object in Kohana 3. $url = 'http://www.example.com'; $update = Request::factory($url); $update->method = 'POST'; $update->post = array( 'key' => 'value' ); $update->execute(); echo $update->response; However I get the error Accessing static property Request::$method as non static From this I can assume it means that the method method is static, but that doesn't help me much. I also copied and pasted the example from that article and it threw the same error. Basically, I'm trying to POST to a new page on an external server, and do it the Kohana way. So, am I doing this correctly, or should I just use cURL (or file_get_contents() with context)?

    Read the article

  • Removing title from wp_list_cats()

    - by Alex
    I'm trying to remove/replace the title attribute on the category elements used by WordPress. I'm using WordPress 2.9.1, with the following code: <div id="categories"> <h3>Manufacturers</h3> <ul> <?php str_replace("title=\"View all posts filed under ","",wp_list_categories('use_desc_for_title=0&exclude=1,2,3,4,5&title_li=&hierarchical=1')); ?> </ul> </div> From what I had read this method used to work on older versions (I had never tried it though). I really don't want to hack at the interals of WordPress, or have to use a JavaScript hack, for something so straight forward. Any help is appreciated... Update below is what is created from the code above... Manufacturers Featured

    Read the article

  • Linux directories

    - by Alex Farber
    I am writing installation script for my program, which is supposed to run on Linux/Unix OS. What is the default directory for the following files: Executable files (programs). Program should be executed by typing its name from the command line. Shared libraries. Third-party shared libraries (the program is not open source, so I need to redistribute third-party libraries). Read-only program configuration files for all users. Configuration data available for read/write access for all users.

    Read the article

  • Using LEFT JOIN to only selection one joined row

    - by Alex
    I'm trying to LEFT JOIN two tables, to get a list of all rows from TABLE_1 and ONE related row from TABLE_2. I have tried LEFT JOIN and GROUP BY c_id, however I wan't the related row from TABLE_2 to be sorted by isHeadOffice DESC. Here are some sample tables TABLE 1 c_id Name ---------------- 1 USA 2 Canada 3 England 4 France 5 Spain TABLE2 o_id c_id Office isHeadOffice ------------------------------------------------ 1 1 New York 1 2 1 Washington 0 3 1 Boston 0 4 2 Toronto 0 5 3 London 0 6 3 Manchester 1 7 4 Paris 1 8 4 Lyon 0 So what I am trying to get from this would be something like: RESULTS c_id Name Office ---------------------------- 1 USA New York 2 Canada Toronto 3 England Manchester 4 France Paris 5 Spain NULL I'm using PHP & MySQL. Any ideas?

    Read the article

  • Why is this Scala example of implicit paremeter not working?

    - by Alex R
    simple REPL test... def g(a:Int)(implicit b:Int) = {a+b} Why do neither of these attempted usages work? 1. scala class A { var b:Int =8; var c = g(2) } :6: error: could not find implicit value for parameter b: Int class A { var b:Int =8; var c = g(2) } 2. scala class A(var b:Int) { var c = g(2) } :6: error: could not find implicit value for parameter b: Int class A(var b:Int) { var c = g(2) } ^ Thanks

    Read the article

  • "reduce" or "apply" using logical functions in Clojure

    - by Alex B
    I cannot use logical functions on a range of booleans in Clojure (1.2). Neither of the following works due to logical functions being macros: (reduce and [... sequence of bools ...]) (apply or [... sequence of bools ...]) The error saying that I "can't take value of a macro: #'clojure.core/and". How to apply these logical functions (macros) without writing boilerplate code?

    Read the article

  • Need help with cURL and POSTing in PHP

    - by alex
    I need to post to a payment gateway. The example PHP script for the gateway simply sets the XML like this curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlRequest); // $xmlRequest is just a string of XML In all of my experience, generally you need to use an array with key/values or a string similar to GET params. I am using Kohana, and tracked down a cURL module. It accepts the POST key/values as an array only. Now, I could ditch the module and throw some cURL straight in, but I am using this module fine all throughout the site, so would prefer to use it here. So, my question is, how does that first one work? Does it just POST the whole thing without any named key? Is there a default key I could use for an array to get the module to work?

    Read the article

  • Normalizing a table

    - by Alex
    I have a legacy table, which I can't change. The values in it can be modified from legacy application (application also can't be changed). Due to a lot of access to the table from new application (new requirement), I'd like to create a temporary table, which would hopefully speed up the queries. The actual requirement, is to calculate number of business days from X to Y. For example, give me all business days from Jan 1'st 2001 until Dec 24'th 2004. The table is used to mark which days are off, as different companies may have different days off - it isn't just Saturday + Sunday) The temporary table would be created from a .NET program, each time user enters the screen for this query (user may run query multiple times, with different values, table is created once), so I'd like it to be as fast as possible. Approach below runs in under a second, but I only tested it with a small dataset, and still it takes probably close to half a second, which isn't great for UI - even though it's just the overhead for first query. The legacy table looks like this: CREATE TABLE [business_days]( [country_code] [char](3) , [state_code] [varchar](4) , [calendar_year] [int] , [calendar_month] [varchar](31) , [calendar_month2] [varchar](31) , [calendar_month3] [varchar](31) , [calendar_month4] [varchar](31) , [calendar_month5] [varchar](31) , [calendar_month6] [varchar](31) , [calendar_month7] [varchar](31) , [calendar_month8] [varchar](31) , [calendar_month9] [varchar](31) , [calendar_month10] [varchar](31) , [calendar_month11] [varchar](31) , [calendar_month12] [varchar](31) , misc. ) Each month has 31 characters, and any day off (Saturday + Sunday + holiday) is marked with X. Each half day is marked with an 'H'. For example, if a month starts on a Thursday, than it will look like (Thursday+Friday workdays, Saturday+Sunday marked with X): ' XX XX ..' I'd like the new table to look like so: create table #Temp (country varchar(3), state varchar(4), date datetime, hours int) And I'd like to only have rows for days which are off (marked with X or H from previous query) What I ended up doing, so far is this: Create a temporary-intermediate table, that looks like this: create table #Temp_2 (country_code varchar(3), state_code varchar(4), calendar_year int, calendar_month varchar(31), month_code int) To populate it, I have a union which basically unions calendar_month, calendar_month2, calendar_month3, etc. Than I have a loop which loops through all the rows in #Temp_2, after each row is processed, it is removed from #Temp_2. To process the row there is a loop from 1 to 31, and substring(calendar_month, counter, 1) is checked for either X or H, in which case there is an insert into #Temp table. [edit added code] Declare @country_code char(3) Declare @state_code varchar(4) Declare @calendar_year int Declare @calendar_month varchar(31) Declare @month_code int Declare @calendar_date datetime Declare @day_code int WHILE EXISTS(SELECT * From #Temp_2) -- where processed = 0) BEGIN Select Top 1 @country_code = t2.country_code, @state_code = t2.state_code, @calendar_year = t2.calendar_year, @calendar_month = t2.calendar_month, @month_code = t2.month_code From #Temp_2 t2 -- where processed = 0 set @day_code = 1 while @day_code <= 31 begin if substring(@calendar_month, @day_code, 1) = 'X' begin set @calendar_date = convert(datetime, (cast(@month_code as varchar) + '/' + cast(@day_code as varchar) + '/' + cast(@calendar_year as varchar))) insert into #Temp (country, state, date, hours) values (@country_code, @state_code, @calendar_date, 8) end if substring(@calendar_month, @day_code, 1) = 'H' begin set @calendar_date = convert(datetime, (cast(@month_code as varchar) + '/' + cast(@day_code as varchar) + '/' + cast(@calendar_year as varchar))) insert into #Temp (country, state, date, hours) values (@country_code, @state_code, @calendar_date, 4) end set @day_code = @day_code + 1 end delete from #Temp_2 where @country_code = country_code AND @state_code = state_code AND @calendar_year = calendar_year AND @calendar_month = calendar_month AND @month_code = month_code --update #Temp_2 set processed = 1 where @country_code = country_code AND @state_code = state_code AND @calendar_year = calendar_year AND @calendar_month = calendar_month AND @month_code = month_code END I am not an expert in SQL, so I'd like to get some input on my approach, and maybe even a much better approach suggestion. After having the temp table, I'm planning to do (dates would be coming from a table): select cast(convert(datetime, ('01/31/2012'), 101) -convert(datetime, ('01/17/2012'), 101) as int) - ((select sum(hours) from #Temp where date between convert(datetime, ('01/17/2012'), 101) and convert(datetime, ('01/31/2012'), 101)) / 8) Besides the solution of normalizing the table, the other solution I implemented for now, is a function which does all this logic of getting the business days by scanning the current table. It runs pretty fast, but I'm hesitant to call a function, if I can instead add a simpler query to get result. (I'm currently trying this on MSSQL, but I would need to do same for Sybase ASE and Oracle)

    Read the article

  • shell_exec syntax error. running in terminal directly is ok

    - by Alex
    Having this command: $command = "diff -bBdH --ignore-all-space <(echo 'hi') <(echo 'hi1')"; echo $command; $result = shell_exec($command); On the screen I see: sh: 1: Syntax error: "(" unexpected diff -bBdH --ignore-all-space <(echo 'hi') <(echo 'hi1') If I copy-paste the second line from the console output into the terminal, the result would be correct. (Reproduced on another machine too). I'm missing something dead simple here and can't see what it is. besides, why is my output reversed? I'm clearly echoing the command before executing it, thus the syntax error of the shell should appear after the shell_exec

    Read the article

  • JSF - Random Number using Beans (JAVA)

    - by Alex Encore Tr
    I am trying to create a jsf application which, upon page refresh increments the hit counter and generates two random numbers. What should be displayed on the window may look something like this: On your On your roll x you have thrown x and x For this program I decided to create two Beans, one to hold the page refresh counter and one to generate a random number. Those look like this for the moment: CounterBean.java package diceroll; public class CounterBean { int count=0; public CounterBean() { } public void setCount(int count) { this.count=count; } public int getCount() { count++; return count; } } RandomNumberBean.java package diceroll; import java.util.Random; public class RandomNumberBean { int rand=0; Random r = new Random(); public RandomNumberBean() { rand = r.nextInt(6); } public void setNextInt(int rand) { this.rand=rand; } public int getNextInt() { return rand; } } I have then created an index.jsp to display the above message. <html> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <f:view> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Roll the Dice</title> </head> <body> <h:form> <p> On your roll # <h:outputText value="#{CounterBean.count} " /> you have thrown <h:outputText value="#{RandomNumberBean.rand}" />and <h:outputText value="#{RandomNumberBean.rand} " /> </p> </h:form> </body> </f:view> </html> However, when I run the application, I get the following message: org.apache.jasper.el.JspPropertyNotFoundException: /index.jsp(14,20) '#{RandomNumberBean.rand}' Property 'rand' not found on type diceroll.RandomNumberBean Caused by: org.apache.jasper.el.JspPropertyNotFoundException - /index.jsp(14,20) '#{RandomNumberBean.rand}' Property 'rand' not found on type diceroll.RandomNumberBean I suppose there's a mistake with my faces-config.xml file, so I will post this here as well, see if somebody can provide some help: faces-config.xml <?xml version="1.0" encoding="UTF-8"?> <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" version="2.0"> <managed-bean> <managed-bean-name>CounterBean</managed-bean-name> <managed-bean-class>diceroll.CounterBean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> <managed-bean> <managed-bean-name>RandomNumberBean</managed-bean-name> <managed-bean-class>diceroll.RandomNumberBean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> </faces-config>

    Read the article

  • Why do I need to give my options a value attribute in my dropdown? JQuery related.

    - by Alex
    So far in my web developing experiences, I've noticed that almost all web developers/designers choose to give their options in a select a value like so: <select name="foo"> <option value="bar">BarCheese</option> // etc. // etc. </select> Is this because it is best practice to do so? I ask this because I have done a lot of work with jQuery and dropdown's lately, and sometimes I get really annoyed when I have to check something like: $('select[name=foo]').val() == "bar"); To me, many times that seems less clear than just being able to check the val() against BarCheese. So why is it that most web developers/designers specify a value paramater instead of just letting the options actual value be its value? And yes, if the option has a value attribute I know I can do something like this: $('select[name=foo] option:contains("BarCheese")').attr('selected', 'selected'); But I would still really like to know why this is done. Thanks!!

    Read the article

  • Surely eAsy but I am not able ... JQUERY UI - WIDGET - HEADER

    - by alex
    I was making this simple trial, but can anyone tell me why the distance from the border of DIV to the H2 header is so much ? How can I reduce it ? I don't want space ... Prova WIDGET <link rel="stylesheet" href="jquery-ui-1.8.custom/css/smoothness/jquery-ui-1.8.custom.css" type="text/css"> <link rel="stylesheet" href="jquery-ui-1.8.custom/development-bundle/ui/jquery-ui-1.8.custom.css" type="text/css"> <script src="jquery-ui-1.8.custom/development-bundle/jquery-1.4.2.js" type="text/javascript"></script> <script src="jquery-ui-1.8.custom/js/jquery-ui-1.8.custom.min.js" type="text/javascript"></script> <script type="text/javascript"> $(themify); function themify(){ $("div").addClass("ui-widget ui-widget-content ui-corner-all"); $("input").addClass("ui-button ui-button-text"); $(":header").addClass("ui-widget-header ui-corner-all"); //ui-widget } </script> <style>#test{display:none}</style> <script type="text/javascript"> function rendiVisibile(){ if(document.getElementById("test").style.display = "none"){ $("#test").css({"width":"200px","float":"right","text-align":"center"}); $("#test").show("slide",{},1000); } } </script> </head> <body> <h2>Tentativo widget con DIV</h2> <form action=""> <input type="button" value="Submit" id="pulsante" onclick="rendiVisibile()";><br/></br> <div id="test"> <h2>CIAO</h2> Un saluto </div> </form> </body>

    Read the article

  • Get node name with minidom

    - by Alex
    Is it possible to get the name of a node using minidom? for example i have a node: <heading><![CDATA[5 year]]></heading> what i'm trying to do is store the value heading so that i can use it as a key in a dictionary, the closest i can get is something like [<DOM Element: heading at 0x11e6d28>] i'm sure i'm overlooking something very simple here, thanks!

    Read the article

  • Add 'Current' property to ASP.NET control

    - by Alex
    Hi! I have some control. I add one instance of this control to every Page in OnInit event and I want to access this control in other places in this way: Sample.Current public class Sample : Control { public static Sample Current { get { // ??? } } } Can you tell me what is the best way to do this property implementation?

    Read the article

  • How much data can a javascript global variable hold??

    - by alex
    Hi, To enable a go back function with an ajax div i have create these simple functions and i was wondering how much data a .js global variable can hold?? var dataAfterSearch; //global variable which holds our search results function goBackAfterSearch() { /** * function which displays the previous state * **/ $.ajaxSetup ({ cache: false }); //alert("Previous Search" +dataAfterSearch); $('#result').html(dataAfterSearch); paginateIt(); } function setDataAfterSearch(data) { /** * function to set the global dataAfterSearch * **/ dataAfterSearch = data; } kind regards

    Read the article

  • Query Execution Plan - When is the Where clause executed?

    - by Alex
    I have a query like this (created by LINQ): SELECT [t0].[Id], [t0].[CreationDate], [t0].[CreatorId] FROM [dbo].[DataFTS]('test', 100) AS [t0] WHERE [t0].[CreatorId] = 1 ORDER BY [t0].[RANK] DataFTS is a full-text search table valued function. The query execution plan looks like this: SELECT (0%) - Sort (23%) - Nested Loops (Inner Join) (1%) - Sort (Top N Sort) (25%) - Stream Aggregate (0%) - Stream Aggregate (0%) - Compute Scalar (0%) - Table Valued Function (FullTextMatch) (13%) | | - Clustered Index Seek (38%) Does this mean that the WHERE clause ([CreatorId] = 1) is executed prior to the TVF ( full text search) or after the full text search? Thank you.

    Read the article

  • Shorter GUIDs than hashing a user id?

    - by Alex Mcp
    I'm wondering how Instapaper (bookmarklet that saves text) might generate URLs for their bookmarklet. Mine has a script src of something similar to www.instapaper.com/j/AnJHrfoDTRia The quality of these URLs is that they need to never collide, and not be really guessable (so other people can't save to your account). I know a simple approach might be to MD5 their email address (presumed to have been checked on signup for uniqueness), but then I'd end up with a super long string. This isn't a huge issue, but I'm wondering what techniques there are for shorter GUIDs that won't collide too often (this is obviously the tradeoff, but 12 characters above is pretty short in my opinion)

    Read the article

  • Making alarm clock with NSTimer

    - by Alex G
    I just went through trying to make an alarm clock app with local notifications but that didn't do the trick because I needed an alert to appear instead of it going into notification centre in iOS 5+ So far I've been struggling greatly with nstimer and its functions so I was wondering if anyone could help out. I want when the user selects a time (through UIDatePicker, only time) for an alert to be displayed at exactly this time. I have figured out how to get the time from UIDatePicker but I do not know how to properly set the firing function of nstimer. This is what I have attempted so far, if anyone could help... be much appreciated. Thank you Example (it keeps going into the function every second opposed to a certain time I told it too... not what I want): NSDate *timestamp; NSDateComponents *comps = [[[NSDateComponents alloc] init] autorelease]; [comps setHour:2]; [comps setMinute:8]; timestamp = [[NSCalendar currentCalendar] dateFromComponents:comps]; NSTimer *f = [[NSTimer alloc] initWithFireDate:timestamp interval:0 target:self selector:@selector(test) userInfo:nil repeats:YES]; NSRunLoop *runner = [NSRunLoop currentRunLoop]; [runner addTimer:f forMode: NSDefaultRunLoopMode];

    Read the article

  • ThickBox - update inside without redirect

    - by Alex Maslakov
    ASP.NET MVC and jQuery ThickBox. I show some content in ThickBox. It includes file upload form The view multi-media.apsx (it's strange, the this editor doesn't allow start the line with "<" in the code) form action="/upload/multi-media" method="post" enctype="multipart/form-data" label for="file"File name: input type="file" name="file" id="file" / input type="submit" value="Upload" / <% if (Model.Count > 0) { foreach (FileInfo mediaFile in Model) { <img width="100px" height="100px" src="<%: ResolveUrl("~/audio.png") %>" border="0" alt="<%: mediaFile.Name %>" / //................ After file upload I redirect to /upload/multi-media action and content shows in normal window, not in ThickBox. [ActionName("multi-media"), HttpPost] public ActionResult MultiMedia(HttpPostedFileBase file) { if (file.ContentLength > 0) { file.SaveAs(GenerateNewFileName(fullFileName)); return View("multi-media", model); } } How can I stay into ThickBox after file upload? I need show content in ThickBox all the time, even after the file upload.

    Read the article

  • replace commas with spaces from json array

    - by Alex
    I have a looping function creating: <li id="id1" name="Tag1,Tag2,Tag3"> <li id="id2" name="Tag1,Tag2,Tag3"> $.each(data.posts, function(i, post){ $('<li >', {id: this.id , name: post.tags}) }); How do I replace the commas between the tags with spaces. Also is there a way I can send the tags to a "class" attribute instead of "name". It seems to not work in Safari.

    Read the article

< Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >