Search Results

Search found 37183 results on 1488 pages for 'string conversion'.

Page 125/1488 | < Previous Page | 121 122 123 124 125 126 127 128 129 130 131 132  | Next Page >

  • IIS6 - Classic ASP - "out of memory"/"out of string space"

    - by glaucon
    We have a classic ASP application that's under significantly more load than usual. We are from time to time been getting "out of memory" and "out of string space" in the httperr. We do not usually see these errors. For the moment we cannot change the application. Is there anything we can do to the IIS config which will help to reduce or stop these errors occurring ? The application pool is set to default values currently.

    Read the article

  • which type is best for three radiobuttons?

    - by Manog
    Maybe you consider this question trivial but im just curious what is your opinion. I have three radiobuttons. "Show blue", "Show red" and "Show all". I did it with nullable boolean. There is collumn in database where blue is 0 and red is 1 so in metode i have to translate bool to int to compare those values (i do it in c#).Of course it works, but i wonder if it is the best solution. And question is wich type is best in this case? nullable bool, int, or maybe string?

    Read the article

  • Extracting ID from data packet GPS

    - by user604134
    Hi , I am trying to configure a GPS device to my systems. The GPS device send the data packet to my IP in the following format : $$?W??¬ÿÿÿÿ™U042903.000,A,2839.6408,N,07717.0905,E,0.00,,230111,,,A*7C|1.2|203|0000÷ I am able to extract the latitude, longitude and other information but I am not able to extract the Tracker ID out of the string. According to the manual the ID is in hex format.And the format of the packet is $$\r\n I dont know what to do with it, I have tried converting this to hex..but it didnt work. Any help will be greatly appreciate. Thanks

    Read the article

  • Calculation Expression Parser with Nesting and Variables in ActionScript

    - by yuletide
    Hi There, I'm trying to enable dynamic fields in the configuration file for my mapping app, but I can't figure out how to parse the "equation" passed in by the user, at least not without writing a whole parser from scratch! I'm sure there is some easier way to do this, and so I'm asking for ideas! Basic idea: public var testString:String = "(#TOTPOP_CY#-#HISPOP_CY#)/#TOTPOP_CY#"; public var valueObject:Object = {TOTPOP_CY:1000, HISPOP_CY:100}; public function calcParse(eq:String):String { // do calculations return calculatedValue } So far, I was thinking of splitting the expression by either the operators, or maybe the variable tokens, but that gets rid of the parenthetical nesting. Alternatively, use a series of regex to search and replace each piece of the expression with its value, recursively running until only a number is left. But I don't think regex does math (i.e. replace "\d + \d" with the sum of the two numbers) Ideally, I'd just do a find/replace all variable names with their values, then run an eval(), but there's no eval in AS... eesh I downloaded some course materials for a course on compiler design, so maybe I'll just write a full-fledged calculator language and parser and port it over from the OTHER flex (the parser generator) :-D

    Read the article

  • Compute the Length of Largest substring that starts and ends with the same substring

    - by Deepak
    Hi People, Below is the Problem Statement: PS: Given a string and a non-empty substring sub, compute recursively the largest substring which starts and ends with sub and return its length. Examples: strDist("catcowcat", "cat") ? 9 strDist("catcowcat", "cow") ? 3 strDist("cccatcowcatxx", "cat") ? 9 Below is my Code: (Without recursion)//since i found it hard to implement with recursion. public int strDist(String str, String sub){ int idx = 0; int max; if (str.isEmpty()) max = 0; else max=1; while ((idx = str.indexOf(sub, idx)) != -1){ int previous=str.indexOf(sub, idx); max = Math.max(max,previous); idx++; } return max; } Its working for few as shown below but returns FAIL for others. Expected This Run strDist("catcowcat", "cat") ? 9 6 FAIL strDist("catcowcat", "cow") ? 3 3 OK strDist("cccatcowcatxx", "cat") ? 9 8 FAIL strDist("abccatcowcatcatxyz", "cat") ? 12 12 OK strDist("xyx", "x") ? 3 2 FAIL strDist("xyx", "y") ? 1 1 OK strDist("xyx", "z") ? 0 1 FAIL strDist("z", "z") ? 1 1 OK strDist("x", "z") ? 0 1 FAIL strDist("", "z") ? 0 0 OK strDist("hiHellohihihi", "hi") ? 13 11 FAIL strDist("hiHellohihihi", "hih") ? 5 9 FAIL strDist("hiHellohihihi", "o") ? 1 6 FAIL strDist("hiHellohihihi", "ll") ? 2 4 FAIL Could you let me whats wrong with the code and how to return the largest substring that begins and ends with sub with its respective length.

    Read the article

  • android odbc connection

    - by Vijay Kumar
    i want to connect odbc connection for my android application. Here in my program i'm using oracle database 11g and my table name is sample. After i run the program close the emulator open the database the values could not be stored. Please give one solution or any changes in my program or connection string. package com.odbc; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import android.app.Activity; import android.os.Bundle; public class OdbcActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); String first="vijay"; String last="kumar"; try { DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localshot:1521:XE","system","vijay"); PreparedStatement pst=con.prepareStatement("insert into sample(first,last) values(?,?"); pst.setString(1,first); pst.setString(2,last); pst.executeUpdate(); } catch(Exception e) { System.out.println("Exception:"+e); } } }

    Read the article

  • How can I place zeroes to the left of a given number to a maximum of 6 digits including the given nu

    - by Sergio Tapia
    I have this method that receives an ID number and downloads an HTML website according to that ID. Typically, an IMDB link is like this: http://www.imdb.com/title/tt0892791/ http://www.imdb.com/title/tt1226229/ http://www.imdb.com/title/tt0000429/ They all follow the 'tt' then 7 digits, with lack of digits turning into zeroes to fill out the left spaces. How can I accomplish this using C#? I'm kind of stumped. Here's my method: /// <summary> /// Find a movie page using its precise IMDB id. /// </summary> /// <param name="id">IMDB Movie ID</param> /// <returns>Returns an HtmlDocument with the source code included.</returns> public HtmlDocument ByID(string id) { string url = String.Format("http://www.imdb.com/title/tt{0}/", id); HtmlDocument page = downloader.Load(url); return page; } Thank you very much for your time, and if you are interested in helping out, you can check out the complete source code of TheFreeIMDB here: http://thefreeimdb.codeplex.com/

    Read the article

  • Umlaute from JSP-page are misinterpreted

    - by Karin
    I'm getting Input from a JSP page, that can contain Umlaute. (e.g. Ä,Ö,Ü,ä,ö,ü,ß). Whenever an Umlaut is entered in the Input field an incorrect value gets passed on. e.g. If an "ä" (UTF-8:U+00E4) gets entered in the input field, the String that is extracted from the argument is "ä" (UTF-8: U+00C3 and U+00A4) It seems to me as if the UTF-8 hex encoding (which is c3 a4 for an "ä") gets used for the conversion. How can I retrieved the correct value? Here are snippets from the current implementation The JSP-page passes the input value "pk" on to the processing logic: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> ... <input type="text" name="<%=pk.toString()%>" value="<%=value%>" size="70"/> <button type="submit" title="Edit" value='Save' onclick="action.value='doSave';pk.value='<%=pk.toString()%>'"><img src="icons/run.png"/>Save</button> The value gets retrieved from args and converted to a string: UUID pk = UUID.fromString(args.get("pk")); //$NON-NLS-1$ String value = args.get(pk.toString()); Note: Umlaute that are saved in the Database get displayed correctly on the page.

    Read the article

  • How to configure database connection securely

    - by chiccodoro
    Similar but not the same: How to securely store database connection details Securely connecting to database within a application Hi all, I have a C# WinForms application connecting to a database server. The database connection string, including a generic user/pass, is placed in a NHibernate configuration file, which lies in the same directory as the exe file. Now I have this issue: The user that runs the application should not get to know the username/password of the general database user because I don't want him to rummage around in the database directly. Alternatively I could hardcode the connection string, which is bad because the administrator must be able to change it if the database is moved or if he wants to switch between dev/test/prod environments. So long I've found three possibilities: The first referenced question was generally answered by making the file only readable for the user that runs the application. But that's not not enough in my case (the user running the application is a person. The database user/pass are general and shouldn't even be accessible by the person.) The first answer additionally proposed to encrypt the connection data before writing it to the file. With this approach, the administrator is not able anymore to configure the connection string because he cannot encrypt it by hand. The second referenced question provides an approach for this very scenario but it seems very complicated. My questions to you: This is a very general issue, so isn't there any general "how-to-do-it" way, somehow a "design pattern"? Is there some support in .NET's config infrastructure? (optional, maybe out of scope) Can I combine that easily with the NHibernate configuration mechanism?

    Read the article

  • Is it possible to convert this asp to asp.net?

    - by Phil
    I have been tasked with sifting through the worst classic asp spaghetti i've ever come across. The script runs a series of recordsets in sequence, getting 1 record at a time. As the record is built it takes the id and passes it to the next loop, which gets data, and passes on the id to the next loop. It then continues in this manner and builds an unordered list, kicking out the required html as it goes. Here are my efforts so far: have a class delivering data via sqldatareaders and output these to nested repeaters (this failed due to not being able to loop and get the id) Have a datatable populated with all the required data, then datatable.select to filter it out. have 4 datareaders looping and building the ul arraylists (I couldnt get the id's to match up) Please can you suggest the best method (with a bit of sample code if possible) to go about doing this conversion? Here is the code (sorry its long / horrible / spaghetti!!!) <% set RSMenuLevel0 = conn.execute("select id, DepartmentID, GroupingID, Heading, OrderID, Publish, moduleid, url, urltarget " &_ "from Grouping where (DepartmentID = 0 and GroupingID = 0 and Publish <> 0) order by OrderID") %> <% if session("JavaScriptEnabled") = "False" Then %> <% while not RSMenuLevel0.EOF if RSMenuLevel0("Publish") <> 0 then Menu0heading = RSMenuLevel0("Heading") Menu0id = RSMenuLevel0("id") %> <%if RSMenuLevel0("url") > "" and RSMenuLevel0("moduleid") = 0 then%> &nbsp;<a href="http://<%=RSMenuLevel0("url")%>" target="<%=RSMenuLevel0("urltarget")%>"><%=Menu0heading%></a> <%else%> &nbsp;<a href="/default.asp?id=<%=Menu0id%>"><%=Menu0heading%></a> <%end if%> <% end if RSMenuLevel0.MoveNext wend %> <% else %> <ul id="Menu1" class="MM"> <%if home <> 1 then%> <!-- <li><a href="/default.asp"><span class="item">Home</span></a> --> <%end if%> <% numone=0 while not RSMenuLevel0.EOF ' numone = numone + 1 Menu0heading = RSMenuLevel0("Heading") 'itemID = lcase(replace(Menu0heading," ","")) Menu0id = RSMenuLevel0("id") if RSMenuLevel0("url") > "" and RSMenuLevel0("moduleid") = 0 then url = RSMenuLevel0("url") if instr(url,"file:///") > 0 then %> <li><a href="<%=RSMenuLevel0("url")%>" target="<%=RSMenuLevel0("urltarget")%>" <%if numone=1 then%>class="CURRENT"<%end if%>><span class="item"><%=Menu0heading%></span></a> <%else%> <li><a href="http://<%=RSMenuLevel0("url")%>" target="<%=RSMenuLevel0("urltarget")%>" <%if numone=1 then%>class="CURRENT"<%end if%>><span class="item"><%=Menu0heading%></span></a> <%end if%> <%else%> <li><a href="/default.asp?id=<%=RSMenuLevel0("id")%>" <%if numone=1 then%>class="CURRENT"<%end if%>><span class="item"><%=Menu0heading%></span></a> <%end if%> <% set RSMenuLevel1 = conn.execute("select id, DepartmentID, GroupingID, Heading, OrderID, Publish, moduleid, url, urltarget " &_ "from Grouping where (DepartmentID = 0 and GroupingID = " & Menu0id & " and Publish <> 0) order by OrderID") if not RSMenuLevel1.EOF then %> <ul> <% while not RSMenuLevel1.EOF Menu1heading = RSMenuLevel1("Heading") Menu1id = RSMenuLevel1("id") if RSMenuLevel1("url") > "" and RSMenuLevel1("moduleid") = 0 then url = RSMenuLevel1("url") if instr(url,"file:///") > 0 then %> <li><a href="<%=RSMenuLevel1("url")%>" target="<%=RSMenuLevel1("urltarget")%>"><%=Menu1heading%></a> <%else%> <li><a href="http://<%=RSMenuLevel1("url")%>" target="<%=RSMenuLevel1("urltarget")%>"><%=Menu1heading%></a> <%end if%> <%else%> <li><a href="/default.asp?id=<%=RSMenuLevel1("id")%>"><%=Menu1heading%></a> <%end if%> <% set RSMenuLevel2 = conn.execute("select id, DepartmentID, GroupingID, Heading, OrderID, Publish, moduleid, url, urltarget " &_ "from Grouping where (DepartmentID = 0 and GroupingID = " & Menu1id & " and Publish <> 0) order by OrderID") if not RSMenuLevel2.EOF then %> <ul> <% while not RSMenuLevel2.EOF Menu2heading = RSMenuLevel2("Heading") Menu2id = RSMenuLevel2("id") if RSMenuLevel2("url") > "" and RSMenuLevel2("moduleid") = 0 then %> <li><a href="http://<%=RSMenuLevel2("url")%>" target="<%=RSMenuLevel2("urltarget")%>"><%=Menu2heading%></a> <%else%> <li><a href="/default.asp?id=<%=RSMenuLevel2("id")%>"><%=Menu2heading%></a> <%end if%> <% set RSMenuLevel3 = conn.execute("select id, DepartmentID, GroupingID, Heading, OrderID, Publish, moduleid, url, urltarget " &_ "from Grouping where (DepartmentID = 0 and GroupingID = " & Menu2id & " and Publish <> 0) order by OrderID") if not RSMenuLevel3.EOF then %> <ul> <% while not RSMenuLevel3.EOF Menu3heading = RSMenuLevel3("Heading") Menu3id = RSMenuLevel3("id") if RSMenuLevel3("url") > "" and RSMenuLevel3("moduleid") = 0 then %> <li><a href="http://<%=RSMenuLevel3("url")%>" target="<%=RSMenuLevel3("urltarget")%>"><%=Menu3heading%></a></li> <%else%> <li><a href="/default.asp?id=<%=RSMenuLevel3("id")%>"><%=Menu3heading%></a></li> <%end if%> <% RSMenuLevel3.MoveNext wend %> </ul> <% end if RSMenuLevel2.MoveNext %> </li> <% wend %> </ul> <% end if RSMenuLevel1.MoveNext %> </li> <% wend %> </ul> <% end if RSMenuLevel0.MoveNext %> </li> <% wend %> </ul> <% end if %>

    Read the article

  • How to use Caret to tell which line it is in from JTextPane? (Java)

    - by Alex Cheng
    Hi all. Problem: I have CaretListener and DocumentListener listening on a JTextPane. I need an algorithm that is able to tell which line is the caret at in a JTextPane, here's an illustrative example: Result: 3rd line Result: 2nd line Result: 4th line and if the algorithm can tell which line the caret is in the JTextPane, it should be fairly easy to substring whatever that is in between the parentheses as the picture (caret is at character m of metadata): -- This is how I divide the entire text that I retrieved from the JTextPane into sentences: String[] lines = textPane.getText().split("\r?\n|\r", -1); The sentences in the textPane is separated with \n. Problem is, how can I manipulate the caret to let me know at which position and which line it is in? I know the dot of the caret says at which position it is, but I can't tell which line it is at. Assuming if I know which line the caret is, then I can just do lines[<line number>] and manipulate the string from there. In Short: How do I use CaretListener and/or DocumentListener to know which line the caret is currently at, and retrieve the line for further string manipulation? Please help. Thanks. Do let me know if further clarification is needed. Thanks for your time.

    Read the article

  • KSH: Variables containing double quotes

    - by nitrobass24
    I have a string called STRING1 that could contain double quotes. I am echoing the string through sed to pull out puntuation then sending to array to count certain words. The problem is I cannot echo variables through double quotes to sed. I am crawling our filesystems looking for files that use FTP commands. I grep each file for "FTP" STRING1=`grep -i ftp $filename` If you echo $STRING1 this is the output (just one example) myserver> echo "Your file `basename $1` is too large to e-mail. You must ftp the file to BMC tech support. \c" echo "Then, ftp it to ftp.bmc.com with the user name 'anonymous.' \c" echo "When the ftp is successful, notify technical support by phone (800-537-1813) or by e-mail ([email protected].)" Then I have this code STRING2=`echo $STRING1|sed 's/[^a-zA-Z0-9]/ /g'` I have tried double quoting $STRING1 like STRING2=`echo "$STRING1"|sed 's/[^a-zA-Z0-9]/ /g'` But that does not work. Single Qoutes, just sends $STRING1 as the string to sed...so that did not work. What else can I do here?

    Read the article

  • Linked List Inserting strings in alphabetical order

    - by user69514
    I have a linked list where each node contains a string and a count. my insert method needs to inset a new node in alphabetical order based on the string. if there is a node with the same string, then i increment the count. the problem is that my method is not inserting in alphabetical order public Node findIsertionPoint(Node head, Node node){ if( head == null) return null; Node curr = head; while( curr != null){ if( curr.getValue().compareTo(node.getValue()) == 0) return curr; else if( curr.getNext() == null || curr.getNext().getValue().compareTo(node.getValue()) > 0) return curr; else curr = curr.getNext(); } return null; } public void insert(Node node){ Node newNode = node; Node insertPoint = this.findIsertionPoint(this.head, node); if( insertPoint == null) this.head = newNode; else{ if( insertPoint.getValue().compareTo(node.getValue()) == 0) insertPoint.getItem().incrementCount(); else{ newNode.setNext(insertPoint.getNext()); insertPoint.setNext(newNode); } } count++; }

    Read the article

  • Android - Display HTML Formatted String

    - by Soren
    I need an example of how to display the strings that I have marked up with simple html into a TextView. I have found "Spanned fromHtml(String source)", but I don't know how to plug it into my java code. Here is my Java: package com.SorenWinslow.TriumphHistory; import android.app.ListActivity; import android.os.Bundle; import android.widget.ArrayAdapter; public class TriumphHistory extends ListActivity { String[] HistoryList; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ArrayAdapter<String> adapter; HistoryList = getResources().getStringArray(R.array.history); adapter = new ArrayAdapter<String> (this,R.layout.historylistlayout,HistoryList); setListAdapter(adapter); } } Here is a sample of history: <?xml version="1.0" encoding="utf-8"?> <resources> <string-array name="history"> <item><b>1883</b><br/>Some stuff happened</item> <item><b>1884</b><br/>Some more stuff happened <i>before</i> the other stuff </item> <resources> Here is my historylistlayout.xml: <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:gravity="center_vertical" android:textColor="#ffffff" android:background="#000050" android:layout_marginTop="5px" android:minHeight="?android:attr/listPreferredItemHeight" android:padding="3px" android:textSize="8pt" android:layout_gravity="top|left"/> And here is my main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:textColor="#ffffff" android:background="#000080" android:isScrollContainer="true" android:layout_height="fill_parent" android:layout_width="fill_parent" android:scrollbarStyle="insideOverlay"> <ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:clickable="true" android:dividerHeight="1px"/> </LinearLayout>

    Read the article

  • Andorid - Display HTML Formatted String

    - by Soren
    I need an example how to display the strings that I have marked up with simple html into a TextView. I have found "Spanned fromHtml(String source)", but I don't know how to plug it into my java code. Here is my Java: package com.SorenWinslow.TriumphHistory; import android.app.ListActivity; import android.os.Bundle; import android.widget.ArrayAdapter; public class TriumphHistory extends ListActivity { String[] HistoryList; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ArrayAdapter<String> adapter; HistoryList = getResources().getStringArray(R.array.history); adapter = new ArrayAdapter<String> (this,R.layout.historylistlayout,HistoryList); setListAdapter(adapter); } } Here is a sample of history: <?xml version="1.0" encoding="utf-8"?> <resources> <string-array name="history"> <item><b>1883</b><br/>Some stuff happened</item> <item><b>1884</b><br/>Some more stuff happened <i>before</i> the other stuff </item> <resources> Here is my historylistlayout.xml: <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:gravity="center_vertical" android:textColor="#ffffff" android:background="#000050" android:layout_marginTop="5px" android:minHeight="?android:attr/listPreferredItemHeight" android:padding="3px" android:textSize="8pt" android:layout_gravity="top|left"/> And here is my main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:textColor="#ffffff" android:background="#000080" android:isScrollContainer="true" android:layout_height="fill_parent" android:layout_width="fill_parent" android:scrollbarStyle="insideOverlay"> <ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:clickable="true" android:dividerHeight="1px"/> </LinearLayout>

    Read the article

  • Silverlight 4 DataBinding: Binding to ObservableCollection<string> not working anymore

    - by Kurt
    Upgrading from SL3 - SL4. First problem: this throws a parser exception: <StackPanel Name={Binding} /> (same with x:Name) Collection is ObservableCollection<string>. Worked fine in SL3. So it seems that SL4 doen't allow binding to the Name property. Huh? So: changed to <StackPanel Tag={Binding} /> ... since I just need to ID the control in code behind. So here's the bug ('cuz this has got to be a bug!): In this frag, AllAvailableItems is an ObservableCollection<string>: <ItemsControl Name="lbItems" ItemsSource="{Binding AllAvailableItems}" Height="Auto" Width="Auto" BorderBrush="Transparent" BorderThickness="0" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="12,6,0,0"> <ItemsControl.ItemTemplate> <DataTemplate> <Grid> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <CheckBox Tag="{Binding}" Checked="ItemChecked_Click" Unchecked="ItemUnchecked_Click" Style="{StaticResource CheckBoxStyle}" Grid.Row="0"> <CheckBox.Content> <TextBlock Text="{Binding}" Style="{StaticResource FormLJustStyle}" /> </CheckBox.Content> </CheckBox> <StackPanel Tag="{Binding}" Orientation="Vertical" Grid.Row="1"> <configControls:ucLanguage /> <!-- simple user control --> </StackPanel> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> In the code behind, I use a recursive function to find the Dependency object with either the Name or Tag property provided: public static T FindVisualChildByName<T>(DependencyObject parent, string name, DependencyProperty propToUse) where T : DependencyObject { for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++) { var child = VisualTreeHelper.GetChild(parent, i); string controlName = child.GetValue(propToUse) as string; if (controlName == name) { return child as T; } else { T result = FindVisualChildByName<T>(child, name, propToUse); if (result != null) return result; } } return null; } OK, get this: in the code behind, I can get the control that is ORDERED FIRST in the XAML! In other words, if I put the CheckBox first, I can retrieve the CheckBox, but no StackPanel. And vice-versa. This all worked fine in SL3. Any help, ideas ... ? Thanks - Kurt

    Read the article

  • Issues with Rails 3.1 API with Query String to Create action on Mac OSX Mountain Lion

    - by hjaved
    Hi I've been stuck on this problem for a while and would appreciate your help. I'm writing an API to allow an external source like a Browser Query String or a smartphone to enter some model User info in a form and hit the User create action to write the data to the db. Please tell me what I'm doing wrong with the code below. I've also observed that if I have code like @user = User.new(params[:user]), that this approach only works when a user enters their data within the form. And that if I have code such as @user = User.new( name: params[:name], location: params[:location], password = params[:password], email: params[:email]), that this code ONLY works for a Query string entry, but NOT both Query string AND regular form submission. Why is that and how can I write the code above in the Users Controller Create action, so that it takes care of both situations? URL used: localhost:3000/users/create?name=John&&[email protected]&&password=secret&&location=SanFrancisco&date=06122012 The date is of type string but it doesn't show up in the database. Why? Everything else does. UsersController.rb def create @user = User.new(params[:user]) if @user.save session[:uid] = @user.id redirect_to thanks_path, notice: "Welcome #{@user.name}!" else redirect_to root_path end end New User Form: <%=u.text_field :name, placeholder: "Name"%><br> <%=u.text_field :email, placeholder: "Email"%><br> <%=u.password_field :password, placeholder: "Password"%><br> <%=u.text_field :location, placeholder: "City"%><br> <%=u.text_field :date, placeholder: "Date"%><br> <%if params[:partner_id]%> <%=u.hidden_field :partner_id, value: params[:partner_id]%> <%end%> <button class="btn btn-large btn-primary">Enter</button> I also tried to create a separate method called remotecreate for User creation for something other than a regular web form. I entered remotecreate in the Query string but it didn't work. def remotecreate @user = User.create(name: params[:name], email: params[:email], password: params[:password], location: params[:location], date: params[:date]) if @user.save session[:uid] = @user.id redirect_to thanks_path, notice: "Welcome #{@user.name}" else redirect_to root_path end end Thanks!

    Read the article

  • Programmatically convert *.odt file to MS Word *.doc file using an OpenOffice.org basic macro

    - by Chen Levy
    I am trying to build a reStructuredText to MS Word document tool-chain, so I will be able to save only the rst sources in version control. So far I -- Have rst2odt.py to convert reStructuredText to OpenOffice.org Writer format. Next I want to use the most recent OpenOffice.org (currently 3.1) that do a pretty decent work of generating a Word 97/2000/XP document, so I wrote the macro: sub ConvertToWord(file as string) rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim odf(1) as new com.sun.star.beans.PropertyValue odf(0).Name = "URL" odf(0).Value = "file://" + file + ".odt" odf(1).Name = "FilterName" odf(1).Value = "MS Word 97" dispatcher.executeDispatch(document, ".uno:Open", "", 0, odf()) rem ---------------------------------------------------------------------- dim doc(1) as new com.sun.star.beans.PropertyValue doc(0).Name = "URL" doc(0).Value = "file://" + file + ".doc" doc(1).Name = "FilterName" doc(1).Value = "MS Word 97" dispatcher.executeDispatch(document, ".uno:SaveAs", "", 0, doc()) end sub But when I executing it: soffice "macro:///Standard.Module1.ConvertToWord(/path/to/odt_file_wo_ext)" I get a: "BASIC runtime error. Property or method not found." message On the line: document = ThisComponent.CurrentController.Frame And when I comment that line, the above invocation complete without error, but do nothing. I guess I need to somehow set the value of document to a newly created instance, but I don't know how to do it. Or am I going at it at a completely backward way? P.S. I will consider JODConverter as a fallback, because I try to minimize my dependencies.

    Read the article

  • Using ScriptGetProperties with Delphi

    - by Mohammed Nasman
    How can I use ScriptGetProperties API from Uniscribe Dll (usp10.dll) in Delphi I found an example in C++, but I don't know how to translate it, because I'm not good on C. const SCRIPT_PROPERTIES **g_ppScriptProperties; int g_iMaxScript; WCHAR *pwcInChars = L"Unicode string to itemize"; int cInChars = wcslen(pwcInChars); const int cMaxItems = 20; SCRIPT_ITEM si[cMaxItems + 1]; SCRIPT_ITEM *pItems = si; int cItems; ScriptGetProperties(&g_ppScriptProperties, &g_iMaxScript); HRESULT hResult = ScriptItemize(pwcInChars, cInChars, cMaxItems, NULL, NULL, pItems, &cItems); if (hResult == 0) { for (int i=0; i<cItems; i++) { if (g_ppScriptProperties[pItems[i].a.eScript]->fComplex) { // Item [i] is complex script text // requiring glyph shaping. } else { // The text may be rendered legibly without using Uniscribe. // However, Uniscribe may still be used as a means of accessing // font typographic features. } } } else { // Handle the error. } The Delphi code should be complied with Turbo Delphi 2006 or above.

    Read the article

  • Swig typecast to derived class?

    - by Zack
    I notice that Swig provides a whole host of functions to allow for typecasting objects to their parent classes. However, in C++ one can produce a function like the following: A * getAnObject() { if(someBoolean) return (A *) new B; else return (A *) new C; } Where "A" is the parent of classes "B" and "C". One can then typecast the pointer returned into being a "B" type or "C" type at one's convenience like: B * some_var = (B *) getAnObject(); Is there some way I can typecast an object I've received from a generic-pointer-producing function at run-time in the scripting language using the wrappers? (In my case, Lua?) I have a function that could produce one of about a hundred possible classes, and I'd like to avoid writing an enormous switch structure that I'd have to maintain in C++. At the point where I receive the generic pointer, I also have a string representation of the data type I'd like to cast it to. Any thoughts? Thanks! -- EDIT -- I notice that SWIG offers to generate copy constructors for all of my classes. If I had it generate those, could I do something like the following?: var = myModule.getAnObject(); -- Function that returns an object type-cast down to a pointer of the parent class, as in the function getAnObject() above. var = myModule.ClassThatExtendsBaseClass(var); -- A copy constructor that SWIG theoretically creates for me and have var then be an instance of the inheriting class that knows it's an instance of the inheriting class?

    Read the article

  • serializing type definitions?

    - by Dave
    I'm not positive I'm going about this the right way. I've got a suite of applications that have varying types of output (custom defined types). For example, I might have a type called Widget: Class Widget Public name as String End Class Throughout the course of operation, when a user experiences a certain condition, the application will take that output instance of widget that user received, serialize it, and log it to the database noting the name of the type. Now, I have other applications that do something similar, but instead of dealing with Widget, it could be some totally random other type with different attributes, but again I serialize the instance, log it to the db, and note the name of the type. I have maybe a half dozen different types and don't anticipate too many additional ones in the future. After all this is said and done, I have an admin interface that looks through these logs, and has the ability for the user to view the contents of this data thats been logged. The Admin app has a reference to all the types involved, and with some basic switch case logic hinged upon the name of the type, will cast it into their original types, and pass it on to some handlers that have basic display logic to spit the data back out in a readable format (one display handler for each type) NOW... all this is well and good... Until one day, my model changed. The Widget class now has deprecated the name attribute and added on a bunch of other attributes. I will of course get type mismatches in the admin side when I try to reconstitute this data. I was wondering if there was some way, at runtime, i could perhaps reflect through my code and get a snapshot of the type definition at that precise moment, serialize it, and store it along with the data so that I could somehow use this to reconstitute it in the future?

    Read the article

  • Convert SQL with Inner AND Outer Join to L2S

    - by Refracted Paladin
    I need to convert the below Sproc to a Linq query. At the very bottom is what I have so far. For reference the fields behind the "splat"(not my sproc) are ImmunizationID int, HAReviewID int, ImmunizationMaintID int, ImmunizationOther varchar(50), ImmunizationDate smalldatetime, ImmunizationReasonID int The first two are PK and FK, respectively. The other two ints are linke to the Maint Table where there description is stored. That is what I am stuck on, the INNER JOIN AND the LEFT OUTER JOIN Thanks, SELECT tblHAReviewImmunizations.*, tblMaintItem.ItemDescription, tblMaintItem2.ItemDescription as Reason FROM dbo.tblHAReviewImmunizations INNER JOIN dbo.tblMaintItem ON dbo.tblHAReviewImmunizations.ImmunizationMaintID = dbo.tblMaintItem.ItemID LEFT OUTER JOIN dbo.tblMaintItem as tblMaintItem2 ON dbo.tblHAReviewImmunizations.ImmunizationReasonID = tblMaintItem2.ItemID WHERE HAReviewID = @haReviewID My attempt so far -- public static DataTable GetImmunizations(int haReviewID) { using (var context = McpDataContext.Create()) { var currentImmunizations = from haReviewImmunization in context.tblHAReviewImmunizations where haReviewImmunization.HAReviewID == haReviewID join maintItem in context.tblMaintItems on haReviewImmunization.ImmunizationReasonID equals maintItem.ItemID into g from maintItem in g.DefaultIfEmpty() let Immunization = GetImmunizationNameByID( haReviewImmunization.ImmunizationMaintID) select new { haReviewImmunization.ImmunizationDate, haReviewImmunization.ImmunizationOther, Immunization, Reason = maintItem == null ? " " : maintItem.ItemDescription }; return currentImmunizations.CopyLinqToDataTable(); } } private static string GetImmunizationNameByID(int? immunizationID) { using (var context = McpDataContext.Create()) { var domainName = from maintItem in context.tblMaintItems where maintItem.ItemID == immunizationID select maintItem.ItemDescription; return domainName.SingleOrDefault(); } }

    Read the article

  • Help with specific Regex: need to match multiple instances of multiple formats in a single string.

    - by KevenK
    I apologize for the terrible title...it can be hard to try to summarize an entire situation into a single sentence. Let me start by saying that I'm asking because I'm just not a Regex expert. I've used it a bit here and there, but I just come up short with the correct way to meet the following requirements. The Regex that I'm attempting to write is for use in an XML schema for input validation, and used elsewhere in Javascript for the same purpose. There are two different possible formats that are supported. There is a literal string, which must be surrounded by quotation marks, and a Hex-value string which must be surrounded by braces. Some test cases: "this is a literal string" <-- Valid string, enclosed properly in "s "this should " still be correct" <-- Valid string, "s are allowed within (if possible, this requirement could be forgiven if necessary) "{00 11 22}" <-- Valid string, {}'s allow in strings. Another one that can be forgiven if necessary I am bad output <-- Invalid string, no "s "Some more problemss"you know <-- Invalid string, must be fully contained in "s {0A 68 4F 89 AC D2} <-- Valid string, hex characters enclosed in {}s {DDFF1234} <-- Valid string, spaces are ignored for Hex strings DEADBEEF <-- Invalid string, must be contained in either "s or {}s {0A 12 ZZ} <-- Invalid string, 'Z' is not a valid Hex character To satisfy these general requirements, I had come up with the following Regex that seems to work well enough. I'm still fairly new to Regex, so there could be a huge hole here that I'm missing.: &quot;.+&quot;|\{([0-9]|[a-f]|[A-F]| )+\} If I recall correctly, the XML Schema regex automatically assumes beginning and end of line (^ and $ respectively). So, essentially, this regex accepts any string that starts and ends with a ", or starts and ends with {}s and contains only valid Hexidecimal characters. This has worked well for me so far except that I had forgotten about another (although less common, and thus forgotten) input option that completely breaks my regex. Where I made my mistake: Valid input should also allow a user to separate valid strings (of either type, literal/hex) by a comma. This means that a single string should be able to contain more than one of the above valid strings, separated by commas. Luckily, however, a comma is not a supported character within a literal string (although I see that my existing regex does not care about commas). Example test cases: "some string",{0A F1} <-- Valid {1122},{face},"peanut butter" <-- Valid {0D 0A FF FE},"string",{FF FFAC19 85} <-- Valid (Spaces don't matter in Hex values) "Validation is allowed to break, if a comma is found not separating values",{0d 0a} <-- Invalid, comma is a delimiter, but "Validation is allowed to break" and "if a comma..." are not marked as separate strings with "s hi mom,"hello" <-- Invalid, String1 was not enclosed properly in "s or {}s My thoughts are that it is possible to use commas as a delimiter to check each "section" of the string to match a regex similar to the original, but I just am not that advanced in regex yet to come up with a solution on my own. Any help would be appreciated, but ultimately a final solution with an explanation would just stellar. Thanks for reading this huge wall of text!

    Read the article

  • Binding Image.Source to String in WPF ?

    - by Mohammad
    I have below XAML code : <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" DataContext="{Binding RelativeSource={RelativeSource Self}}" WindowStartupLocation="CenterScreen" Title="Window1" Height="300" Width="300"> <Grid> <Image x:Name="TestImage" Source="{Binding Path=ImageSource}" /> </Grid> </Window> Also, there is a method that makes an Image from a Base64 string : Image Base64StringToImage(string base64ImageString) { try { byte[] b; b = Convert.FromBase64String(base64ImageString); MemoryStream ms = new System.IO.MemoryStream(b); System.Drawing.Image img = System.Drawing.Image.FromStream(ms); ////////////////////////////////////////////// //convert System.Drawing.Image to WPF image System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(img); IntPtr hBitmap = bmp.GetHbitmap(); System.Windows.Media.ImageSource imageSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); Image wpfImage = new Image(); wpfImage.Source = imageSource; wpfImage.Width = wpfImage.Height = 16; ////////////////////////////////////////////// return wpfImage; } catch { Image img1 = new Image(); img1.Source = new BitmapImage(new Uri(@"/passwordManager;component/images/TreeView/empty-bookmark.png", UriKind.Relative)); img1.Width = img1.Height = 16; return img1; } } Now, I'm gonna bind TestImage to the output of Base64StringToImage method. I've used the following way : public string ImageSource { get; set; } ImageSource = Base64StringToImage("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAABjUExURXK45////6fT8PX6/bTZ8onE643F7Pf7/pDH7PP5/dns+b7e9MPh9Xq86NHo947G7Hm76NTp+PL4/bHY8ojD67rc85bK7b3e9MTh9dLo97vd8/D3/Hy96Xe76Nfr+H+/6f///1bvXooAAAAhdFJOU///////////////////////////////////////////AJ/B0CEAAACHSURBVHjaXI/ZFoMgEEMzLCqg1q37Yv//KxvAlh7zMuQeyAS8d8I2z8PT/AMDShWQfCYJHL0FmlcXSQTGi7NNLSMwR2BQaXE1IfAguPFx5UQmeqwEHSfviz7w0BIMyU86khBDZ8DLfWHOGPJahe66MKe/fIupXKst1VXxW/VgT/3utz99BBgA4P0So6hyl+QAAAAASUVORK5CYIII").Source.ToString(); but nothing happen. How can I fix it ? BTW, I'm dead sure that the base64 string is correct

    Read the article

< Previous Page | 121 122 123 124 125 126 127 128 129 130 131 132  | Next Page >