w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
I'm trying to use Java Prefences from XML WITHOUT using Windows registry, but I see a Registry-related message
I eventually discovered a workaround (not a solution) to this problem. As I stated before, I had inadvertently/foolishly deleted the Prefs node in SoftwareJavaSoft in the Registry, and when I recreated it the message went away. I now assume that the Windows registry is used whether you like it or not.

Categories : Java

DLL Import corrupting memory
Two problems. First, the calling convention is wrong. Per the header file that defines the function (as well as the supporting file that defines NBioAPI as __stdcall on the Win32 platform), you should be using CallingConvention.StdCall. Second, in the header that defines the types used by the API, NBioAPI_HANDLE and NBioAPI_FIR_HANDLE are typedef'd to UINT, which is always 32 bits (four bytes) long. You're using IntPtr, which has a platform-dependent size (it will be 64 bits in a 64-bit process.) Change the function parameters to uint.

Categories : C#

Git push corrupting my export with ' ' characters
Put this two lines into your .gitconfig file in the root of your repo or into your home if you need to make this settings global : [core] eol = lf You can find more about this here : https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

Categories : Eclipse

killing tcpdump without corrupting the capture
OK, so the issue turns out to be a race condition: kill('SIGTERM',$pid); That tells tcpdump to exit gracefully, and one of the things it does in there is write out statistics about the capture (i.e. how many packets). I noticed that if I put a print statement right after that kill, sometimes it showed up before the statistics, sometimes after. So the solution is to wait until tcpdump is done before continuing on to the next command that processes the output from tcpdump: waitpid($pid,0); system('tshark -r dumpcapfile ...')

Categories : Perl

Corrupting a string of random characters using bash
> string="/6435045045/hpdqbhflyuhv_EOlXG" > n=8 > m=`expr ${#string} - $n` > string="`< /dev/urandom tr -dc A-Za-z0-9_ | head -c$n``echo $string | tail -c$m`" > echo $string oZeHdOD_45/hpdqbhflyuhv_EOlXG http://nixcraft.com/shell-scripting/17295-generate-random-chars-bash.html http://www.unixcl.com/2008/03/find-string-length-bash.html bash - subtract 2 variables

Categories : Bash

git clone corrupting files which contains asian (UTF8) characters
"Server-side" Git is not interested in the contents of your files -- it does not even know they exist as it operates on opaque blobs of data which clients send it. Moreover "client-side" Git does not touch your files either unless clean/smudge filters are in place and/or EOL-conversion is enabled (which has nothing to do with encodings anyway so does not apply). Hence I'm with @joahim-sauer on this matter — supposedly your problem is in interpretation. Note that Windows Notepad looks at BOMs to know files are UTF-8, and you won't convince it a file is UTF-8 unless the file contains BOM, and many files doesn't (and many people think they shouldn't, ever).

Categories : GIT

Allocation.copyTo(Bitmap) corrupting pixel values
The example works fine because the example does not modify alpha. If you are going to modify alpha and then use the Allocation as a normal bitmap you should return (r*a, g*a, b*a, a). However, if you were sending the Allocation to a GL surface which is not pre-multiplied, your code would work as-is.

Categories : Android

Data segment values corrupting the stack variables
int *ptr1 = malloc ( 2 ); You are allocating 2 bytes for an int, which is normally at least 4 bytes in modern machine. *(ptr1+2) = 0xabcd; Pointer arithmetic is only valid if they are pointing to elements of an array or one past it, otherwise it's undefined behavior, as it is here.

Categories : C

what is wrong with this binary file transfer (corrupting docx files)?
Here is what I tried to do with your docx: I opened them with word, the corrupted one was indeed corrupt I unzipped the files, they were fully identical I watched at the size of the docx, it was different for the docx. So I looked into the binary file: The beginning of the file is identical 504b 0304 1400 0600 0800 0000 2100 ddfc 9537 6601 0000 2005 0000 1300 0802 5b43 6f6e 7465 6e74 5f54 7970 6573 5d2e 786d 6c20 a204 0228 a000 0200 0000 0000 0000 But at then end: Uncorrupted file 6f72 642f 7374 796c 6573 2e78 6d6c 504b 0506 0000 0000 0b00 0b00 c102 0000 ed24 0000 0000 Corrupted file 6f72 642f 7374 796c 6573 2e78 6d6c 504b 0506 0000 0000 0b00 0b00 c102 0000 ed24 0000 0000 0a2d 2d2d 2d2d 2d2d 2d2d As you can see, they is a sequence: 0a2d 2d2d 2d2d 2d2d 2d2d. The rest of the

Categories : Http

Is there a way to reboot an iOS app?
Are you familiar with the Model-View-Controller design pattern? You should have your application data stored in a model object. When the user "gets to the end", you can reset the model and update your views to start over.

Categories : IOS

AppWidget ID changes on reboot
What happens if you try the following thing: Install app, place 2 widgets, reboot, place another widget and check its id? When you remove your widgets from home screen and uninstall the app some of the IDs get reset and that could be the cause of recurring ids. Also does this behavior affect your app performance and expected behavior? If not there is nothing to worry about. I have experienced the same thing when developing widgets, once i started the work my widgets had ids starting from 0,1.... now my widgets have ids of 100, but they always get unique ids in the session in which the app is installed. You shouldnt care if the ids repeat them selves if the user uninstalls the app and installs it again. Also keep in mind that after reboot you onEnabled() method from AppWidgetProvider

Categories : Android

Need a reboot after a deployment with Capistrano
I resolved the problem. Looking in the unicorn log (thanks Domon for the idea), I saw the error: error reloading config_file=/home/neurones/apps/neurones/current/config/unicorn.rb: Application has been already initialized. (RuntimeError) I changed unicorn_init.sh from: restart|reload) sig HUP && echo reloaded OK && exit 0 echo >&2 "Couldn't reload, starting '$CMD' instead" run "$CMD" ;; to restart|reload) sig USR2 && echo reloaded OK && exit 0 echo >&2 "Couldn't reload, starting '$CMD' instead" run "$CMD" ;;

Categories : Ruby On Rails

WIX Detect Pending Reboot
Since I'm using a managed installer bootstrapper application I ended up doing this in C# using: string regLoc = @"HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession Manager"; string[] regKey = (string[])Registry.GetValue(regLoc, "PendingFileRenameOperations", new string[]{"DefaultValue"}); Entries in that key are files waiting for a reboot so they can be changed. Although this isn't bulletproof, it gives a likely indicator that the install might fail because of a pending reboot.

Categories : Wix

@reboot cronjob not executing
Mark Roberts pointed out a few things I'd done wrong. Namely, the spaces here MAIL = root HOME = / Get rid of those spaces.. Next, having Cron configuration fixed to email every minute.. instead of what I had : */1 * * * * /home/user/tester.py Seems to me Lubuntu doesn't support the @Reboot Cron syntax.

Categories : Python

Start intent after Reboot
You have to add RECEIVE_BOOT_COMPLETED permission in your manifest file to get notified : <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

Categories : Android

Setting up watchdog_set_period to max value causes reboot
The link states this description on watchdog timers. A watchdog timer is a piece of hardware that can be used to automatically detect software anomalies and reset the processor if any occur. Generally speaking, a watchdog timer is based on a counter that counts down from some initial value to zero. The embedded software selects the counter's initial value and periodically restarts it. If the counter ever reaches zero before the software restarts it, the software is presumed to be malfunctioning and the processor's reset signal is asserted. The processor (and the embedded software it's running) will be restarted as if a human operator had cycled the power. You haven't posted the code so we can't judge what exactly is the problem. If you have written the code check if your code is causing

Categories : C

runit spawns the process twice after reboot
It is likely that the process is "daemonizing" / "backgrounding". Shut it down using sv d <service> Confirm stopped (ps) Start it with /var/service/<service>/run If the job stays running - that is good. If it "finishes" and control returns to the shell, that is bad - you need to reconfigure the process not to run in the background.

Categories : Misc

How does Zend_Cache_Backend_TwoLevels handle a server reboot
From the look of the code, the answer is "it depends". Data will be stored in both caches if the priority is high enough and the fast cache is not full or filling fast. Otherwise it will only be stored in the 'slow' cache. However I'm sure that the APC cache would be empty after a reboot. There wouldn't be any sensible way for PHP to detect this and warm that cache back up for you, and no real reason for it to. Your app should not rely on cache data being present, and should regenerate it if it is missing.

Categories : PHP

Reboot Java Application with Linux
If you do not want to restart it using "sh run.sh" and instead you want to restart it using a command, you could use a bash alias to run the command. here is the manual (http://www.ss64.com/bash/alias.html) here is a relevant askubuntu thread about making a permanent alias (http://askubuntu.com/questions/17536/how-do-i-create-a-permanent-bash-alias) An alias is essentially a shortcut for the terminal, for instance you had a dropbox folder located at ~/myfiles/1/2/dropbox and you did not want to type cd + path every time, you could make an alias: alias cddropbox="cd ~/myfiles/1/2/dropbox"

Categories : Java

TFS not accessible remotely after reboot of server
After the reboot the network connection had changed from being classed as Private to Public. And so the firewall was set to not let through Public connections to the TFS. I did the troubleshooting by disabling the firewall and seeing that the connection was let through...

Categories : Iis

Reboot device from Android application
Step #1: Have a <uses-permission android:name="android.permission.REBOOT"> element in the proper spot in your manifest. Step #2: Call reboot() on an instance of PowerManager. Then, either: Step #3a: Build your own custom build of Android, rolled into your own ROM mod. Then, sign your app with the same signing key that you used to sign the OS in the ROM mod. or: Step #3b: Have the user of a rooted device make your app be a system app. Without Step #3a or #3b, your app will not be eligible to hold the REBOOT permission and your reboot() call will fail.

Categories : Android

Save and reboot cycle where it left off
Couple of problem I notices with your code.. You are writing to the file Save_sesion.txt after 14641 iterations which is exactly 11^4. The for loops iterate from 0 to 10, i.e 11 iterations. When you write to the file, loop vairables, e, f, g and h all would have become greater than 10 and hence you would be indexing at the 11th position into arrays var4, var5, var6 and var7 which results in array index out of bounds.

Categories : C

android notification disappears after reboot
You need to create a background job (an android service) that would run after reboot and looks for saved notifications and show them. your application is killed after a reboot and therefore Android cannot communicate with it and show notifications

Categories : Android

Repeating Alarm Manager After reboot
You need to use a BroadcastReceiver and set it to respond to BOOT_COMPLETED messages. For example Register your BroadcastReceiver in the manifest <receiver android:name=".MyBootReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver> Handle the message within your code MyBootReceiver.java public class MyBootReceiver extends BroadcastReceiver { private static final String TAG = "MyBootReceiver"; public void onReceive(Context context, Intent intent) { Log.d(TAG, "onReceive"); Calendar cal = this.getMyCalendar(); this.scheduleAlarms(context, cal); } private Calendar getMyCalendar() { // get your calendar object } private

Categories : Android

nginx not starting after server reboot
I don't have much experience with Ubuntu - but have you tried running chkconfig? You can try: # sudo update-rc.d nginx defaults Or: # sudo apt-get install chkconfig # sudo chkconfig nginx on

Categories : Ubuntu

Reboot the remote system is not working?
I would suggest to switch to subprocess module and catch output from the command launched and then decide what to do next with launched process. Let's say using system() is not considered as good practice these days for many reasons, from elegance to security. Good example what can you really do with this module are in sections 17.1.4.3. Replacing os.system() and 17.1.4.5. Replacing os.popen(), os.popen2(), os.popen3(). Trust me, using that is worth investment of couple lines of more code :-)

Categories : Python

restTemplate ResourceAccessException on server reboot
No doubts java.io.EOFException appears on the server side. If you use keep-alive on your server side - switch it off like this: HttpHeaders headers = new HttpHeaders(); headers.set("Connection", "Close"); or this: System.setProperty("http.keepAlive", "false"); Another solution is changing the http client.In Spring for Android the default HTTP Client for a RestTemplate is determined by the version of Android on the device. API 9 or newer uses HttpURLConnection, older uses HTTPClient. To explicitly set the client to the old one, use yourRestTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory()); Please refer this:http://static.springsource.org/spring-android/docs/1.0.1.RELEASE/reference/htmlsingle/#d4e34 Spring RestTemplate is not an ideal REST client and unfortunatel

Categories : Android

Are Android geofences surviving a reboot?
Which data do you want to persist? Is it the geofence region in your device or the geofence region stored by Google Play Service Location API ? I believe the device need to register a region (defined by its latitude, longitude and radius) to Google Play Service (via LocationClient). You also need to provide expiration time, transition type you want to be notified, and the Intent from which you will be notified. This region will be stored (remotely) not in your App. When it pass its expiration time, Google Play Service will automatically remove it. You can also set it as NEVER_EXPIRE. If the region is not expired yet, Google Play Service will notify your App (via intent that you send when calling addGeofences). The source of the region (lat, long, radius) is up to your implementation.

Categories : Android

Using Cron to check and reboot a PHP script
You could move this whole locking logic into you php script. Since you already have everything you need (database credentials, config files with the table names...), just structure it like this: Connect database, load setup, etc... Check the last update time's difference with the current time In case it's fresh enough, exit In case it isn't fresh enough kick of the while() There are various daemon management software if you can install things on the server like monit, god, or you could simply use init with a respawn line.

Categories : PHP

start rails server automatically after reboot
Install Apache and Passenger They will take care of starting your App with the server in a safer and more systematic way and what is now more or less a standard. I had the same issue with Rails 4, Ruby 2.1 on CentOS 6. If you're not familiar with bash scripts and the rc, profiles system - it's much faster and easier to setup passenger. Also, there are other reasons why you would go for passenger, including security and performance ( www.phusionpassenger.com ) Here is a quick how-to of what it took me to introduce the gem. Install Apache (html daemon) and dependency packages (if you don't have them already): yum install httpd curl-devel httpd-devel Get Apache to start on boot: chkconfig httpd on Install Phusion Passenger and dependency packages: gem install passenger

Categories : Ruby On Rails

How do you automatically start a WAS server on machine reboot?
You can use the WASService command in order to setup WAS as a Windows service.

Categories : Windows

Android Reboot Simulation : Service not working
register your reciever in xml like this <receiver android:name="my.app.client.BootReceiver" > <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver>

Categories : Android

Home Launcher issue with Fragments after reboot
QUESTION 1: Since it seems that the layout was not being completely removed I decided to try removing all the listeners to all the child items in each fragment's onDestroy. I ended up finding the method removeAllViewsInLayout() and decided to try the following code: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { container.removeAllViewsInLayout(); return inflater.inflate(R.layout.welcome_select_cabinet, container, false); } This went into each fragment so that before the layout was inflated for that layout the ViewGroup's child items would be cleared. This solved the issue of the "clicking through" to the previous fragment's items. QUESTION 2: I have added the following immediately after setContentV

Categories : Android

Windows service performs differently after reboot
How can caught exception still crash the service (and in a way recovery actions are not performed)? The original exception may not crash the service, but if you have a second exception in your first exception handler, the service will crash. I'd check if Logger.Instance.Error() is throwing an exception by putting a try/catch around it. How can code perform differently after reboot? It goes thru exactly same sequence. While it might be the same sequence in your code, we don't know what residual state was left over on disk before the last crash. This might be the reason for the difference.

Categories : C#

Run "screen -S name ./script" command on @reboot using crontab
You want to add the following options to the 'screen' commands (e.g. before -S): -d -m From the manpage: -d -m Start screen in "detached" mode. This creates a new session but doesn't attach to it. This is useful for system startup scripts.

Categories : Linux

Execute a script on startup of SUSE reboot
chmod +x /etc/init.d/testing touch /etc/init.d/rc.d/rc3.d/S12testing Should not be 'touch', but a symbolic link (ln -s) to /etc/init.d/testing. Try cd /etc/init.d/rc.d/rc3.d ln -s ../../testing S12testing Hope this helps.

Categories : Linux

How to test system reboot time more than a year?
There are multiple ways to check latest boot time, for instance: % last reboot | head -n 1 reboot ~ Tue Aug 13 09:56 % sysctl kern.boottime kern.boottime: { sec = 1376377004, usec = 264281 } Tue Aug 13 09:56:44 2013

Categories : Linux

How do I reboot the remote system via python script?
If you want to reboot remote systems without password, you need to configure the SSH key for the remote systems. First, you need to create a SSH key on the system you run your python script.By using $ ssh-keygen -t rsa -P "" Then, you change the name of your SSH key file $ mv ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys Now, you can copy you SSH key to the remote systems.The path is ~/.ssh/ $ scp ~/.ssh/authorized_keys user@remote_ip:~/.ssh/ Job is done, Now you can login remote systems without password, so is your python script.

Categories : Python

(CoreOS) how to auto restart a docker container after a reboot?
CoreOS uses systemd to manage long running services: http://coreos.com/docs/using-coreos/#process-management-with-systemd

Categories : Docker

EC2 instance launched from AMI not reachable(ssh) after start/stop or reboot
Was able to fix this. This is due to a bug from REDHAT for 6.4 rhel instances. After launching the machine from an AMI, connect to the machine and switch to root user and make below changes to /etc/rc.d/rc.local file ... Remove the following three lines and save the file: cat <<EOL >> /etc/ssh/sshd_config UseDNS no PermitRootLogin without-password ../ One should also remove garbage entries from /etc/ssh/sshd_config file. The machine once rebooted after these changes works fine.

Categories : Linux



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.