Daily Archives

Articles indexed Friday June 28 2013

Page 9/19 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • How can I properly implement inetcpl.cpl as an external dll?

    - by Kyt
    I have the following 2 sets of code, both of which produce the same results: using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ResetIE { class Program { [DllImport("InetCpl.cpl", SetLastError=true, CharSet=CharSet.Unicode, EntryPoint="ClearMyTracksByProcessW")] public static extern long ClearMyTracksByProcess(IntPtr hwnd, IntPtr hinst, ref TargetHistory lpszCmdLine, FormWindowState nCmdShow); static void Main(string[] args) { TargetHistory th = TargetHistory.CLEAR_TEMPORARY_INTERNET_FILES; ClearMyTracksByProcessW(Process.GetCurrentProcess().Handle, Marshal.GetHINSTANCE(typeof(Program).Module), ref th, FormWindowState.Maximized); Console.WriteLine("Done."); } } and ... static class NativeMethods { [DllImport("kernel32.dll")] public static extern IntPtr LoadLibrary(string dllToLoad); [DllImport("kernel32.dll")] public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName); [DllImport("kernel32.dll")] public static extern bool FreeLibrary(IntPtr hModule); } public class CallExternalDLL { [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate long ClearMyTracksByProcessW(IntPtr hwnd, IntPtr hinst, ref TargetHistory lpszCmdLine, FormWindowState nCmdShow); public static void Clear_IE_Cache() { IntPtr pDll = NativeMethods.LoadLibrary(@"C:\Windows\System32\inetcpl.cpl"); if (pDll == IntPtr.Zero) { Console.WriteLine("An Error has Occurred."); } IntPtr pAddressOfFunctionToCall = NativeMethods.GetProcAddress(pDll, "ClearMyTracksByProcessW"); if (pAddressOfFunctionToCall == IntPtr.Zero) { Console.WriteLine("Function Not Found."); } ClearMyTracksByProcessW cmtbp = (ClearMyTracksByProcessW)Marshal.GetDelegateForFunctionPointer(pAddressOfFunctionToCall, typeof(ClearMyTracksByProcessW)); TargetHistory q = TargetHistory.CLEAR_TEMPORARY_INTERNET_FILES; long result = cmtbp(Process.GetCurrentProcess().Handle, Marshal.GetHINSTANCE(typeof(ClearMyTracksByProcessW).Module), ref q, FormWindowState.Normal); } } both use the following Enum: public enum TargetHistory { CLEAR_ALL = 0xFF, CLEAR_ALL_WITH_ADDONS = 0x10FF, CLEAR_HISTORY = 0x1, CLEAR_COOKIES = 0x2, CLEAR_TEMPORARY_INTERNET_FILES = 0x8, CLEAR_FORM_DATA = 0x10, CLEAR_PASSWORDS = 0x20 } Both methods of doing this compile and run just fine, offering no errors, but both churn endlessly never returning from their work. The PInvoke code was ported from the following VB, which was fairly difficult to track down: Option Explicit Private Enum TargetHistory CLEAR_ALL = &HFF& CLEAR_ALL_WITH_ADDONS = &H10FF& CLEAR_HISTORY = &H1& CLEAR_COOKIES = &H2& CLEAR_TEMPORARY_INTERNET_FILES = &H8& CLEAR_FORM_DATA = &H10& CLEAR_PASSWORDS = &H20& End Enum Private Declare Function ClearMyTracksByProcessW Lib "InetCpl.cpl" _ (ByVal hwnd As OLE_HANDLE, _ ByVal hinst As OLE_HANDLE, _ ByRef lpszCmdLine As Byte, _ ByVal nCmdShow As VbAppWinStyle) As Long Private Sub Command1_Click() Dim b() As Byte Dim o As OptionButton For Each o In Option1 If o.Value Then b = o.Tag ClearMyTracksByProcessW Me.hwnd, App.hInstance, b(0), vbNormalFocus Exit For End If Next End Sub Private Sub Form_Load() Command1.Caption = "??" Option1(0).Caption = "?????????????" Option1(0).Tag = CStr(CLEAR_TEMPORARY_INTERNET_FILES) Option1(1).Caption = "Cookie" Option1(1).Tag = CStr(CLEAR_COOKIES) Option1(2).Caption = "??" Option1(2).Tag = CStr(CLEAR_HISTORY) Option1(3).Caption = "???? ???" Option1(3).Tag = CStr(CLEAR_HISTORY) Option1(4).Caption = "?????" Option1(4).Tag = CStr(CLEAR_PASSWORDS) Option1(5).Caption = "?????" Option1(5).Tag = CStr(CLEAR_ALL) Option1(2).Value = True End Sub The question is simply what am I doing wrong? I need to clear the internet cache, and would prefer to use this method as I know it does what I want it to when it works (rundll32 inetcpl.cpl,ClearMyTracksByProcess 8 works fine). I've tried running both as normal user and admin to no avail. This project is written using C# in VS2012 and compiled against .NET3.5 (must remain at 3.5 due to client restrictions)

    Read the article

  • Data loss between conversion

    - by Alex Brooks
    Why is it that I loose data between the conversions below even though both types take up the same amount of space? If the conversion was done bitwise, it should be true that x = z unless data is being stripped during the conversion, right? Is there a way to do the two conversions without losing data (i.e. so that x = z)? main.cpp: #include <stdio.h> #include <stdint.h> int main() { double x = 5.5; uint64_t y = static_cast<uint64_t>(x); double z = static_cast<double>(y) // Desire : z = 5.5; printf("Size of double: %lu\nSize of uint64_t: %lu\n", sizeof(double), sizeof(uint64_t)); printf("%f\n%lu\n%f\n", x, y, z); } Results: Size of double: 8 Size of uint64_t: 8 5.500000 5 5.000000

    Read the article

  • Replacing a column in CSV file with another in bash

    - by user2525881
    I have a csv file with a number of columns. I am trying to replace the second column with the second to last column from the same file. For example, if I have a file, sample.csv 1,2,3,4,5,6 a,b,c,d,e,f g,h,i,j,k,l I want to output: 1,5,3,4,5,6 a,e,c,d,e,f g,k,i,j,k,l Can anyone help me with this task? Also note that I will be discarding the last two columns afterwards with the cut function so I am open to separating the csv file to begin with so that I can replace the column in one csv file with another column from another csv file. Whichever is easier to implement. Thanks in advance for any help.

    Read the article

  • align h1 before and after background

    - by renathy
    I have image before and after h1. However, I need to position it as following: h1 text should be in the center h1 before image should start at the left side of container h1 after image should end at the right side of container I cannot get all of them. For example, I can center h1 text, but then h1 before and h1 after images are not aligned correctly. Here is jsfiddle example: http://jsfiddle.net/wK8ve/ Also Html and css here: CSS: .test { border: 1px solid black; width: 1000px; height: 200px; } h1 { text-align: center; font-size: 22px; font-weight: bold; color: #5d5d5d; margin: 0 0 32px 0; } h1:before { text-align: left; background-image: url('http://modeles-de-lettres.org/test/images/h_ltr.png'); background-repeat: no-repeat; background-position: center left; padding: 0 352px 0 0; content: "\00a0"; } h1:after { background-image: url('http://modeles-de-lettres.org/test/images/h_rtl.png'); background-repeat: no-repeat; background-position: center right; padding: 0 180px; content: "\00a0"; } HTML: <div class="test"> <h1>Test</h1> </div> And here is live example: http://modeles-de-lettres.org/test/index.php?p=about_us

    Read the article

  • DroDownlist in DataGrid produces Error

    - by S Nash
    I have a DataGrid and everytime I change value of it's embeded dropdwonlist I get: "System.Web.HttpException: The IListSource does not contain any data sources." I have a data grid which loads fine: Name column is editable. I have a dropdownlist these : DataDataGrid gets its value from a table. (Select Name, Address From Persons) Dropdown list also gets list of names from the same table. So DataGrid and dropdownlist are bound to 2 different datasets. Here is my code for dataGrid" <Columns> <ASP:ButtonColumn Text="Delete" CommandName="Delete"></ASP:ButtonColumn> <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn> <ASP:TemplateColumn HeaderText="Name" SortExpression="FY" HeaderStyle-HorizontalAlign="center" HeaderStyle-Wrap="True"> <ItemStyle Wrap="false" HorizontalAlign="left" /> <ItemTemplate> <ASP:Label ID="Name" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' runat="server"/> </ItemTemplate> <EditItemTemplate> <ASP:DropDownList id="ddlName" cssClass="DropDownList" runat="server" datasource="<%#allNames%>" DataTextField= "Name" DataValueField="ID" Defaultvalue='<%# DataBinder.Eval(Container.DataItem, "ID") %>' OnPreRender="SetDefaultListItem" accessKey="I" AutoPostBack="true" /> </EditItemTemplate> </ASP:TemplateColumn> <asp:BoundColumn DataField="Address" ReadOnly="True" HeaderText="Address"></asp:BoundColumn> </Columns> Error happens here : dg.DataSource = ds dg.DataBind() Any ideas how to solve this issues? All I want is a DataGrid with a editable column ,which can be edited by choosing one of the value of in a dropdownlist.

    Read the article

  • Match string which doesn't start with

    - by Pinky
    I have a string that looks like this: var str = "Hello world, &nbsp;hello &gt;world, hello world!"; ... and I'd like to replace all the hellos with e.g. bye and world with earth, except the words that start with &nbsp or &gt. Those should be ignored. So the result should be: bye earth, &nbsp;hello &gt;world, bye earth! Tried to this with str.replace(/(?!\&nbsp;)hello/gi,'bye')); But it doesn't work.

    Read the article

  • HTML form isn't emailing

    - by Anonmattymous
    I have this as my form <div class="contactInputs"> <p>Send us a message</p> <form class="messageForm" autocomplete="on" name="contactform" method="post" action="/freequote.php"> <input type="text" name="name" placeholder="Name*" required> <input type="text" name="companyname" placeholder="Company Name"> <input type="email" name="email" placeholder="Email*" required> <input type="tel" name="phone" placeholder="Phone"> <input class="contact-submit" type="submit"> </form> <textarea type="textarea" name="message" placeholder="Your Messages*" required></textarea> </div> And this is the PHP used to do send the Email. <?php if(isset($_POST['email'])) { $email_to = "[email protected]"; $email_subject = "Your email subject line"; function died($error) { echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } if(!isset($_POST['name']) || !isset($_POST['companyname']) || !isset($_POST['email']) || !isset($_POST['phone']) || !isset($_POST['comments'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $name = $_POST['name']; $companyname = $_POST['companyname']; $email_from = $_POST['email']; $phone = $_POST['phone']; $message = $_POST['comments']; $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$name)) { $error_message .= 'The First Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$companyname)) { $error_message .= 'The Last Name you entered does not appear to be valid.<br />'; } if(strlen($message) < 2) { $error_message .= 'The Comments you entered do not appear to be valid.<br />'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "First Name: ".clean_string($name)."\n"; $email_message .= "Last Name: ".clean_string($companyname)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; $email_message .= "phone: ".clean_string($phone)."\n"; $email_message .= "Comments: ".clean_string($message)."\n"; $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> Thank you for contacting us. We will be in touch with you very soon. <?php } ?> But whenever i try to submit it, i get the errors We are very sorry, but there were error(s) found with the form you submitted. These errors appear below. We are sorry, but there appears to be a problem with the form you submitted. Please go back and fix these errors. Does anyone see whats wrong

    Read the article

  • Why does multiple calls to xalloc result in delayed output?

    - by Me myself and I
    When I print the id of a stream in a single expression it prints it backwards. Normally this is what comes out: std::stringstream ss; std::cout << ss.xalloc() << '\n'; std::cout << ss.xalloc() << '\n'; std::cout << ss.xalloc(); Output is: 4 5 6 But when I do it in one expression it prints backwards, why? std::stringstream ss; std::cout << ss.xalloc() << '\n' << ss.xalloc() << '\n' << ss.xalloc(); Output: 6 5 4 I know the order of evaluation is unspecified but then why does the following always result in the correct order: std::cout << 4 << 5 << 6; Can someone explain why xalloc behaves differently? Thanks.

    Read the article

  • Store code line in a string?

    - by user1342164
    I need to store code in a string so that if a value is true, it is in the code line if not true its not in the code line. When I populate summarytextbox if consulting amount is "" then dont use this code if is does have an amount include the code. Is this possible? Other wise I would have to do a bunch if then statements. When I do the following below it cant convert to double. Dim ConsultingFee As String Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Session("ConsultingFeeAmount") = "" Then Else 'Store the following line in a string???? ConsultingFee = +Environment.NewLine + Session("ConsultingFee") + " Amount: " + Session("ConsultingFeeAmount") End If SummaryTextBox.Text = Session("TeachingHospital") + Environment.NewLine + Session("HospitalAddress") + Environment.NewLine + Session("HospitalCity") + Environment.NewLine + Session("HospitalState") + Environment.NewLine + Session("HospitalZip") + Environment.NewLine + Session("HospitalTIN") + ConsultingFee End Sub

    Read the article

  • Kendo UI Combo Box Reset Value

    - by ciantrius
    I'm using the Kendo UI ComboBoxes in cascade mode to build up a filter that I wish to apply. How do I clear/reset the value of a Kendo UI ComboBox? I've tried: $("#comboBox").data("kendoComboBox").val(''); $("#comboBox").data("kendoComboBox").select(''); $("#comboBox").data("kendoComboBox").select(null); all to no avail. The project is an MVC4 app using the Razor engine and the code is basically the same as the Kendo UI example.

    Read the article

  • Can't find .Net 2.0 XML Schema

    - by Zach Smith
    I'm currently setting up an application config for a WPF application written in .Net 4.0. The connection string in the app.config is encrypted like so: <connectionStrings configProtectionProvider="DataProtectionConfigurationProvider"> <EncryptedData> <CipherData> <CipherValue>CypherValue</CipherValue> </CipherData> </EncryptedData> </connectionStrings> To use the EncryptedData element I need to include the XMLNS "http://schemas.microsoft.com/.NetConfiguration/v2.0". Attempting to include it produces an error as the schema cannot be found. Is there a way to include the schema or perhaps a different element I could use instead of EncryptedData?

    Read the article

  • Reducer getting fewer records than expected

    - by sathishs
    We have a scenario of generating unique key for every single row in a file. we have a timestamp column but the are multiple rows available for a same timestamp in few scenarios. We decided unique values to be timestamp appended with their respective count as mentioned in the below program. Mapper will just emit the timestamp as key and the entire row as its value, and in reducer the key is generated. Problem is Map outputs about 236 rows, of which only 230 records are fed as an input for reducer which outputs the same 230 records. public class UniqueKeyGenerator extends Configured implements Tool { private static final String SEPERATOR = "\t"; private static final int TIME_INDEX = 10; private static final String COUNT_FORMAT_DIGITS = "%010d"; public static class Map extends Mapper<LongWritable, Text, Text, Text> { @Override protected void map(LongWritable key, Text row, Context context) throws IOException, InterruptedException { String input = row.toString(); String[] vals = input.split(SEPERATOR); if (vals != null && vals.length >= TIME_INDEX) { context.write(new Text(vals[TIME_INDEX - 1]), row); } } } public static class Reduce extends Reducer<Text, Text, NullWritable, Text> { @Override protected void reduce(Text eventTimeKey, Iterable<Text> timeGroupedRows, Context context) throws IOException, InterruptedException { int cnt = 1; final String eventTime = eventTimeKey.toString(); for (Text val : timeGroupedRows) { final String res = SEPERATOR.concat(getDate( Long.valueOf(eventTime)).concat( String.format(COUNT_FORMAT_DIGITS, cnt))); val.append(res.getBytes(), 0, res.length()); cnt++; context.write(NullWritable.get(), val); } } } public static String getDate(long time) { SimpleDateFormat utcSdf = new SimpleDateFormat("yyyyMMddhhmmss"); utcSdf.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles")); return utcSdf.format(new Date(time)); } public int run(String[] args) throws Exception { conf(args); return 0; } public static void main(String[] args) throws Exception { conf(args); } private static void conf(String[] args) throws IOException, InterruptedException, ClassNotFoundException { Configuration conf = new Configuration(); Job job = new Job(conf, "uniquekeygen"); job.setJarByClass(UniqueKeyGenerator.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.class); job.setInputFormatClass(TextInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); // job.setNumReduceTasks(400); FileInputFormat.addInputPath(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.waitForCompletion(true); } } It is consistent for higher no of lines and the difference is as huge as 208969 records for an input of 20855982 lines. what might be the reason for reduced inputs to reducer?

    Read the article

  • Repeat Customers Each Year (Retention)

    - by spazzie
    I've been working on this and I don't think I'm doing it right. |D Our database doesn't keep track of how many customers we retain so we looked for an alternate method. It's outlined in this article. It suggests you have this table to fill in: Year Number of Customers Number of customers Retained in 2009 Percent (%) Retained in 2009 Number of customers Retained in 2010 Percent (%) Retained in 2010 .... 2008 2009 2010 2011 2012 Total The table would go out to 2012 in the headers. I'm just saving space. It tells you to find the total number of customers you had in your starting year. To do this, I used this query since our starting year is 2008: select YEAR(OrderDate) as 'Year', COUNT(distinct(billemail)) as Customers from dbo.tblOrder where OrderDate >= '2008-01-01' and OrderDate <= '2008-12-31' group by YEAR(OrderDate) At the moment we just differentiate our customers by email address. Then you have to search for the same names of customers who purchased again in later years (ours are 2009, 10, 11, and 12). I came up with this. It should find people who purchased in both 2008 and 2009. SELECT YEAR(OrderDate) as 'Year',COUNT(distinct(billemail)) as Customers FROM dbo.tblOrder o with (nolock) WHERE o.BillEmail IN (SELECT DISTINCT o1.BillEmail FROM dbo.tblOrder o1 with (nolock) WHERE o1.OrderDate BETWEEN '2008-1-1' AND '2009-1-1') AND o.BillEmail IN (SELECT DISTINCT o2.BillEmail FROM dbo.tblOrder o2 with (nolock) WHERE o2.OrderDate BETWEEN '2009-1-1' AND '2010-1-1') --AND o.OrderDate BETWEEN '2008-1-1' AND '2013-1-1' AND o.BillEmail NOT LIKE '%@halloweencostumes.com' AND o.BillEmail NOT LIKE '' GROUP BY YEAR(OrderDate) So I'm just finding the customers who purchased in both those years. And then I'm doing an independent query to find those who purchased in 2008 and 2010, then 08 and 11, and then 08 and 12. This one finds 2008 and 2010 purchasers: SELECT YEAR(OrderDate) as 'Year',COUNT(distinct(billemail)) as Customers FROM dbo.tblOrder o with (nolock) WHERE o.BillEmail IN (SELECT DISTINCT o1.BillEmail FROM dbo.tblOrder o1 with (nolock) WHERE o1.OrderDate BETWEEN '2008-1-1' AND '2009-1-1') AND o.BillEmail IN (SELECT DISTINCT o2.BillEmail FROM dbo.tblOrder o2 with (nolock) WHERE o2.OrderDate BETWEEN '2010-1-1' AND '2011-1-1') --AND o.OrderDate BETWEEN '2008-1-1' AND '2013-1-1' AND o.BillEmail NOT LIKE '%@halloweencostumes.com' AND o.BillEmail NOT LIKE '' GROUP BY YEAR(OrderDate) So you see I have a different query for each year comparison. They're all unrelated. So in the end I'm just finding people who bought in 2008 and 2009, and then a potentially different group that bought in 2008 and 2010, and so on. For this to be accurate, do I have to use the same grouping of 2008 buyers each time? So they bought in 2009 and 2010 and 2011, and 2012? This is where I'm worried and not sure how to proceed or even find such data. Any advice would be appreciated! Thanks!

    Read the article

  • How do I place an image centered in a DIV and text to the right? Overflow problems

    - by user2218041
    I have a div container where I want to put in a centered image and a small description to the right. The specifications are: The image should have a bottom margin of 35px. The image should always show fully on the screen, so it resizes when the screen does. It should have the biggest size possible, but never be cropped and never use scrollbars. The image should be centered with respect to the container, with the text showing on the right margin. The text should be left-aligned horizontally, center-aligned vertically and have a 30px separation from the image. I've tried using a table in the container and using divs, but I can't find a clean solution. I can show you the non-working code I've tried on request.

    Read the article

  • Copy and paste between sheets in a workbook with VBA code

    - by Hannah
    Trying to write a macro in VBA for Excel to look at the value in a certain column from each row of data in a list and if that value is "yes" then it copies and pastes the entire row onto a different sheet in the same workbook. Let's name the two sheets "Data" and "Final". I want to have the sheets referenced so it does not matter which sheet I have open when it runs the code. I was going to use a Do loop to cycle through the rows on the one data sheet until it finds there are no more entries, and if statements to check the values. I am confused about how to switch from one sheet to the next. How do I specifically reference cells in different sheets? Here is the pseudocode I had in mind: Do while DataCells(x,1).Value <> " " for each DataCells(x,1).Value="NO" if DataCells(x,2).Value > DataCells(x,3).Value or _ DataCells(x,4).Value < DataCells(x,5).Value 'Copy and paste/insert row x from Data to Final sheet adding a new 'row for each qualifying row else x=x+1 end else if DataCells(x,1).Value="YES" Loop 'copy and paste entire row to a third sheet 'continue this cycle until all rows in the data sheet are examined

    Read the article

  • Running script constantly in background: daemon, lock file with crontab, or simply loop?

    - by Mauritz Hansen
    I have a Perl script that queries a database for a list of files to process processes the files and then exits Upon startup this script creates a file (let's say script.lock), and upon exit it removes this file. I have a crontab entry that runs this script every minute. If the lockfile exists then the script exits, assuming that another instance of itself is running. The above process works fine but I am not very happy with the robustness of this approach. Specifically, if for some reason the script exits prematurely and the lockfile is not removed then a new instance will not execute properly. I would appreciate some advice on the following: Is using the lock file a good approach or is there a better/more robust way to do this? Is using crontab for this a good idea or could I better write an endless loop with sleep()? Should I use the GNU 'daemon' program or the Perl Proc::Daemon module (or some other equivalent) for this?

    Read the article

  • Convert SelectedObjectCollection to Collection of Specific Type

    - by Jonathan Wood
    I have a WinForms multiselect listbox, and each item in the listbox is of type MyClass. I am also writing a method that needs to take a parameter that is a collection of MyClass. It could be of type MyClass[], List<MyClass>, IList<MyClass>, IEnumerable<MyClass>, etc. Any of those would work fine. Somehow, I need to pass the selected items in the listbox to my method. But how would I convert SelectedObjectCollection to any of the MyClass collection types described above?

    Read the article

  • NSFetchedResultsController doesn't fetch up the child-parent moc chain?

    - by Kronusdark
    I cannot find any clarification on this, so it may be a bug. Problem is, I have a series of parent-child Managed Object Context's. When I save on a child context the changes get pushed up to the parent, and I can fetch using a plain old NSFetchRequest. However, if I rely on an NSFetchedResultsController to pull these changes into a sibling context to the first, they do not see them. calling -(void)performFetch: error; doesn't seem to pull the changes either. After a restart of the app, all new data is available. My hypothesis is that NSFetchedResultsController only fetches from its current context and will not follow the chain to the persistent store. Can someone please set me straight here? Am I going to have to use notifications to monitor changes on other contexts? and finally, is this mentioned somewhere in the doc's? I cannot find it for the life of me.

    Read the article

  • Checkbox values to varchar via Spring

    - by iowatiger08
    I am trying to get a varchar message from a database to display the selected values of a checkbox field in a jsp for patient's medication's dosage frequency. The possible values will be saved in comma-delimited string in the varchar. For most form fields there is simply a one form value to one database field ratio, but in this case, I am needing to merge the values that would come as a string[] into the comma-delimited string and then when retrieving that record for that medication of that patient, display the selected values from the comma-delimited string as selected from the selectableDosageFrequencyList. You assistance in this is greatly appreciated as I am not sure what I am missing here. In the application context, I created the list of possible values as part of the ServiceBean. <property name="selectableDosageFrequencyList"> <set> <value>On an empty stomach</value> <value>Every other day</value> <value>4 times daily</value> <value>3 times daily</value> <value>Twice daily</value> <value>At bedtime</value> <value>With meal</value> <value>As needed</value> <value>Once daily</value> </set> </property> This is set up in the flow as requestscope. <view-state id="addEditMedication" model="medication"> <on-render> <set name="requestScope.selectableDosageFrequencyList" value="memberService.buildSelectableDosageFrequencyList(patient)" /> </on-render> ... <transition on="next" to="assessment" > <evaluate expression="memberService.updateMedication(patient, medication)" /> </transition> </view-state> I have helper methods in the memberService that need to be executed when the form is init and then when the form is completed. //get the form fields selected and build the new string for db public String setSelectedDosageFrequency(String [] dosageFrequencies){ String frequencies = null; if (dosageFrequencies != null){ for (String s : dosageFrequencies){ frequencies = frequencies + "," + s; } } return frequencies; } //get value from database and build selected Set public LinkedHashSet<String> getSelectedDosageFrequencyList(String dosageFrequency){ String copyOfDosages =dosageFrequency;//may not need to do this LinkedHashSet<String> setofSelectedDosageFrequency = new LinkedHashSet<String> (); while (copyOfDosages!= null && copyOfDosages.length()>0){ for (String aFrequency: selectableDosageFrequencyList){ if (copyOfDosages.contains(aFrequency)){ setofSelectedDosageFrequency.add(aFrequency); if (!copyOfDosages.equals(aFrequency) && copyOfDosages.endsWith(aFrequency)){ copyOfDosages.replaceAll(","+aFrequency, ""); }else if (!copyOfDosages.equals(aFrequency) && copyOfDosages.contains(aFrequency=",")){ copyOfDosages.replaceAll(aFrequency+",", ""); }else copyOfDosages.replaceAll(aFrequency, ""); copyOfDosages.trim(); } } } return setofSelectedDosageFrequency; } The Medication class that backs the form will have a variable for dosage-frequency as a string. private String dosageFrequency; The jsp I currently am doing this. <div class="formField"> <form:label path="dosageFrequency">Dosage Frequency</form:label> <ul class="multi-column double" style="width: 550px;"> <form:checkboxes path="dosageFrequency" items="${selectableDosageFrequencyList}" itemLabel="${selectableDosageFrequencyList}" element="li" /> </ul> </div>

    Read the article

  • objective C convert NSString to unsigned

    - by user1501354
    I have changed my question. I want to convert an NSString to an unsigned int. Why? Because I want to do parallel payment in PayPal. Below I have given my coding in which I want to convert the NSString to an unsigned int. My query is: //optional, set shippingEnabled to TRUE if you want to display shipping //options to the user, default: TRUE [PayPal getPayPalInst].shippingEnabled = TRUE; //optional, set dynamicAmountUpdateEnabled to TRUE if you want to compute //shipping and tax based on the user's address choice, default: FALSE [PayPal getPayPalInst].dynamicAmountUpdateEnabled = TRUE; //optional, choose who pays the fee, default: FEEPAYER_EACHRECEIVER [PayPal getPayPalInst].feePayer = FEEPAYER_EACHRECEIVER; //for a payment with multiple recipients, use a PayPalAdvancedPayment object PayPalAdvancedPayment *payment = [[PayPalAdvancedPayment alloc] init]; payment.paymentCurrency = @"USD"; // A payment note applied to all recipients. payment.memo = @"A Note applied to all recipients"; //receiverPaymentDetails is a list of PPReceiverPaymentDetails objects payment.receiverPaymentDetails = [NSMutableArray array]; NSArray *emailArray = [NSArray arrayWithObjects:@"[email protected]",@"[email protected]", nil]; for (int i = 1; i <= 2; i++) { PayPalReceiverPaymentDetails *details = [[PayPalReceiverPaymentDetails alloc] init]; // Customize the payment notes for one of the three recipient. if (i == 2) { details.description = [NSString stringWithFormat:@"Component %d", i]; } details.recipient = [NSString stringWithFormat:@"%@",[emailArray objectAtIndex:i-1]]; unsigned order; if (i==1) { order = [[feeArray objectAtIndex:0] unsignedIntValue]; } if (i==2) { order = [[amountArray objectAtIndex:0] unsignedIntValue]; } //subtotal of all items for this recipient, without tax and shipping details.subTotal = [NSDecimalNumber decimalNumberWithMantissa:order exponent:-4 isNegative:FALSE]; //invoiceData is a PayPalInvoiceData object which contains tax, shipping, and a list of PayPalInvoiceItem objects details.invoiceData = [[PayPalInvoiceData alloc] init]; //invoiceItems is a list of PayPalInvoiceItem objects //NOTE: sum of totalPrice for all items must equal details.subTotal //NOTE: example only shows a single item, but you can have more than one details.invoiceData.invoiceItems = [NSMutableArray array]; PayPalInvoiceItem *item = [[PayPalInvoiceItem alloc] init]; item.totalPrice = details.subTotal; [details.invoiceData.invoiceItems addObject:item]; [payment.receiverPaymentDetails addObject:details]; } [[PayPal getPayPalInst] advancedCheckoutWithPayment:payment]; Can anybody tell me how to do this conversion? Thanks and regards in advance.

    Read the article

  • How to suppress a MongoDDException when proxy can't find a referenced document

    - by Madarco
    We are using Symfony2/DoctrineOdm/MongoDB and when we do: if ($doc.referenceOne != null) { ... } and the $doc.referenceOne contains a MongoDbRef that point to a deleted/lost document, the Doctrine Proxy object raises a MongoDBException. It is possible to tell the Proxy return null instead of raising the exception? Detailed Explanation: Our document: class User { /* @MongoDB\ReferenceOne( ... ) */ private $photo; } If $photo contains a MongoDbRef, but the document is lost/deleted, when we do if ($user.photo) { ... } doctrine will raise a MongoDBException: The "Proxies\DocumentPhotoProxy" document with identifier "4fd8b3ef732bafab7b000000" could not be found We want to suppress the exception since our application can handle null values in that variable. (we could simply log that error, while the exception propagate to a 500 page and disrupt our service)

    Read the article

  • Groovy: Sorting Columns in a view: list

    - by Luixv
    I have a Groovy application. I am rendering the view list using the following statement: render (view: 'list', model:[reportingInstanceList: reportingInstanceList, reportingInstanceTotal: i, params: params]) The list.gsp is as follows: The view is rendered but the default sorting is not working. <g:sortableColumn class="tabtitle" property="id" title="Id" titleKey="reporting.id" /> <g:sortableColumn class="tabtitle" property="company" title="Company" titleKey="reporting.company" /> Unfortunately the default sorting (by id, by company, etc) are not working. Any hint why? Thanks a lot in advance. Luis

    Read the article

  • DataCash @ Hackathon

    - by John Breakwell
    Originally posted on: http://geekswithblogs.net/Plumbersmate/archive/2013/06/28/datacash--hackathon.aspxBack in May, DataCash was a sponsor for one of the biggest networking events for payments developers – Trans-hacktion. The 3-day Hackathon, organised by Birdback, was focused on the latest innovations in the payments and financial technology and held at the London Google Campus.  The event included demos from DataCash and other payments companies followed by hacking sessions. Teams had to hack a product that used partner APIs and present the hack in 3 minutes on the final day. The prizes up for grabs were: KingHacker3D Printer & Champagne 1stPebble Watch & 1 year of GitHub Silver plan 2ndAIAIAI Headphones & 1 year of GitHub Bronze plan 3rdRaspberry Pi & 6 months of GitHub Bronze plan APIUp Bracelet. Nintendo NES + Super Mario Game ANDBerg Cloud Little Printer & 100$ AWS credit & more...

    Read the article

  • BUILD 2013&ndash;Day 2 Summary

    - by Tim Murphy
    Originally posted on: http://geekswithblogs.net/tmurphy/archive/2013/06/28/build-2013ndashday-2-summary.aspx Day 1 rocked.  So how could they top that?  By having more goodies to give away!  During the keynote they announced that attendees would get one year of Office 365, 100 GB of SkyDrive and one year of Adobe Cloud Service.  Overall they key note was long with more information shot at you than you could possibly absorb.  They went about 20 minutes over time which made me think that they could have split it to a 3rd keynote and given us a better idea on some of these topics and perhaps addressed the one open question that was floating around Twitter.  That is, what is going to happen with XBox development.  It sounded like there was a quick side mention of that, but I missed it. The rest of the day was packed with great sessions full of Windows 8, Azure and Windows Phone goodness.  I had planned on attending Scott Hanselman’s talk, but they had so many people this they had to push to an overflow room.  Stay tuned from session summaries later. The day was topped off by an attendee party across from the San Francisco Giant’s ball park.  It was kind of quirky and and fun.  They set it up on one of the piers in the bay and had food served by food trucks.  You would be surprised how good the food was.  Add in some pool tables, fooseball, video games, a DJ, a comedian/musician and plenty of spirits and it was a great way to end day 2. del.icio.us Tags: BUILD 2013

    Read the article

  • Intranet Ip - Access from Custom Domain

    - by Alexander Wigmore
    I have setup a local intranet in my office using IIS7 (Windows 7 Machine), currently it can be accessed through the PC's static IP, however I would like it so that internally it can just be accessed through an easier method, e.g typing in http://intranet (or something similar). There are over 60 PC's int he office, so individually updating Host files on the PC's is not really ideal. We don't need it to be accessible from the outside world (I.e, we don't care/want it to be an Extranet). Any tips?

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >