Search Results

Search found 18677 results on 748 pages for 'current'.

Page 170/748 | < Previous Page | 166 167 168 169 170 171 172 173 174 175 176 177  | Next Page >

  • How do I loop through elements inside a div?

    - by crosenblum
    I have to make a custom function for search/replace text, because firefox counts text nodes differently than IE, Google Chrome, etc.. I am trying to use this code, that I saw at Firefox WhiteSpace Issue since in my other function, I am looping numerically through nodes, which serves my functional needs perfectly, in other browsers. But refuses to work, as part of a search/replace function that takes place after some ajax content is loaded. Here is the code, that I have tried to get to work, but I must be missing the correct understanding of the context of how to loop thru elements inside a div. // get all childnodes inside div function div_translate(divid) { // list child nodes of parent if (divid != null) { // var children = parent.childNodes, child; var parentNode = divid; // start loop thru child nodes for(var node=parentNode.firstChild;node!=null;node=node.nextSibling){ // begin check nodeType if(node.nodeType == 1){ // get value of this node var value = content(node); // get class of this node var myclass = node.attr('class'); console.log(myclass); // begin check if value undefined if (typeof(value) != 'undefined' && value != null) { console.log(value); // it is a text node. do magic. for (var x = en_count; x > 0; x--) { // get current english phrase var from = en_lang[x]; // get current other language phrase var to = other_lang[x]; if (value.match(from)) { content(node, value.replace(from, to)); } } } // end check if value undefined } // end check nodeType } // end loop thru child nodes } }

    Read the article

  • Loading Dimension Tables - Methodologies

    - by Nev_Rahd
    Hello, Recently I been working on project, where need to populated Dim Tables from EDW Tables. EDW Tables are of type II which does maintain historical data. When comes to load Dim Table, for which source may be multiple EDW Tables or would be single table with multi level pivoting (on attributes). Mean: There would be 10 records - one for each attribute which need to be pivoted on domain_code to make a single row in Dim. Out of these 10 records there would be some attributes with same domain_code but with different sub_domain_code, which needs further pivoting on subdomain code. Ex: if i got domain code: 01,02, 03 = which are straight pivot on domain code I would also have domain code: 10 with subdomain code / version as 2006,2007,2008,2009 That means I need to split my source table with above attributes into two = one for domain code and other for domain_code + version. so far so good. When it comes to load Dim Table: As per design specs for Dimensions (originally written by third party), what they want is: for every single change in EDW (attribute), it should assemble all the related records (for that NK) mean new one with other attribute values which are current = process them to create a new dim record and insert it. That mean if a single extract contains 100 records updated (one for each NK), it should assemble 100 + (100*9) records to insert / update dim table. How good is this approach. Other way I tried to do is just do a lookup into dim table for that NK get the value's of recent records (attributes which not changed) and insert it and update the current one. What would be the better approach assembling records at source side for one attribute change or looking into dim table's recent record and process it. If this doesn't make sense, would like to elaborate it further. Thanks

    Read the article

  • use Ghostscript to convert pcl to postscript

    - by Bryon
    So I want to use Ghostscript to convert files that are created in pcl format to postscript. That's the gist of my problem. I am simply trying to run it on the command line, but in the final stage it will have to be run on a lp command like lp -d < gs something something GPL Ghostscript 9.00 (2010-09-14) I will be running this on a solaris 10 server but I believe any unix system should work similar. bash-3.00# /usr/local/bin/gs -sDEVICE=pswrite -dLanguageLevel=1 -dNOPAUSE -dBATCH -dSAFER -sOutputFile=output.ps cms-form.pcl GPL Ghostscript 9.00 (2010-09-14) Copyright (C) 2010 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Error: /undefined in &k2G-210z100u0l6d0e63fa0V Operand stack: Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1910 1 3 %oparray_pop 1909 1 3 %oparray_pop 1893 1 3 %oparray_pop 1787 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- Dictionary stack: --dict:1154/1684(ro)(G)-- --dict:0/20(G)-- --dict:77/200(L)-- Current allocation mode is local Current file position is 30 GPL Ghostscript 9.00: Unrecoverable error, exit code 1

    Read the article

  • Open closed prinicple, problem

    - by Marcus
    Hi, I'm trying to apply OCP to a code snippet I have that in it's current state is really smelly, but I feel I'm not getting all the way to the end. Current code: public abstract class SomeObject {} public class SpecificObject1 : SomeObject {} public class SpecificObject2 : SomeObject {} // Smelly code public class Model { public void Store(SomeObject someObject) { if (someObject is SpecificObject1) {} else if (someObject is SpecificObject2) {} } } That is really ugly, my new approach looks like this: // No so smelly code public class Model { public void Store(SomeObject someObject) { throw new Expception("Not allowed!"); } public void Store(SpecificObject1 someObject) {} public void Store(SpecificObject2 someObject) {} } When a new SomeObject type comes along I must implement how that specific object is stored, this will break OCP cause I need to alter the Model-class. To move the store logic to SomeObject also feels wrong cause then I will violate SRP (?), becuase in this case the SomeObject is almost like a DTO, it's resposibility it not how to know to store itself. If a new implementation to SomeObject comes along who's store implementation is missing I will get a runtime error due to exception in Store method in Model class, it also feels like a code smell. This is because calling code will in the form of IEnumerable<SomeObject> sequence; I will not know the specific types of the sequence objects. I can't seem to grasp the OCP-concept. Anyone has any concrete examples or links that is a bit more than just some Car/Fruit example?

    Read the article

  • How can I replace a UITableViewController with a UIViewController that contains a UITableView?

    - by Dr Dork
    I created a new SplitView iPad project in Xcode and setup the code to populate the TableView (in the RootView on the left) with data. Now I'd like to customize the RootView to contain a DatePicker view along with the TableView, but I'm unsure how to accomplish this. Since the default RootViewController is a subclass of a UITableViewController, I couldn't add a DatePicker view to it in IB (since you can't add a DatePicker to a UITableView). The only way I understand to accomplish my goal of adding a DatePicker to the "Left" RootView is to change the RootViewController from a subclass of a UITableViewController to a subclass of a UIViewController, then I'll be able to add a view to it that contains a DatePicker view and a TableView using IB. Questions... Is this the correct approach to add a DatePicker to the "Left" RootView? If so and I change the RootViewController to a subclass of a UIViewController (instead of a UITableViewController) and add to it a TableView (along with the DatePicker), how will that affect the code I currently have in place for populating my current TableView? Thanks so much for all your help! Below is my current interface code for my RootViewController, if it'll help any. @interface RootViewController : UITableViewController <NSFetchedResultsControllerDelegate> { DetailViewController *detailViewController; NSFetchedResultsController *fetchedResultsController; NSManagedObjectContext *managedObjectContext; } @property (nonatomic, retain) IBOutlet DetailViewController *detailViewController; @property (nonatomic, retain) NSFetchedResultsController *fetchedResultsController; @property (nonatomic, retain) NSManagedObjectContext *managedObjectContext; - (void)insertNewObject:(id)sender; @end

    Read the article

  • How to change CSS color values in real-time off a javascript slider?

    - by bflora
    I'm making a page where the user gets a javascript slider that goes from 0 to 100 and can use it to set the opacity of a div on the page. I want the opacity of that div to change in real-time as they work the slider. I've not done this before. What's the best approach? There cursor in the slider displays the slider's current value as you move it. It seems to be that I just need to find a way to display that value in any arbitrary other place on the page so I can display it in the style settings for the div. The .js file that generates the slider has a line that (I think) is setting the current value in the cursor: $(this).children(".ui-slider-handle", context).html(parseInt(settings[index]['default'])); TO get this changing number to display somewhere else at the same time, do I just need to add a div somewhere and then add a line like this? $("#newDivId").children(".ui-slider-handle", context).html(parseInt(settings[index]['default'])); That seems like it would give me the number showing up in a div. How then would I get it into a form I could put into the style settings for a div? If this was a php variable, I would do something like this, style="opacity:<?php print $value ?>;" What would be the .js equivalent?

    Read the article

  • Use of RegularExpressionValidator in MS .Net Framework

    - by Lawk Salih
    Hi- I am trying to use the RegularExpressionValidator Control in Visual Studio to validate a textbox for email address expressions. Here's my code (very basic) Email:&nbsp; <input id="Text1" type="text" /><br /> <br /> <input id="Validate" type="button" value="Validate" runat="server" /><br /> <br /> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="RegularExpressionValidator" ControlToValidate="Validate" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator> Now, when I set controlToValidate to Validate, I get the following error message: Server Error in '/' Application. Control 'Validate' referenced by the ControlToValidate property of 'RegularExpressionValidator1' cannot be validated. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Control 'Validate' referenced by the ControlToValidate property of 'RegularExpressionValidator1' cannot be validated. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [HttpException (0x80004005): Control 'Validate' referenced by the ControlToValidate property of 'RegularExpressionValidator1' cannot be validated.] System.Web.UI.WebControls.BaseValidator.CheckControlValidationProperty(String name, String propertyName) +8734357 System.Web.UI.WebControls.BaseValidator.ControlPropertiesValid() +40 System.Web.UI.WebControls.BaseValidator.get_PropertiesValid() +21 System.Web.UI.WebControls.BaseValidator.OnPreRender(EventArgs e) +27 System.Web.UI.Control.PreRenderRecursiveInternal() +80 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842 Version Information: Microsoft .NET Framework Version:2.0.50727.3607; ASP.NET Version:2.0.50727.3082 I have tried the same mechanism before and have worked; however, this time I am on a new machine, WinXP Pro running IIS v5.1. Any direction would be appreciated.

    Read the article

  • difference between http.context.user and thread.currentprincipal and when to use them?

    - by yamspog
    I have just recently run into an issue running an asp.net web app under visual studio 2008. I get the error 'type is not resolved for member...customUserPrincipal'. Tracking down various discussion groups it seems that there is an issue with Visual Studio's web server when you assign a custom principal against the Thread.CurrentPrincipal. In my code, I now use... HttpContext.Current.User = myCustomPrincipal //Thread.CurrentPrincipal = myCustomPrincipal I'm glad that I got the error out of the way, but it begs the question "What is the difference between these two methods of setting a principal?". There are other stackoverflow questions related to the differences but they don't get into the details of the two approaches. I did find one tantalizing post that had the following grandiose comment but no explanation to back up his assertions... Use HttpConext.Current.User for all web (ASPX/ASMX) applications. Use Thread.CurrentPrincipal for all other applications like winForms, console and windows service applications. Can any of you security/dot.net gurus shed some light on this subject?

    Read the article

  • Calculating collision for a moving circle, without overlapping the boundaries

    - by Robert Vella
    Let's say I have circle bouncing around inside a rectangular area. At some point this circle will collide with one of the surfaces of the rectangle and reflect back. The usual way I'd do this would be to let the circle overlap that boundary and then reflect the velocity vector. The fact that the circle actually overlaps the boundary isn't usually a problem, nor really noticeable at low velocity. At high velocity it becomes quite clear that the circle is doing something it shouldn't. What I'd like to do is to programmatically take reflection into account and place the circle at it's proper position before displaying it on the screen. This means that I have to calculate the point where it hits the boundary between it's current position and it's future position -- rather than calculating it's new position and then checking if it has hit the boundary. This is a little bit more complicated than the usual circle/rectangle collision problem. I have a vague idea of how I should do it -- basically create a bounding rectangle between the current position and the new position, which brings up a slew of problems of it's own (Since the rectangle is rotated according to the direction of the circle's velocity). However, I'm thinking that this is a common problem, and that a common solution already exists. Is there a common solution to this kind of problem? Perhaps some basic theories which I should look into?

    Read the article

  • Can isdigit legitimately be locale dependent in C

    - by cdev
    In the section covering setlocale, the ANSI C standard states in a footnote that the only ctype.h functions whose behaviour is not affected by the current locale are isdigit and isxdigit. The Microsoft implementation of isdigit is locale dependent because, for example, in locales using code page 1250 isdigit only returns non-zero for characters in the range 0x30 ('0') - 0x39 ('9'), whereas in locales using code page 1252 isdigit also returns non-zero for the superscript digits 0xB2 ('²'), 0xB3 ('³') and 0xB9 ('¹'). Is Microsoft in violation of the C standard by making isdigit locale dependent? In this question I am primarily interested in C90, which Microsoft claims to conform to, rather than C99. Additional background: Microsoft's own documentation of setlocale incorrectly states that isdigit is unaffected by the LC_CTYPE part of the locale. The section of the C standard that covers the ctype.h functions contains some wording that I consider ambiguous: "The behavior of these functions is affected by the current locale. Those functions that have locale-specific aspects only when not in the "C" locale are noted below." I consider this ambiguous because it is unclear what it is trying to say about functions such as isdigit for which there are no notes about locale-specific aspects. It might be trying to say that such functions must be assumed to be locale dependent, in which case Microsoft's implementation of isdigit would be OK. (Except that the footnote I mentioned earlier seems to contradict this interpretation.)

    Read the article

  • How to build a simulation of a login hardware token in .Net

    - by Michel
    Hi, i have a hardware token for remote login to some citrix environment. When i click the button on the device, i get an id and i can use that to login to the citrix farm. I can click the button as much as i like, and every time a new code gets generated, and they all work. Now i want to secure my private website likewise, but not with the hardware token, but with a 'token app' on my phone. So i run an app on my phone, generate a key, and use that to (partly) authenticate myself on the server. But here's the point: i don't know how it works! How can i generate 1, 2 or 100 keys at one time which i can see (on the server) are all valid, but without the server and the phone app having contact (the hardware token also is an 'offline' solution). Can you help me with a hint how i would do this? This is what i thought of so far: the phone app and the server app know (hardcoded) the same encryption key. The phone app encrypts the current time. The server app decrypts the string to the current time and if the diff between that time and the actual server time is less than 10 minutes it's an ok. Difficult for other users to fake a key, but encryption gives such nasty strings to enter, and the hardware token gives me nice things like 'H554TU8' And this is probably not how the real hardware token works, because the server and the phone app must 'know' the same encryption key. Michel

    Read the article

  • Make a form not focusable in C#

    - by Jandex
    Hi! I'm wanting to write a virtual keyboard, like windows onscreen keyboard for touchscreen pcs. But I'm having problem with my virtual keyboard stealing the focus from the application being used. The windows onscreen keyboard mantains the focus on the current application even when the user clicks on it. Is there a way to do the same with windows forms in C#? The only thing I can do for now is to send a keyboard event to an especific application, like notepad in the following code. If I could make the form not focusable, I could get the current focused window with GetForegroundWindow. [DllImport("USER32.DLL", CharSet = CharSet.Unicode)] public static extern IntPtr FindWindow(string lpClassName,string lpWindowName); [DllImport("USER32.DLL")] public static extern bool SetForegroundWindow(IntPtr hWnd); private void button1_Click(object sender, EventArgs e) { IntPtr calculatorHandle = FindWindow("notepad", null); SetForegroundWindow(calculatorHandle); SendKeys.SendWait("111"); } Is there a way this can be done? Any suggestions of a better way to have the form sending keyboard events to the application being used? Thanks!!

    Read the article

  • Uniquing with Existing Core Data Entities

    - by warrenm
    I'm using Core Data to store a lot (1000s) of items. A pair of properties on each item are used to determine uniqueness, so when a new item comes in, I compare it against the existing items before inserting it. Since the incoming data is in the form of an RSS feed, there are often many duplicates, and the cost of the uniquing step is O(N^2), which has become significant. Right now, I create a set of existing items before iterating over the list of (possible) new items. My theory is that on the first iteration, all the items will be faulted in, and assuming we aren't pressed for memory, most of those items will remain resident over the course of the iteration. I see my options thusly: Use string comparison for uniquing, iterating over all "new" items and comparing to all existing items (Current approach) Use a predicate to filter the set of existing items against the properties of the "new" items. Use a predicate with Core Data to determine uniqueness of each "new" item (without retrieving the set of existing items). Is option 3 likely to be faster than my current approach? Do you know of a better way?

    Read the article

  • Java BoxLayout alignment issue

    - by ManInMoon
    Can anyone help me. Why is the Label "Current" NOT left aligned in Panel/Frame? public static void main(String[] args) { JFrame TFrame = new JFrame("Test DisplayLayout"); TFrame.setResizable(true); TFrame.setSize(new Dimension(900, 840)); TFrame.setLocationRelativeTo(null); TFrame.setTitle("DisplayLayout"); TFrame.setVisible(true); JPanel P = DisplayLayout2(); P.setVisible(true); P.setOpaque(true); P.setLayout(new BoxLayout(P, BoxLayout.Y_AXIS)); TFrame.add(P); TFrame.revalidate(); TFrame.repaint(); } public static JPanel DisplayLayout2() { JPanel Panel=new JPanel(); Panel.setVisible(true); Panel.setOpaque(true); Panel.setLayout(new BoxLayout(Panel, BoxLayout.Y_AXIS)); Panel.setAlignmentX(Component.LEFT_ALIGNMENT); JLabel lab = new JLabel("Current"); lab.setHorizontalAlignment(SwingConstants.LEFT); lab.setForeground(Color.WHITE); lab.setBackground(Color.PINK); lab.setOpaque(true); Panel.add(lab,Component.LEFT_ALIGNMENT); JPanel posPanel = new JPanel(); JScrollPane scrollPane = new JScrollPane(posPanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setPreferredSize(new Dimension(290, 200)); scrollPane.setOpaque(true); posPanel.setBackground(Color.YELLOW); posPanel.setPreferredSize(new Dimension(290, 200)); posPanel.setLayout(new BoxLayout(posPanel, BoxLayout.Y_AXIS)); posPanel.setAlignmentX(Component.LEFT_ALIGNMENT); Panel.add(scrollPane); return Panel; }

    Read the article

  • wordpress php > div issue

    - by Philip Bateman
    Thanks in advance for you help Ive been doing this as a lovejob for friends and now im getting quotes of several hundred dollars for minor homepage variation and I'm not sure if its valid. I'm not a programmer myself, just trying hard :) Via the CafePress press75 theme, I'm trying to go from 1 / 2 / 3 column home layout, to 1-2 merged and 3, push the 2nd column data to the right and have the 1st column span as a 16:9 gallery (nextgengallery plugin installed). Is this really a complex thing from a coding perspective? The current guy talking to me is saying its going to cost $700 or 800 AUD to alter, which is rough when the template cost $85.. From this http://shocolate.com.au.previewdns.com/wp-content/uploads/2010/05/shocolatecurrent.jpg to this 'url+Shocolatelooklikethis.jpg' I was able to get the sidebar removed by taking out ‘‘ near the bottom of home.css.. Just can’t get the middle data to flow over it? This would be ideal as a result, as the system puts the latest selected blog post on the homepage, so if we can get rid of the sidebar div and have the text appear where it was, that would be ideal. Removing the sidebar from the bottom of home.php and setting the thumbnail width to say 450 gives me the result im after EXCEPT the text doesn’t fill where the sidebar is, it wraps underneath. Reference 'shocolate.com.au.previewdns.com' for current site Thank you!!! Phil (Melbourne)

    Read the article

  • MySQL help, counting information on last records

    - by ee12csvt
    I need some advice I have two tables, one holds unique serial numbers of items (items) and the other holds status changes and other information for these items (details) The Tables are set up as follows Item itemID itemName itemDate details detID itemID modlvl status detDate All items have at least one record in the details table, but over time the status has changed or the modification level has changed (Both of these are identified by numbers which are held in other appropriate tables) and a new record is created each time the status/modlvl changes I want to display a table on my webpage using php that identifies the different mod levels of the items and shows a count of each of the current status of the items EDIT Hi Ronnis, This is an example of the data in the tables and what I want to achieve The current Mod Levels range from 1 to 3 Status representations are 1 In Use 2 In Store 3 Being repaired 4 In Transit 5 For Disposal 6 Disposed 7 Lost Item itemID OrigMod created 1000 1 2009-10-01 22:12:12 1001 1 2009-10-01 22:12:12 1002 1 2009-10-01 22:12:12 1003 1 2009-10-01 22:12:12 1004 1 2009-10-01 22:12:12 1005 1 2009-10-01 22:12:12 1006 1 2009-10-01 22:12:12 1007 1 2009-10-01 22:12:12 1008 1 2009-10-01 22:12:12 1009 1 2009-10-01 22:12:12 1010 1 2009-10-01 22:12:12 Details detID itemID modlvl detDate status 1 1000 1 2009-10-01 1 2 1001 1 2009-10-01 1 3 1002 1 2009-10-01 1 4 1003 1 2009-10-01 1 5 1004 1 2009-10-01 1 6 1005 1 2009-10-01 1 7 1006 1 2009-10-01 1 8 1007 1 2009-10-01 1 9 1008 1 2009-10-01 1 10 1009 1 2009-10-01 1 11 1010 1 2009-10-01 1 12 1001 1 2010-02-01 2 13 1001 1 2010-02-03 4 14 1001 1 2010-03-01 3 15 1000 1 2010-03-14 2 16 1001 2 2010-04-01 4 17 1006 1 2010-04-01 2 18 1001 2 2010-04-03 2 19 1006 1 2010-04-14 4 20 1006 1 2010-05-01 5 21 1002 1 2010-05-02 2 22 1003 1 2010-05-10 2 23 1010 1 2010-06-01 2 24 1006 1 2010-06-18 6 25 1010 1 2010-07-01 7 26 1007 1 2010-07-02 2 27 1007 1 2010-07-04 4 28 1003 1 2010-07-10 2 29 1007 1 2010-07-11 3 30 1007 2 2010-07-12 4 31 1007 2 2010-07-15 2 32 1001 2 2010-08-31 1 33 1001 2 2010-09-10 2 34 1001 2 2010-10-01 4 35 1008 1 2010-10-01 2 36 1001 2 2010-10-05 3 37 1008 1 2010-10-05 4 38 1008 1 2010-10-10 3 39 1001 3 2010-10-20 4 40 1001 3 2010-10-25 2 Using the tables above I want to get this result MoLvl Use Store Repd Transit Displ Dispd Lost Total 1 3 3 1 0 0 1 1 9 2 0 1 0 0 0 0 0 1 3 0 1 0 0 0 0 0 1 Total 3 5 1 0 0 1 1 11

    Read the article

  • Writing a plist

    - by iOS-Newbie
    I am trying to test out writing a dictionary to a plist. The following code does not report any errors, but I cannot find any trace of the file that I supposed wrote. Here is the code snippet: NSDictionary *myDictionary = [NSDictionary dictionaryWithObjectsAndKeys: @"First letter of the alphabet", @"A", @"Second letter of the alphabet", @"B", @"Third letter of the alphabet", @"C", nil ]; I can see the dictionary contents displayed properly with either method calls: NSLog(@"Here is my partial dictionary %@", myDictionary); for (NSString *key in myDictionary) NSLog(@"here it is again %@ %@", key, [myDictionary objectForKey:key]); The following code displays the "succeeded" message when the program is run repeatedly if ([myDictionary writeToFile: @"myDictionary" atomically:YES ] == NO) NSLog(@"write to file failed"); else NSLog(@"write to file succeeded"); even when changing the atomically: argument to NO to not write a temporary file. However, when I search my current directory, or even my entire Mac, I cannot find any file called "myDictionary.plist" or any file with the string "myDictionary". Isn't the path variable "@myDictionary" supposed to represent the file at the current directory, i.e. where the class executable resides?

    Read the article

  • C/C++ I18N mbstowcs question

    - by bogertron
    I am working on internationalizing the input for a C/C++ application. I have currently hit an issue with converting from a multi-byte string to wide character string. The code needs to be cross platform compatible, so I am using mbstowcs and wcstombs as much as possible. I am currently working on a WIN32 machine and I have set the locale to a non-english locale (Japanese). When I attempt to convert a multibyte character string, I seem to be having some conversion issues. Here is an example of the code: int main(int argc, char** argv) { wchar_t *wcsVal = NULL; char *mbsVal = NULL; /* Get the current code page, in my case 932, runs only on windows */ TCHAR szCodePage[10]; int cch= GetLocaleInfo( GetSystemDefaultLCID(), LOCALE_IDEFAULTANSICODEPAGE, szCodePage, sizeof(szCodePage)); /* verify locale is set */ if (setlocale(LC_CTYPE, "") == 0) { fprintf(stderr, "Failed to set locale\n"); return 1; } mbsVal = argv[1]; /* validate multibyte string and convert to wide character */ int size = mbstowcs(NULL, mbsVal, 0); if (size == -1) { printf("Invalid multibyte\n"); return 1; } wcsVal = (wchar_t*) malloc(sizeof(wchar_t) * (size + 1)); if (wcsVal == NULL) { printf("memory issue \n"); return 1; } mbstowcs(wcsVal, szVal, size + 1); wprintf(L"%ls \n", wcsVal); return 0; } At the end of execution, the wide character string does not contain the converted data. I believe that there is an issue with the code page settings, because when i use MultiByteToWideChar and have the current code page sent in EX: MultiByteToWideChar( CP_ACP, 0, mbsVal, -1, wcsVal, size + 1 ); in place of the mbstowcs calls, the conversion succeeds. My question is, how do I use the generic mbstowcs call instead of teh MuliByteToWideChar call?

    Read the article

  • Accessing program information that gdb sees in C++

    - by anon
    I have a program written in C++, on Linux, compiled with -g. When I run it under gdb, I can 1) set breakpoints 2) at those breakpoints, print out variables 3) see the stackframe 4) given a variable that's a structure, print out parts of the structure (i.e. how ddd displays information). Now, given that my program is compiled with "-g" -- is there anyway that I can access this power within my program itself? I.e. given that my program is compiled with "-g", is there some std::vector<string> getStackFrame(); function I can call to get the current stackframe at the current point of execution? Given a pointer to an object and it's type ... can I do std::vector getClassMember(class_name); ? I realize the default answer is "no, C++ doesn't support that level of introspection" -- however, recall I'm on linux, my program is compiled with "-g", and gdb can do it, so clearly the inforamtion is there. Question is: is there some API for accessing it? EDIT: PS Naysers, I'd love to see a reason for closing this question.

    Read the article

  • Using Mercurial in a Large Organization

    - by Kristopher Johnson
    I've been using Mercurial for my own personal projects for a while, and I love it. My employer is considering a switch from CVS to SVN, but I'm wondering whether I should push for Mercurial (or some other DVCS) instead. One wrinkle with Mercurial is that it seems to be designed around the idea of having a single repository per "project". In this organization, there are dozens of different executables, DLLs, and other components in the current CVS repository, hierarchically organized. There are a lot of generic reusable components, but also some customer-specific components, and customer-specific configurations. The current build procedures generally get some set of subtrees out of the CVS repository. If we move from CVS to Mercurial, what is the best way to organize the repository/repositories? Should we have one huge Mercurial repository containing everything? If not, how fine-grained should the smaller repositories be? I think people will find it very annoying if they have to pull and push updates from a lot of different places, but they will also find it annoying if they have to pull/push the entire company codebase. Anybody have experience with this, or advice?

    Read the article

  • How do I fix a "Request format is unrecognized for URL..." error in a web service running in IIS?

    - by Hary
    I am get the following error while running web service in IIS: Server Error in '/Inbox Sevice' Application. Request format is unrecognized for URL unexpectedly ending in '/GetMailsInfo'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/GetMailsInfo'. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/GetMailsInfo'.] System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +490982 System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +104 System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +127 System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +175 System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +120 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155 Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42 Does anyone know why I am seeing this error and if there is any way to fix it?

    Read the article

  • Why ASP.NET menu control ignores roles in Web.sitemap?

    - by MainMa
    Hi, I have a website with a menu based on sitemap. ActiveDirectoryRoleProvider is a custom class. securityTrimmingEnabled of sitemap provider is set to true. Now, nevertheless the roles set in the sitemap file, site menu displays every sitemap entity. So for example if I have in sitemap a node with roles="*", a second one with roles="Administrators" and a third one with roles="Foo" and I login as a member of Administrators group but not Foo group, the site menu will display all three items. On the other hand, if I have a node which does not specify roles attribute but has children, this node will never be displayed. If I put: <%= HttpContext.Current.User.IsInRole("Administrators") ? "Admin" : "Not admin"%> <%= HttpContext.Current.User.IsInRole("Foo") ? "Foo" : "Not foo"%> before the menu, it displays that I'm Admin, but Not foo, which is just fine. So if it knows that I'm Admin but Not foo, why does it continue to display Foo's sitemap nodes? Note: changing authorizations has no effect on the menu. It continues to show every item, even for the pages I'm unable to access.

    Read the article

  • Building an 'Activation Key' Generator in JAVA

    - by jax
    I want to develop a Key generator for my phone applications. Currently I am using an external service to do the job but I am a little concerned that the service might go offline one day hence I will be in a bit of a pickle. How authentication works now. Public key stored on the phone. When the user requests a key the 'phone ID' is sent to the "Key Generation Service" and the encrypted key key is returned and stored inside a license file. On the phone I can check if the key is for the current phone by using a method getPhoneId() which I can check with the the current phone and grant or not grant access to features. I like this and it works well, however, I want to create my own "Key Generation Service" from my own website. Requirements: Public and Private Key Encryption:(Bouncy Castle) Written in JAVA Must support getApplicationId() (so that many applications can use the same key generator) and getPhoneId() (to get the phone id out of the encrypted license file) I want to be able to send the ApplicationId and PhoneId to the service for license key generation. Can someone give me some pointers on how to accomplish this? I have dabbled around with some java encryption but am definitely no expert and can't find anything that will help me. A list of the Java classes I would need to instantiate would be helpful.

    Read the article

  • What should I do from here?

    - by Sunscreen
    Hi all, First of all, the site rocks. You can ask and get specific answers, mainly, for programming issues. This question is more generic. I studied Physics for my bachelors and Digital Image Processing for my masters, ended on September 2001. From then on I started working as a developer and software analyst. I worked, and working, witn C, C++, AIX OS, XP OS, MFC 4.21. I also did some data translations from EDIFACT to XML and viceversa. I trained users for the applications that I was running, I created documents (detailed design docs mainly), though most of the time I wrote, and I still write, code. Recently I applied for the best greek, graduate university for my MBA and they accepted me, starting on Jan 2011. I am a developer with no specific insight with the languages I work. I can be very productive with some subsets of the languages that the companies I worked for use, though this is a limited thing for a developer. If I get my MBA I can be a semi-businees analyst ot consultant, as I am now a semi-developer. The problem is that I can do some but not all in a designated working area. What should I do from here? Should I get my MBA and look forswitching industries? Should I read and excersise myself with new languages and frameworks? Should I be more focussed to the deligations from my current job (currently I work with MFC)? Just for the note, I am 32 and I feel I am wasting my time. I am not getting the best that I can get from is current position (and I work here for 3+ years). Thanks all, Sun

    Read the article

  • javascript watching for variable change via a timer

    - by DA
    I have a slide show where every 10 seconds the next image loads. Once an image loads, it waits 10 seconds (setTimeout) and then calls a function which fades it out, then calls the function again to fade in the next image. It repeats indefinitely. This works. However, at times, I'm going to want to over-ride this "function1 call - pause - function2 call - function1 call" loop outside of this function (for instance, I may click on a slide # and want to jump directly to that slide and cancel the current pause). One solution seems to be to set up a variable, allow other events to change that variable and then in my original function chain, check for any changes before continuing the loop. I have this set up: var ping = 500; var pausetime = 10000; for(i=0; i<=pausetime; i=i+ping){ setTimeout(function(){ console.log(gocheckthevariable()); console.log(i); pseudoIf('the variable is true AND the timer is done then...do the next thing') },i) } The idea is that I'd like to pause for 10 seconds. During this pause, every half second I'll check to see if this should be stopped. The above will write out to the console the following every half second: true 10000 true 10000 true 10000 etc... But what I want/need is this: true 0 true 500 true 1000 etc... The basic problem is that the for loop executes before each of the set timeouts. While I can check the value of the variable every half second, I can't match that against the current loop index. I'm sure this is a common issue, but I'm at a loss what I should actually be searching for.

    Read the article

< Previous Page | 166 167 168 169 170 171 172 173 174 175 176 177  | Next Page >