Search Results

Search found 10025 results on 401 pages for 'state restoration'.

Page 86/401 | < Previous Page | 82 83 84 85 86 87 88 89 90 91 92 93  | Next Page >

  • kubuntu: wireless manager can't find any networks

    - by timuçin
    I just installed Kubuntu 12.10 and as I knew my wireless driver would not be recognized, I installed it manually through here. I suppose I shall mention that I also had to do this. The driver worked just fine until I restarted my system. Since then I can't even start over. My wireless card is realtek 8723 The oly lead I have is this piece of log: 11/14/12 07:35:21 AM timucin-W150ER NetworkManager[989] <info> wpa_supplicant started 11/14/12 07:35:21 AM timucin-W150ER NetworkManager[989] <info> (wlan0) supports 4 scan SSIDs 11/14/12 07:35:21 AM timucin-W150ER NetworkManager[989] <info> (wlan0): supplicant interface state: starting -> ready 11/14/12 07:35:21 AM timucin-W150ER NetworkManager[989] <info> (wlan0): device state change: unavailable -> disconnected (reason 'supplicant-available') [20 30 42] 11/14/12 07:35:21 AM timucin-W150ER NetworkManager[989] <warn> Trying to remove a non-existant call id. 11/14/12 07:35:21 AM timucin-W150ER NetworkManager[989] <info> (wlan0): supplicant interface state: ready -> inactive 11/14/12 07:35:21 AM timucin-W150ER NetworkManager[989] <info> (wlan0) supports 4 scan SSIDs I feel really bad that I have been trying so many things and even while I am trying them I get a problem at every step. I am really frustrated. You can the time in the logs, I didn't get up early. Just needed to share my feelings. Even the ethernet cable I have use is short for God's sake, I have had to sit at this massively uncomfortable posture for hours. edit: I discovered something interesting. When I boot my windows I see that my wireless manager says "disconnected" now. However when I start ubuntu after windows and modprobe rtl8723e wireless works just fine. Then again, when I restart ubuntu I am back where I have started. So now I have to start windows, restart my machine and do the modprobe thing to see wireless networks.

    Read the article

  • ASP.NET MVC Portable Areas - Can they communicate and be used as a plugin-like architecture?

    - by Beton
    I'll get straight to the point: I was wondering if there is a common pattern to use portable areas as a components of a plugin-like architecture. Example: We've got 3 plugins (portable areas) packaged and distributed via NuGet feed. Each of them is following the standard MVC structure (has it own Models, Views and Controllers). Lets say login form, header and footer. What I was wondering if there is a way to make them communicate. For example: when user logs on, login plugin executes it own logic, logs the user and then it updates the state of the header plugin with changes it state accordingly. Thanks in advance.

    Read the article

  • What is a good university for computer science and game development?

    - by DukeYore
    I am starting my computer science degree at a local community college in programming using C++. However, I will be transferring to a 4-year university. Does anyone have any insight on university programs? I know Cal State Fullerton has a degree with a minor in Game Development. however, is that as important as getting a degree from a really great school? If I could shoot for something like Cal Poly would that be better? Or even Stanford or SF State being so close to so many gaming companies up there in the Bay area?

    Read the article

  • Processing a list of atomic operations, allowing for interruptions

    - by JDB
    I'm looking for a design pattern that addresses the following situation: There exists a list of tasks that must be processed. Tasks may be added at any time. Each task is wholly independent from all other tasks. The order in which tasks are processed has no effect on the overall system or on the tasks themselves. Every task must be processed once and only once. The "main" process which launches the task processors may start and stop without warning. When stopped, the "main" process loses all in-memory data. Obviously this is going to involve some state, but are there any design patterns which discuss where and how to maintain that state? Are there any relevant anti-patterns? Named patterns are especially helpful so that we can discuss this topic with other organizations without having to describe the entire problem domain.

    Read the article

  • What is required to create local business rich-snippets complete with sitelinks AND breadcrumbs?

    - by Felix
    I have a local business directory site. I would like to markup my business listing 'profile' level pages for display as enhanced listings/rich-snippets complete with business names, addresses and phone numbers. I would also like to display site-links and path-based breadcrumbs to help users navigate site directory hierarchy (which is deep). Is there a limit to the amount of breadcrumbs a site can leave? Is there a separate limit on the number of breadcrumbs which Google/Bing will display in the SERP? What kind of markup language(s) would be needed to best position my site to show site-links AND breadcrumbs? For example: Find a business Browse by Location State City Zip or Find a business Choose Service Browse by location State City Thanks all!

    Read the article

  • How to chain actions/animations together and delay their execution?

    - by codinghands
    I'm trying to build a simple game with a number of screens - 'TitleScreen', 'LoadingScreen', 'PlayScreen', 'HighScoreScreen' - each of which has it's own draw & update logic methods, sprites, other useful fields, etc. This works well for me as a game dev beginner, and it runs. However, on my 'PlayScreen' I want to run some animations before the player gets control - dropping in some artwork, playing some sound effects, generally prettifying things a little. However, I'm not sure what the best way to chain animations / sound effects / other timed general events is. I could make an intermediary screen, 'PrePlayScreen', which simply has all of this hardcoded like so: Update(){ Animation anim1 = new Animation(.....); Animation anim2 = new Animation(.....); anim1.Run(); if(anim1.State == AnimationState.Complete) anim2.Run(); if(anim2.State == AnimationState.Complete) // Load 'PlayScreen' screen } But this doesn't seem so great - surely their must be a better way? I then thought, 'Hey - an AnimationManager! That'd be awesome!'. But then that creeping OOP panic set in as I thought about it some more. If I create the Animation in my Screen, then add it to the AnimationManager (which may or may not be a GameComponent hooked up to Update/Draw), how can I get 'back' to it? To signal commands like start / end / repeat? I'd still need to keep a reference to the object in my Screen so that I could still communicate with it once it's buried in the bosom of a List in my AnimationManager. This seems bad. I've also tried using events - call 'Update' on all the animations in the PlayScreen update loop, but crucially all of the animations have a bool flag ('Active') which determines whether they should begin. The first animation has this set to 'true', all others 'false'. On completion the first animation raises an event, which sets animation 2's bool flag to true (and so it then runs). Once animation 2 is complete another 'anim complete' event is raised, and the screen state changes. Considering the game I'm making is basically as simple as it gets I know I'm overthinking this... it's just the paradigm shift from web - game development is making me break out in a serious case of the stupids.

    Read the article

  • After power manager reinstall

    - by tuxi
    I had checking battery state hanging I solved it with the help of an answer from this site: sudo apt-get --reinstall install gnome-power-manager But now my left windows bar is rigid, it does not disappear on wide screen. EDIT Also in most of applications, characters are white. What could be the problem? and what should I do? 2ND EDIT My ubuntu is 12.04 LTS. I was trying to install some packages for dependencies of allegro game development library, one of the packages was libwxgtk2.8-0, after that a red cross appeared near user name and clock. Then computer became frozen and i had to remove my battery. I know it is a very bad thing. Then when i try to restart my computer, it could not start, it was waiting on black screen with line: Checking battery state... Then i run the above command. Computer could start but characters are white.

    Read the article

  • suspend error on 14.04 LTS

    - by user1450663
    I've looked around and seems like various problems around suspend are wide spreaded for 14.04 release, nevertheless I haven't seen exactly my problem reported, nor my laptop model mentioned. So, the problem. When I press sleep button system seems to be going into suspend, i.e. screen goes black, it stops responding on the keyboard and wireless LEDs turn off, however the power LED doesn't go into suspend state and CPU fan also keeps spinning. But unlike the other problem described here https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1315435 when I close the lid and reopen it - system wakes up and goes back to normal locked screen state, so reboot is not needed. System details: This is a clean freshly installed Ubuntu 14.04, 32bit Laptop Dell D630 kernel 3.13.0-34-generic

    Read the article

  • Missing shared library for Rhythmbox

    - by user1450120
    After I upgraded from 13.04 to 13.10 my rhythmbox wouldn't work. After many failed attempts I ended up uninstalling and removing all traces of rhythmbox I could find. Now I've reinstalled rhythmbox, and am getting the error rhythmbox: error while loading shared libraries: librhythmbox-core.so.7: cannot open shared object file: No such file or directory I've tried sudo apt-get install librhythmbox* Only to get Reading package lists... Done Building dependency tree Reading state information... Done Note, selecting 'librhythmbox-core5' for regex 'librhythmbox*' Note, selecting 'librhythmbox-core6' for regex 'librhythmbox*' Note, selecting 'librhythmbox-core7' for regex 'librhythmbox*' librhythmbox-core7 is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded. Any ideas on how to get rhythmbox back to a working state?

    Read the article

  • How do I disable auto-away for online presence?

    - by Will
    I am using Natty with with classic GNOME desktop. I use Empathy and sometimes Skype. Both these get the online state from the system itself somehow. If I don't touch my keyboard for a few minutes - even when watching a YouTube clip or something - the inactivity triggers an auto-away state on my messaging apps. It's synchronized so I imagine its coming coordinated from the system, and not the two apps making the same decision individually. How can I disable this? I want manual control - I'm only away when I set it to away in a messaging app.

    Read the article

  • the new distro ubuntu 12.10 has 2 system Bugs, reinstall the iso also exist [closed]

    - by sunpoison
    Possible Duplicate: How do I report a bug? discovered 2 bugs:: 1)cannot restart the computer when you click the top right icon power key "restart", it will stay on the splash image "ubuntu...",i wait for about 7 minutes and more, it also cannot restart, so, i have to uninstall the battery of the laptop...... 2)when i first update to the 12.10,not run for few hours, the "input method icon" on the top state bar is suddenly hide, when i use the shortcuts to switch the input method with "ctrl +space" it doesn' work at all, i restart the laptop, it can change the input method, but the state icon "a small keyboard icon is escape, i goto the "i bus" settings, but when i how to adjust it, the icon still can't display on the top bar (now i reinstall it use the iso file, this bug is fixed, but it cannot restart like the former one) it must has some problems of the "i bus" input method

    Read the article

  • Driver inversion

    - by Val
    I have a GUI game, which is driven by user every time it clicks the mouse. Every time user clicks a square on a board, the board state is updated (we re-compute the score, the player to make next move and legal movements it can make) and repainted. Both mouse click, state recomputation and painting are handled in the GUI thread. Now, suppose that I want to train AI to play without GUI. That is, game engine should consume next move by simply calling AI's makeMove function in one thread. This would allow to play millions of games per second automatically. GUI may just screenshot some arbitrary states time after time. How do you switch to this strategy?

    Read the article

  • Getting wifi working on 14.04

    - by user286114
    I have installed Ubuntu 14.04 on my laptop. When I plug in the ethernet cable the internet works fine, but I can't see any wireless network in the networking manager. The wifi switch is definitely on on my laptop! It's a Dell XPS M1330. I'm not sure what the network card is - how can I find out? nm-tool gives me this: NetworkManager Tool State: connected (global) - Device: eth0 [Wired connection 1] ------------------------------------------- Type: Wired Driver: tg3 State: connected Default: yes HW Address: 00:23:AE:28:FE:A2 Capabilities: Carrier Detect: yes Speed: 100 Mb/s Wired Properties Carrier: on IPv4 Settings: Address: 192.168.1.26 Prefix: 24 (255.255.255.0) Gateway: 192.168.1.254 DNS: 192.168.1.254

    Read the article

  • How to disable the "roll up" / "shade" keyboard shortcut in Gnome 3 (after upgrading to 12.04)?

    - by torpesco
    I am using Gnome 3. After upgrading from 11.10 to 12.04, "Ctrl-Alt-S" was reclaimed for use in toggling the shaded state of a window. I have checked the following places, and I haven't been able to find any instance of a keybinding set for toggling the shaded state. System Settings / Hardware / Keyboard / Shortcuts (as per How do I disable Ctrl+Alt+s to minimize a window?) I even tried setting a different shortcut. Made no difference. dconf-editor (now deprecated, from what I've found) gconf-editor/gsettings What am I missing?

    Read the article

  • ??????????

    - by Allen Gao
    ???????RAC??????????????????10gR2?11gR1.??????????????CRS???????1.ocssd : ???????????(Node Monitoring)????(Group Management),??CRS????????????????????????,????????????(network heartbeat)?????(disk heartbeat)???,?????????????????????,????????????,??????????????????,?????node kill escalation(???11gR1????????),??????????????????????????(reboot time,???3?)????????:ocssd.bin??????????????????????????,??????????????????????????????,misscount(???30?,??????????????600?),????????????,???????????????????,?????????????2???,??????,??????????????,?????????????????????:ocssd.bin?????????????(Voting File)??????????,?????????????????????????????,disk timeou(???200?),?????????????????????,CRS???[N/2]+1????????,??N??????,??????2.oclsomon:????????ocssd????,????ocssd.bin??????,???????3.oprocd:??????Linux?Unix??,????????????????????????????????,?????????:????????????init.cssd?????????????????????????1.??????2.<crs???>/log/<????>/cssd/ocssd.log3.oprocd.log(/etc/oracle/oprocd/*.log.* ? /var/opt/oracle/oprocd/*.log.*)4.<crs???>/log/<????>/cssd/oclsomon/oclsomon.log5. Oracle OSWatcher ????????????????????1.?ocssd???????????ocssd.log???????,????????????????????????????????,???????,OSW??(traceroute???),???????(cluster interconnect)??????,?????????[ CSSD]2012-03-02 23:56:18.749 [3086] >WARNING: clssnmPollingThread: node <node_name> at 50% heartbeat fatal, eviction in 14.494 seconds[ CSSD]2012-03-02 23:56:25.749 [3086] >WARNING: clssnmPollingThread: node <node_name> at 75% heartbeat fatal, eviction in 7.494 seconds[ CSSD]2012-03-02 23:56:32.749 [3086] >WARNING: clssnmPollingThread: node <node_name>at 90% heartbeat fatal, eviction in 0.494 seconds[CSSD]2012-03-02 23:56:33.243 [3086] >TRACE:   clssnmPollingThread: Eviction started for node <node_name>, flags 0x040d, state 3, wt4c 0[CSSD]2012-03-02 23:56:33.243 [3086] >TRACE:   clssnmDiscHelper: <node_name>, node(4) connection failed, con (1128a5530), probe(0)[CSSD]2012-03-02 23:56:33.243 [3086] >TRACE:   clssnmDiscHelper: node 4 clean up, con (1128a5530), init state 5, cur state 5[CSSD]2012-03-02 23:56:33.243 [3600] >TRACE:   clssnmDoSyncUpdate: Initiating sync 196446491[CSSD]2012-03-02 23:56:33.243 [3600] >TRACE:   clssnmDoSyncUpdate: diskTimeout set to (27000)ms??:???????ocssd.log?????????????????????,?????????????????????ocssd.log???????,??????????????????????????????,OSWatcher??(iostat???),???i/o????????,?????????2010-08-13 18:34:37.423: [    CSSD][150477728]clssnmvDiskOpen: Opening /dev/sdb82010-08-13 18:34:37.423: [    CLSF][150477728]Opened hdl:0xf4336530 for dev:/dev/sdb8:2010-08-13 18:34:37.429: [   SKGFD][150477728]ERROR: -9(Error 27072, OS Error (Linux Error: 5: Input/output errorAdditional information: 4Additional information: 720913Additional information: -1))2010-08-13 18:34:37.429: [    CSSD][150477728](:CSSNM00060: )clssnmvReadBlocks: read failed at offset 17 of /dev/sdb82010-08-13 18:34:38.205: [    CSSD][4110736288](:CSSNM00058: )clssnmvDiskCheck: No I/O completions for 200880 ms for voting file /dev/sdb8)2010-08-13 18:34:38.206: [    CSSD][4110736288](:CSSNM00018: )clssnmvDiskCheck: Aborting, 0 of 1 configured voting disks available, need 12010-08-13 18:34:38.206: [    CSSD][4110736288]###################################2010-08-13 18:34:38.206: [    CSSD][4110736288]clssscExit: CSSD aborting from thread clssnmvDiskPingMonitorThread 2010-08-13 18:34:38.206: [    CSSD][4110736288]###################################2. ?oclsomon???????????oclsomon.log ?????,??????????ocssd????,??ocssd??????(RT)???,?????????????(?cpu)??,?????????????,OSW??(vmstat,top???),?????????3.?oprocd???????????oprocd?????????,?????????oprocd????? Dec 21 16:15:30.369857 | LASTGASP | AlarmHandler:  timeout(2312 msec) exceeds interval(1000 msec)+margin(500 msec).   Rebooting NOW.??oprocd?????????????????????,?????ntp(?????????),??diagwait=13 ????????,??,?????????????,??????CRS,???????????????,??????????????oprocd????,??,?????OSWatcher??(vmstat,top???),??????????????????????????????,????????????????? ???????,??????MOS ???Note 265769.1 :Troubleshooting 10g and 11.1 Clusterware RebootsNote 1050693.1 :Troubleshooting 11.2 Clusterware Node Evictions (Reboots)

    Read the article

  • How do I resolve "Unable to resolve attribute [organizationType.id] against path" exception?

    - by Dave
    I'm using Spring 3.1.1.RELEASE, Hibernate 4.1.0.Final, JUnit 4.8, and JPA 2.0 (hibernate-jpa-2.0-api). I'm trying to write a query and search based on fields of member fields. What I mean is I have this entity … @GenericGenerator(name = "uuid-strategy", strategy = "uuid.hex") @Entity @Table(name = "cb_organization", uniqueConstraints = {@UniqueConstraint(columnNames={"organization_id"})}) public class Organization implements Serializable { @Id @NotNull @GeneratedValue(generator = "uuid-strategy") @Column(name = "id") /* the database id of the Organization */ private String id; @ManyToOne @JoinColumn(name = "state_id", nullable = true, updatable = false) /* the State for the organization */ private State state; @ManyToOne @JoinColumn(name = "country_id", nullable = false, updatable = false) /* The country the Organization is in */ private Country country; @ManyToOne(optional = false) @JoinColumn(name = "organization_type_id", nullable = false, updatable = false) /* The type of the Organization */ private OrganizationType organizationType; Notice the members "organizationType," "state," and "country," which are all objects. I wish to build a query based on their id fields. This code @Override public List<Organization> findByOrgTypesCountryAndState(Set<String> organizationTypes, String countryId, String stateId) { CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<Organization> criteria = builder.createQuery(Organization.class); Root<Organization> org = criteria.from(Organization.class); criteria.select(org).where(builder.and(org.get("organizationType.id").in(organizationTypes), builder.equal(org.get("state.id"), stateId), builder.equal(org.get("country.id"), countryId))); return entityManager.createQuery(criteria).getResultList(); } is throwing the exception below. How do I heal the pain? java.lang.IllegalArgumentException: Unable to resolve attribute [organizationType.id] against path at org.hibernate.ejb.criteria.path.AbstractPathImpl.unknownAttribute(AbstractPathImpl.java:116) at org.hibernate.ejb.criteria.path.AbstractPathImpl.locateAttribute(AbstractPathImpl.java:221) at org.hibernate.ejb.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:192) at org.mainco.subco.organization.repo.OrganizationDaoImpl.findByOrgTypesCountryAndState(OrganizationDaoImpl.java:248) at org.mainco.subco.organization.repo.OrganizationDaoTest.testFindByOrgTypesCountryAndState(OrganizationDaoTest.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

    Read the article

  • How to parametrize WPF Style?

    - by Konstantin
    Hi! I'm looking for a simplest way to remove duplication in my WPF code. Code below is a simple traffic light with 3 lights - Red, Amber, Green. It is bound to a ViewModel that has one enum property State taking one of those 3 values. Code declaring 3 ellipses is very duplicative. Now I want to add animation so that each light fades in and out - styles will become even bigger and duplication will worsen. Is it possible to parametrize style with State and Color arguments so that I can have a single style in resources describing behavior of a light and then use it 3 times - for 'Red', 'Amber' and 'Green' lights? <UserControl.Resources> <l:TrafficLightViewModel x:Key="ViewModel" /> </UserControl.Resources> <StackPanel Orientation="Vertical" DataContext="{StaticResource ViewModel}"> <StackPanel.Resources> <Style x:Key="singleLightStyle" TargetType="{x:Type Ellipse}"> <Setter Property="StrokeThickness" Value="2" /> <Setter Property="Stroke" Value="Black" /> <Setter Property="Height" Value="{Binding Width, RelativeSource={RelativeSource Self}}" /> <Setter Property="Width" Value="60" /> <Setter Property="Fill" Value="LightGray" /> </Style> </StackPanel.Resources> <Ellipse> <Ellipse.Style> <Style TargetType="{x:Type Ellipse}" BasedOn="{StaticResource singleLightStyle}"> <Style.Triggers> <DataTrigger Binding="{Binding State}" Value="Red"> <Setter Property="Fill" Value="Red" /> </DataTrigger> </Style.Triggers> </Style> </Ellipse.Style> </Ellipse> <Ellipse> <Ellipse.Style> <Style TargetType="{x:Type Ellipse}" BasedOn="{StaticResource singleLightStyle}"> <Style.Triggers> <DataTrigger Binding="{Binding State}" Value="Amber"> <Setter Property="Fill" Value="Red" /> </DataTrigger> </Style.Triggers> </Style> </Ellipse.Style> </Ellipse> <Ellipse> <Ellipse.Style> <Style TargetType="{x:Type Ellipse}" BasedOn="{StaticResource singleLightStyle}"> <Style.Triggers> <DataTrigger Binding="{Binding State}" Value="Green"> <Setter Property="Fill" Value="Green" /> </DataTrigger> </Style.Triggers> </Style> </Ellipse.Style> </Ellipse> </StackPanel>

    Read the article

  • How to use pthread_atfork() and pthread_once() to reinitialize mutexes in child processes

    - by Blair Zajac
    We have a C++ shared library that uses ZeroC's Ice library for RPC and unless we shut down Ice's runtime, we've observed child processes hanging on random mutexes. The Ice runtime starts threads, has many internal mutexes and keeps open file descriptors to servers. Additionally, we have a few of mutexes of our own to protect our internal state. Our shared library is used by hundreds of internal applications so we don't have control over when the process calls fork(), so we need a way to safely shutdown Ice and lock our mutexes while the process forks. Reading the POSIX standard on pthread_atfork() on handling mutexes and internal state: Alternatively, some libraries might have been able to supply just a child routine that reinitializes the mutexes in the library and all associated states to some known value (for example, what it was when the image was originally executed). This approach is not possible, though, because implementations are allowed to fail *_init() and *_destroy() calls for mutexes and locks if the mutex or lock is still locked. In this case, the child routine is not able to reinitialize the mutexes and locks. On Linux, the this test C program returns EPERM from pthread_mutex_unlock() in the child pthread_atfork() handler. Linux requires adding _NP to the PTHREAD_MUTEX_ERRORCHECK macro for it to compile. This program is linked from this good thread. Given that it's technically not safe or legal to unlock or destroy a mutex in the child, I'm thinking it's better to have pointers to mutexes and then have the child make new pthread_mutex_t on the heap and leave the parent's mutexes alone, thereby having a small memory leak. The only issue is how to reinitialize the state of the library and I'm thinking of reseting a pthread_once_t. Maybe because POSIX has an initializer for pthread_once_t that it can be reset to its initial state. #include <pthread.h> #include <stdlib.h> #include <string.h> static pthread_once_t once_control = PTHREAD_ONCE_INIT; static pthread_mutex_t *mutex_ptr = 0; static void setup_new_mutex() { mutex_ptr = malloc(sizeof(*mutex_ptr)); pthread_mutex_init(mutex_ptr, 0); } static void prepare() { pthread_mutex_lock(mutex_ptr); } static void parent() { pthread_mutex_unlock(mutex_ptr); } static void child() { // Reset the once control. pthread_once_t once = PTHREAD_ONCE_INIT; memcpy(&once_control, &once, sizeof(once_control)); setup_new_mutex(); } static void init() { setup_new_mutex(); pthread_atfork(&prepare, &parent, &child); } int my_library_call(int arg) { pthread_once(&once_control, &init); pthread_mutex_lock(mutex_ptr); // Do something here that requires the lock. int result = 2*arg; pthread_mutex_unlock(mutex_ptr); return result; } In the above sample in the child() I only reset the pthread_once_t by making a copy of a fresh pthread_once_t initialized with PTHREAD_ONCE_INIT. A new pthread_mutex_t is only created when the library function is invoked in the child process. This is hacky but maybe the best way of dealing with this skirting the standards. If the pthread_once_t contains a mutex then the system must have a way of initializing it from its PTHREAD_ONCE_INIT state. If it contains a pointer to a mutex allocated on the heap than it'll be forced to allocate a new one and set the address in the pthread_once_t. I'm hoping it doesn't use the address of the pthread_once_t for anything special which would defeat this. Searching comp.programming.threads group for pthread_atfork() shows a lot of good discussion and how little the POSIX standards really provides to solve this problem. There's also the issue that one should only call async-signal-safe functions from pthread_atfork() handlers, and it appears the most important one is the child handler, where only a memcpy() is done. Does this work? Is there a better way of dealing with the requirements of our shared library?

    Read the article

  • Asp.net mvc, view with multiple updatable parts - how?

    - by DerDres
    I have started doing asp.net mvc programming and like it more everyday. Most of the examples I have seen use separate views for viewing and editing details of a specific entity. E.g. - table of music albums linking to separate 'detail' and 'update' views [Action] | Title | Artist detail, update | Uuuh Baby | Barry White detail, update | Mr Mojo | Barry White With mvc how can I achieve a design where the R and the U (CRUD) are represented in a single view, and furthermore where the user can edit separate parts of the view, thus limiting the amount of data the user can edit before saving? Example mockup - editing album detials: I have achieved such a design with ajax calls, but Im curious how to do this without ajax. Parts of my own take on this can be seen below. I use a flag (enum EditCode) indicating which part of the view, if any, that has to render a form. Is such a design in accordance with the framework, could it be done more elegantly? AlbumController public class AlbumController : Controller { public ActionResult Index() { var albumDetails = from ManageVM in state.AlbumState.ToList() select ManageVM.Value.Detail; return View(albumDetails); } public ActionResult Manage(int albumId, EditCode editCode) { (state.AlbumState[albumId] as ManageVM).EditCode = (EditCode)editCode; ViewData["albumId"] = albumId; return View(state.AlbumState[albumId]); } [HttpGet] public ActionResult Edit(int albumId, EditCode editCode) { return RedirectToAction("Manage", new { albumId = albumId, editCode = editCode }); } // edit album details [HttpPost] public ActionResult EditDetail(int albumId, Detail details) { (state.AlbumState[albumId] as ManageVM).Detail = details; return RedirectToAction("Manage", new { albumId = albumId, editCode = EditCode.NoEdit });// zero being standard } // edit album thought [HttpPost] public ActionResult EditThoughts(int albumId, List<Thought> thoughts) { (state.AlbumState[albumId] as ManageVM).Thoughts = thoughts; return RedirectToAction("Manage", new { albumId = albumId, editCode = EditCode.NoEdit });// zero being standard } Flag - EditCode public enum EditCode { NoEdit, Details, Genres, Thoughts } Mangae view <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcApplication1.Controllers.ManageVM>" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> Manage </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h2>Manage</h2> <% if(Model.EditCode == MvcApplication1.Controllers.EditCode.Details) {%> <% Html.RenderPartial("_EditDetails", Model.Detail); %> <% }else{%> <% Html.RenderPartial("_ShowDetails", Model.Detail); %> <% } %> <hr /> <% if(Model.EditCode == MvcApplication1.Controllers.EditCode.Thoughts) {%> <% Html.RenderPartial("_EditThoughts", Model.Thoughts); %> <% }else{%> <% Html.RenderPartial("_ShowThoughts", Model.Thoughts); %> <% } %>

    Read the article

  • Cannot update any cells in datagrid in vb6

    - by Hybrid SyntaX
    Hello I'm trying to update a row in datagrid but the problem is that i can't even change its cell values I had set my datagrid AllowUpdate property to true , but i can't still change any cell values Option Explicit Dim conn As New ADODB.Connection Dim cmd As New ADODB.Command Dim recordset As New ADODB.recordset Public Action As String Public Person_Id As Integer Public Selected_Person_Id As Integer Public Phone_Type As String Public Sub InitializeConnection() Dim str As String str = _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" + App.Path + "\phonebook.mdb;" & _ "Persist Security Info=False" conn.CursorLocation = adUseClient If conn.state = 0 Then conn.ConnectionString = str conn.Open (conn.ConnectionString) End If End Sub Public Sub AbandonConnection() If conn.state <> 0 Then conn.Close End If End Sub Public Sub Persons_Read() Dim qry_all As String ' qry_all = "select * from person,web,phone Where web.personid = person.id And phone.personid = person.id" qry_all = "SELECT * FROM person order by id" Call InitializeConnection cmd.CommandText = qry_all cmd.CommandType = adCmdText Set cmd.ActiveConnection = conn If conn.state = 1 Then Set recordset = cmd.Execute() End If BindDatagrid End Sub Private Function Person_Delete(id As Integer) Dim qry_all As String qry_all = "Delete * from person where person.id= " & id & " " Call InitializeConnection cmd.CommandText = qry_all cmd.CommandType = adCmdText Set cmd.ActiveConnection = conn If conn.state = 1 Then Set recordset = cmd.Execute() End If dg_Persons.Refresh End Function Private Function Person_Update() End Function Public Sub BindDatagrid() Set Me.dg_Persons.DataSource = recordset Me.dg_Persons.Refresh dg_Persons.Columns(0).Visible = False dg_Persons.Columns(4).Visible = False dg_Persons.Columns(1).Caption = "Name" dg_Persons.Columns(2).Caption = "Family" dg_Persons.Columns(3).Caption = "Nickname" dg_Persons.Columns(5).Caption = "Title" dg_Persons.Columns(6).Caption = "Job" End Sub Public Function DatagridReferesh() Call Me.Persons_Read End Function Private Sub cmd_Add_Click() frm_Person_Add.Caption = "Add a new person" frm_Person_Add.Show End Sub Private Sub cmd_Business_Click() ' frm_Phone.Caption = "Business Phones" frm_Phone.Phone_Type = "Business" frm_Phone.Person_Id = Selected_Person_Id frm_Phone.Tag = Selected_Person_Id frm_Phone.Show End Sub Private Sub cmd_Delete_Click() Dim msg_input As Integer msg_input = MsgBox("Are you sure you want to delete this person ?", vbYesNo) If msg_input = vbYes Then Person_Delete Selected_Person_Id MsgBox ("The person is deleted") frm_Phone.DatagridReferesh End If End Sub Private Sub cmd_Home_Click() 'frm_Phone.Caption = "Home Phones" frm_Phone.Phone_Type = "Home" frm_Phone.Person_Id = Selected_Person_Id frm_Phone.Tag = Selected_Person_Id frm_Phone.Show End Sub Private Sub cmd_Update_Click() If Not Selected_Person_Id = 0 Then frm_Person_Edit.Person_Id = Selected_Person_Id frm_Person_Edit.Show Else MsgBox "No person is selected" End If End Sub Public Function AddParam(name As String, param As Variant, paramType As DataTypeEnum) As ADODB.Parameter If param = "" Or param = Null Then param = " " End If Dim objParam As New ADODB.Parameter Set objParam = cmd.CreateParameter(name, paramType, adParamInput, Len(param), param) objParam.Value = Trim(param) Set AddParam = objParam End Function Private Sub Command1_Click() DatagridReferesh End Sub Private Sub Command2_Click() frm_Internet.Person_Id = Selected_Person_Id frm_Internet.Show End Sub Private Sub dg_Persons_BeforeColEdit(ByVal ColIndex As Integer, ByVal KeyAscii As Integer, Cancel As Integer) ' MsgBox ColIndex ' dg_Persons.Columns(ColIndex).Text = "S" ' dg_Persons.Columns(ColIndex).Locked = False ' dg_Persons.Columns(ColIndex).Text = "" 'dg_Persons.Columns(ColIndex).Value = "" 'Person_Edit dg_Persons.Columns(0).Value, dg_Persons.Columns(1).Value, dg_Persons.Columns(2).Value,dg_Persons.Columns(3).Value,dg_Persons.Columns(4).Value, dg_Persons.Columns(5).Value End Sub Private Sub dg_Persons_BeforeColUpdate(ByVal ColIndex As Integer, OldValue As Variant, Cancel As Integer) MsgBox ColIndex End Sub Private Sub dg_Persons_Click() If dg_Persons.Row <> -1 Then dg_Persons.SelBookmarks.Add Me.dg_Persons.RowBookmark(dg_Persons.Row) Selected_Person_Id = Val(dg_Persons.Columns(0).Value) End If End Sub Private Sub Form_Load() ' dg_Persons.AllowUpdate = True ' dg_Persons.EditActive = True Call Persons_Read dg_Persons.AllowAddNew = True dg_Persons.Columns(2).Locked = False End Sub Private Function Person_Edit(id As Integer, name As String, family As String, nickname As String, title As String, job As String) InitializeConnection cmd.CommandText = "Update person set name=@name , family=@family , nickname=@nickname , title =@title , job=@job where id= " & id & "" cmd.Parameters.Append AddParam("name", name, adVarChar) cmd.Parameters.Append AddParam("family", family, adVarChar) cmd.Parameters.Append AddParam("nickname", nickname, adVarChar) cmd.Parameters.Append AddParam("title", title, adVarChar) cmd.Parameters.Append AddParam("job", job, adVarChar) cmd.ActiveConnection = conn cmd.CommandType = adCmdText cmd.Execute End Function Private Function Person_Search(q As String) Dim qry_all As String qry_all = "SELECT * FROM person where person.name like '%" & q & "%' or person.family like '%" & q & "%' or person.nickname like '%" & q & "%'" Call InitializeConnection cmd.CommandText = qry_all cmd.CommandType = adCmdText Set cmd.ActiveConnection = conn If conn.state = 1 Then Set recordset = cmd.Execute() End If BindDatagrid End Function Private Sub mnu_About_Click() frm_About.Show End Sub Private Sub submnu_exit_Click() End End Sub Private Sub txt_Search_Change() Person_Search txt_Search.Text End Sub Thanks in advance

    Read the article

  • Dynamic obfuscation by self-modifying code

    - by Fallout2
    Hi all, Here what's i am trying to do: assume you have two fonction void f1(int *v) { *v = 55; } void f2(int *v) { *v = 44; } char *template; template = allocExecutablePages(...); char *allocExecutablePages (int pages) { template = (char *) valloc (getpagesize () * pages); if (mprotect (template, getpagesize (), PROT_READ|PROT_EXEC|PROT_WRITE) == -1) { perror (“mprotect”); } } I would like to do a comparison between f1 and f2 (so tell what is identical and what is not) (so get the assembly lines of those function and make a line by line comparison) And then put those line in my template. Is there a way in C to do that? THanks Update Thank's for all you answers guys but maybe i haven't explained my need correctly. basically I'm trying to write a little obfuscation method. The idea consists in letting two or more functions share the same location in memory. A region of memory (which we will call a template) is set up containing some of the machine code bytes from the functions, more specifically, the ones they all have in common. Before a particular function is executed, an edit script is used to patch the template with the necessary machine code bytes to create a complete version of that function. When another function assigned to the same template is about to be executed, the process repeats, this time with a different edit script. To illustrate this, suppose you want to obfuscate a program that contains two functions f1 and f2. The first one (f1) has the following machine code bytes Address Machine code 0 10 1 5 2 6 3 20 and the second one (f2) has Address Machine code 0 10 1 9 2 3 3 20 At obfuscation time, one will replace f1 and f2 by the template Address Machine code 0 10 1 ? 2 ? 3 20 and by the two edit scripts e1 = {1 becomes 5, 2 becomes 6} and e2 = {1 becomes 9, 2 becomes 3}. #include <stdlib.h> #include <string.h> typedef unsigned int uint32; typedef char * addr_t; typedef struct { uint32 offset; char value; } EDIT; EDIT script1[200], script2[200]; char *template; int template_len, script_len = 0; typedef void(*FUN)(int *); int val, state = 0; void f1_stub () { if (state != 1) { patch (script1, script_len, template); state = 1; } ((FUN)template)(&val); } void f2_stub () { if (state != 2) { patch (script2, script_len, template); state = 2; } ((FUN)template)(&val); } int new_main (int argc, char **argv) { f1_stub (); f2_stub (); return 0; } void f1 (int *v) { *v = 99; } void f2 (int *v) { *v = 42; } int main (int argc, char **argv) { int f1SIZE, f2SIZE; /* makeCodeWritable (...); */ /* template = allocExecutablePages(...); */ /* Computed at obfuscation time */ diff ((addr_t)f1, f1SIZE, (addr_t)f2, f2SIZE, script1, script2, &script_len, template, &template_len); /* We hide the proper code */ memset (f1, 0, f1SIZE); memset (f2, 0, f2SIZE); return new_main (argc, argv); } So i need now to write the diff function. that will take the addresses of my two function and that will generate a template with the associated script. So that is why i would like to compare bytes by bytes my two function Sorry for my first post who was not very understandable! Thank you

    Read the article

< Previous Page | 82 83 84 85 86 87 88 89 90 91 92 93  | Next Page >