tag:blogger.com,1999:blog-283183852024-03-14T03:42:15.720+00:00Sarkie's SiteA blog for random bits of information I think the community might find useful, no matter the topic or language!Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.comBlogger58125tag:blogger.com,1999:blog-28318385.post-58445385971737174872022-03-15T16:55:00.004+00:002022-03-15T16:55:41.077+00:00JMC - java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).<p> If you get the following error</p><p><br /></p><p>add the following to jmc.ini</p><p><br /></p><p>--launcher.appendVmargs<br />-vm <br />C:\Program Files\Java\jdk-17.0.2\bin<br />-vmargs<br />-XX:+IgnoreUnrecognizedVMOptions</p><p><br /></p><p><br /></p><p> </p><p> </p><p> </p><p> </p><p>!SESSION 2022-03-15 16:51:22.904 -----------------------------------------------<br />eclipse.buildId=unknown<br />java.version=1.8.0_321<br />java.vendor=Oracle Corporation<br />BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_GB<br />Command-line arguments: -os win32 -ws win32 -arch x86_64<br /><br />!ENTRY org.apache.felix.scr 4 0 2022-03-15 16:51:23.731<br />!MESSAGE FrameworkEvent ERROR<br />!STACK 0<br />org.osgi.framework.BundleException: Could not resolve module: org.apache.felix.scr [5]<br /> Unresolved requirement: Import-Package: org.apache.felix.service.command; version="[1.0.0,2.0.0)"; resolution:="optional"<br /> Unresolved requirement: Import-Package: org.osgi.service.cm; version="[1.6.0,2.0.0)"; resolution:="optional"<br /> Unresolved requirement: Import-Package: org.osgi.service.component; version="[1.4.0,1.5.0)"<br /><br /> at org.eclipse.osgi.container.Module.start(Module.java:463)<br /> at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.lambda$1(ModuleContainer.java:1834)<br /> at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1829)<br /> at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1777)<br /> at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1739)<br /> at org.eclipse.osgi.container.SystemModule.startWorker(SystemModule.java:269)<br /> at org.eclipse.osgi.container.Module.doStart(Module.java:605)<br /> at org.eclipse.osgi.container.Module.start(Module.java:468)<br /> at org.eclipse.osgi.container.SystemModule.start(SystemModule.java:193)<br /> at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:439)<br /> at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:458)<br /> at org.eclipse.osgi.launch.Equinox.start(Equinox.java:139)<br /> at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:338)<br /> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:251)<br /> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br /> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<br /> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<br /> at java.lang.reflect.Method.invoke(Unknown Source)<br /> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)<br /> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)<br /> at org.eclipse.equinox.launcher.Main.run(Main.java:1467)<br /><br />!ENTRY org.eclipse.equinox.simpleconfigurator 4 0 2022-03-15 16:51:23.733<br />!MESSAGE FrameworkEvent ERROR<br />!STACK 0<br />org.osgi.framework.BundleException: Could not resolve module: org.eclipse.equinox.simpleconfigurator [6]<br /> Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=11))"<br /><br /> at org.eclipse.osgi.container.Module.start(Module.java:463)<br /> at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.lambda$1(ModuleContainer.java:1834)<br /> at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1829)<br /> at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1777)<br /> at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1739)<br /> at org.eclipse.osgi.container.SystemModule.startWorker(SystemModule.java:269)<br /> at org.eclipse.osgi.container.Module.doStart(Module.java:605)<br /> at org.eclipse.osgi.container.Module.start(Module.java:468)<br /> at org.eclipse.osgi.container.SystemModule.start(SystemModule.java:193)<br /> at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:439)<br /> at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:458)<br /> at org.eclipse.osgi.launch.Equinox.start(Equinox.java:139)<br /> at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:338)<br /> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:251)<br /> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br /> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<br /> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<br /> at java.lang.reflect.Method.invoke(Unknown Source)<br /> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)<br /> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)<br /> at org.eclipse.equinox.launcher.Main.run(Main.java:1467)<br /><br />!ENTRY org.eclipse.osgi 4 0 2022-03-15 16:51:23.735<br />!MESSAGE Bundle initial@reference:file:plugins/org.apache.felix.scr_2.1.24.v20200924-1939.jar was not resolved.<br /><br />!ENTRY org.eclipse.osgi 4 0 2022-03-15 16:51:23.736<br />!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.equinox.simpleconfigurator_1.4.0.v20210315-2228.jar was not resolved.<br /><br />!ENTRY org.eclipse.equinox.simpleconfigurator 2 0 2022-03-15 16:51:23.740<br />!MESSAGE Could not resolve module: org.eclipse.equinox.simpleconfigurator [6]<br /> Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=11))"<br /><br /><br />!ENTRY org.apache.felix.scr 2 0 2022-03-15 16:51:23.740<br />!MESSAGE Could not resolve module: org.apache.felix.scr [5]<br /> Unresolved requirement: Import-Package: org.apache.felix.service.command; version="[1.0.0,2.0.0)"; resolution:="optional"<br /> Unresolved requirement: Import-Package: org.osgi.service.cm; version="[1.6.0,2.0.0)"; resolution:="optional"<br /> Unresolved requirement: Import-Package: org.osgi.service.component; version="[1.4.0,1.5.0)"<br /><br /><br />!ENTRY org.eclipse.osgi 4 0 2022-03-15 16:51:23.752<br />!MESSAGE Application error<br />!STACK 1<br />java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).<br /> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:81)<br /> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)<br /> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)<br /> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br /> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<br /> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<br /> at java.lang.reflect.Method.invoke(Unknown Source)<br /> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)<br /> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)<br /> at org.eclipse.equinox.launcher.Main.run(Main.java:1467)<br /><br /></p>Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-85381464477136780362021-02-04T10:51:00.004+00:002021-02-04T10:52:06.285+00:00ED444FF07D8D0BF6 KaliIf you are getting this issue.
<blockquote>sudo apt install kali-archive-keyring</blockquote>
<blockquote>sudo apt-get update</blockquote>
Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-26834838223163075072018-12-20T12:50:00.000+00:002018-12-20T12:51:02.762+00:00wls-cat an 503 errorYou have deployed the wls-cat.war but get a 503 error.
<br />
You need to start the application in the control tab.Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-92076744876104580602016-02-29T16:40:00.000+00:002016-02-29T16:40:09.457+00:00A Release batch file<p>
Needed a batch file to create a release from a nuget package (probably works with a zip), creates an ISO 8601 date folder and copies the data there and replaces the permissions.
It also needed a better way to get the local date as normal DOS date took region into account and caused errors.
</p>
<pre class="pre">
set releasename=ClientName
FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a
set todaysdate=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2%
echo %todaysdate%
FOR /F "delims=" %%i IN ('dir /b %releasename%*') DO set file=%%i
FOR %%i IN ("%file%") DO (
set filedrive=%%~di
set filepath=%%~pi
set filename=%%~ni
set fileextension=%%~xi
)
echo %filename%
SET releasedir=..\Releases\%todaysdate%\
mkdir %releasedir%
echo %releasedir%
ren %filename%.nupkg %filename%.zip
move %filename%.zip %releasedir%
set releasedirwithfilename=%releasedir%%filename%
unzip %releasedirwithfilename%.zip -d %releasedirwithfilename%
xcopy /E /Y BaseFiles\* %releasedirwithfilename%
icacls "%releasedirwithfilename%\*" /q /c /t /reset
</pre>
Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-20622631131939588042015-03-04T12:39:00.001+00:002015-03-04T12:39:19.708+00:00Official Gmail Blog: The new Google Contacts: Bringing everyone together<a href="http://gmailblog.blogspot.co.uk/2015/03/the-new-google-contacts-bringing.html">Official Gmail Blog: The new Google Contacts: Bringing everyone together</a><br /><br />
<br /><br />
The more Google Apps getting Materialised the better!Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-4016626120145558042014-06-04T14:10:00.000+01:002014-06-04T14:10:31.604+01:00HTML5 Flappy Bird Tutorial<p>As part of my job as Technical Architect, I try to introduce our developers into parts of development which they won't really get involved in with their normal development activities, out of the topics suggested, an HTML5 Game was highest for the first week</p>
<p>I had signed up to <a href="http://lessmilk.com">lessmilk.com</a>'s mailing list which shows his games he made with the <strong><a href="http://phaser.io/">Phaser Framework</a></strong> and one of those was a <a href="http://en.wikipedia.org/wiki/Flappy_Bird">Flappy Bird</a> clone which he also wrote a tutorial for, I found this one perfect to pique the interest of the developers, so here are the links to all 3 tutorials.</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjc3sfz-J799zDYKui-rhDUho__PFfe1bWHVJ1Pyji6hKvnUYtFtvbgVE_4a2LdBExFt3Oh06XTPECLgYjze9-FhtblSDqeyq4n-MOH9v449a-PgvvPuItoHxjydS24doZqUmZ-/s1600/FB-1.png" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjc3sfz-J799zDYKui-rhDUho__PFfe1bWHVJ1Pyji6hKvnUYtFtvbgVE_4a2LdBExFt3Oh06XTPECLgYjze9-FhtblSDqeyq4n-MOH9v449a-PgvvPuItoHxjydS24doZqUmZ-/s320/FB-1.png" /></a>
<p>
Here are the tutorials
<ul>
<li>
<a href="http://blog.lessmilk.com/how-to-make-flappy-bird-in-html5-1/">http://blog.lessmilk.com/how-to-make-flappy-bird-in-html5-1/</a>
</li>
<li>
<a href="http://blog.lessmilk.com/how-to-make-flappy-bird-in-html5-2/">http://blog.lessmilk.com/how-to-make-flappy-bird-in-html5-2/</a>
</li>
<li>
<a href="http://blog.lessmilk.com/how-to-make-flappy-bird-in-html5-3/">http://blog.lessmilk.com/how-to-make-flappy-bird-in-html5-2/</a>
</li>
</ul>
</p>
<p>
I also use <strong><a href="https://code.google.com/p/mongoose">Mongoose Web Server</a></strong> as it is simple to run these tutorials as they need a web server to allow showing the resources.
</p>
<p>
This is the final one you get to play
<a href="http://www.lessmilk.com/flappy_bird/03/">Final Flappy Bird Clone</a>
</p>
<p>
And here is a picture of the set up of the night showing it off.
<a href="http://1.bp.blogspot.com/-FpChayRVVQk/U4ech9kWlOI/AAAAAAAA2Ng/z_s5islevuI/w1598-h898-no/IMG_20140529_214536290_HDR.jpg" imageanchor="1" ><img border="0" src="http://1.bp.blogspot.com/-FpChayRVVQk/U4ech9kWlOI/AAAAAAAA2Ng/z_s5islevuI/w1598-h898-no/IMG_20140529_214536290_HDR.jpg" /></a>
</p>Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-43318437707459688542014-05-27T10:25:00.001+01:002014-05-27T10:25:56.111+01:00Cracking a PDF from a Nigerian Bank.<p>
I have recently been getting lots of legitimate emails from companies using my email address for someone who isn't me, showing me companies aren't verifying emails before setting them up on their mailing lists such as:
</p>
<ul>
<li>Skype (really Microsoft...still?)</li>
<li>Zara</li>
<li>Telstra</li>
<li>100s of Loan companies.</li>
<li>NIGERIAN UNION BANK</li>
</ul>
<br />
<p>
The last one should make you smile at least, it did me. Obviously looking at is, it is spam... but nope looking at all the emails, it seems someone had actually signed up and used my email to sign up. THANKS.
</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKieGcBk_0eQ_6khFGj9qXC4DwCyWA6hyIeoc3rVIU93JQ4q6KnVStQzydmGu8zrILj8NGmt_GFeeHzdH88uyMBeEzZ6srgqlMvBxxJ6LkW8FIiNXqgZcCOQeXE5SmNSfykFZG/s1600/AccountNumber.PNG">
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKieGcBk_0eQ_6khFGj9qXC4DwCyWA6hyIeoc3rVIU93JQ4q6KnVStQzydmGu8zrILj8NGmt_GFeeHzdH88uyMBeEzZ6srgqlMvBxxJ6LkW8FIiNXqgZcCOQeXE5SmNSfykFZG/s1600/AccountNumber.PNG" />
</a>
<p>
I therefore emailed their customer services, to see about them removing my email and closing their account. They replied (I then checked the email headers from the customer support and the account email and they were the same, proving it was a legitimate email).
In one of the emails, there was a PDF which was password protected with the account number of the person's account who had signed up my email, so I didn't have it.
Being the inquisitive person I am, I thought I'd try and see if there was an online tool that could do it for me, but they all said they could remove the password...if you knew it. Which is fair enough.
I was not ok with this, I wanted to know the person to see if I could find them and email them telling them, my email isn't there's...
So I found pdfcrack
</p>
<ul>
<li><a href="http://pdfcrack.sourceforge.net/">http://pdfcrack.sourceforge.net/</a></li>
<li>Windows version - <a href="http://blog.rubypdf.com/pdfcrack/" >http://blog.rubypdf.com/pdfcrack/</a></li>
</ul>
<p>
I downloaded it and ran it against the pdf, using the default options.
<pre>
pdfcrack "account.pdf"
</pre>
The problem was that it wasn't correct number of characters, it was going through all combinations of characters from 0-n, since I actually knew how long the password was... they told us in the email, they replaced the numbers with *. Thanks Bank, counting it all, there are 10 characters for "001*****83".
Running pdfcrack, shows you the arguments it accepts.
<pre class="shell">
Usage: pdfcrack -f filename [OPTIONS]
OPTIONS:
-b, --bench perform benchmark and exit
-c, --charset=STRING Use the characters in STRING as charset
-w, --wordlist=FILE Use FILE as source of passwords to try
-n, --minpw=INTEGER Skip trying passwords shorter than this
-m, --maxpw=INTEGER Stop when reaching this passwordlength
-l, --loadState=FILE Continue from the state saved in FILENAME
-o, --owner Work with the ownerpassword
-u, --user Work with the userpassword (default)
-p, --password=STRING Give userpassword to speed up breaking
ownerpassword (implies -o)
-q, --quiet Run quietly
-s, --permutate Try permutating the passwords (currently only
supports switching first character to uppercase)
-v, --version Print version and exit
</pre>
<p>
So from this, I can set the charset of the account number (0-9) and min/max numbers of the password (10).
<pre>
pdfcrack -c 0123456789 -n 10 -m 10 "account.pdf"
</pre>
This then will start trying all the passwords but this still will take far too long for me, but going back to the email, I know the start and the end of the string. This means I can generate a dictionary of all possible combinations of the account number, which will make pdfcrack a little faster.
By googling "number list generator" I found this site.
</p>
<a href="http://textmechanic.com/Generate-List-of-Numbers.html">http://textmechanic.com/Generate-List-of-Numbers.html</a>
<p>
I set up my options like this to generate the numbers with padding, prefixing the start of the account number and suffixing the end of it with saving the file after its done.
</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz-0ux6WZFUd1zVf4SCQShQJRhcUm7NlJnwOBVni_wlqVzi6taUJTL_KWf-xT1vN9QSKm-eyLYG2rzc0haAnyKJb7RnealchMFGY53tk9ioy9bTacuacoJFn6ehEncHl9AYspV/s1600/Wordlist.PNG"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz-0ux6WZFUd1zVf4SCQShQJRhcUm7NlJnwOBVni_wlqVzi6taUJTL_KWf-xT1vN9QSKm-eyLYG2rzc0haAnyKJb7RnealchMFGY53tk9ioy9bTacuacoJFn6ehEncHl9AYspV/s1600/Wordlist.PNG" /></a>
<p>
I then saved the file as output.txt, I then updated pdfcrack to use this dictionary, called a wordlist in its options.
<pre class="shell">
pdfcrack -w output.txt "account.pdf"
</pre>
This took 3 seconds to find the password on my box, I think pdfcrack doesn't support multi-core threading, so that was pretty fast and here is the output.
<pre class="shell">
PDF version 1.4
Security Handler: Standard
V: 2
R: 3
P: -1852
Length: 128
Encrypted Metadata: True
FileID: e620bf3e3b2adfc0b842251b2e43778f
U: 69f457abbb40358fb69b6f75f2c258ac6162636465666768696a6b6c6d6e6f70
O: db0a102b17407083e77f5bbe9d11ff416d81f0f437ef8a6cda83964c51ae4e5d
found user-password: '0019999983'
</pre>
<p>
Here is a screenshot of the pdf opened with the information hidden, note the bottom phrase "Big, Strong, Reliable"... Alanis Morissette would be proud of that.
</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOVBIlB7YANwEQyUoCIJOZlwvkSn_tuHoOg_wx76s7cUqEi4It5CUjffYCVFLShooALWccMUiFTTq2sSS5DxcLugLRpgTx35DGFWyVM5WjV5osL0-FNsdCBG-7PCZCl83YWwBG/s1600/PDF.png" imageanchor="1" ><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOVBIlB7YANwEQyUoCIJOZlwvkSn_tuHoOg_wx76s7cUqEi4It5CUjffYCVFLShooALWccMUiFTTq2sSS5DxcLugLRpgTx35DGFWyVM5WjV5osL0-FNsdCBG-7PCZCl83YWwBG/s400/PDF.png" /></a>
<p style="font-weight: bold;">
Emmanuel Sarki,<br />
S.D.A. Church Kadamo Jengre Bassa L.G.C.
</p>
<p>
Since Mr Sarki is currently a footballer playing in Poland... <a href="http://en.wikipedia.org/wiki/Emmanuel_Sarki">http://en.wikipedia.org/wiki/Emmanuel_Sarki</a> I probably think it is fake and a Church being one of the random scammer who want money for but who knows.
</p>
<p>
I did this post to show companies, if you don't verify emails, send details with enough information that can be gleaned, it would be easy to steal off your customers.
After emailing them numerous times to tell them of their error, I resorted to adding money to my Skype account and calling their customer service and they assured me they'd stop, (they didn't), I rang again with the account number from the PDF, they were then able to stop the emails, not until I'd found out everything I'd need to.
</p>
<p>
Steps to stop this:
<ol>
<li>Ask your user for their email</li>
<li>Ask to validate it by entering it again</li>
<li>Email them a verification link</li>
<li>User clicks emails</li>
<li>Create account</li>
</ol>
</p>Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com1tag:blogger.com,1999:blog-28318385.post-18178087889535179332014-02-21T16:55:00.001+00:002014-02-21T17:04:33.610+00:00Sending Java Sealed Objects via Sockets<p>Since I couldn't find a single example, this is a few examples put together into one working example, thought it'd be useful if I put it on the web</p>
<p>Here's a link to the Gist and below is the code <a href="https://gist.github.com/Sarkie/9138396">https://gist.github.com/Sarkie/9138396</a></p>
<h3>Server.java</h3>
<pre class="brush: java">
import java.net.InetSocketAddress;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import javax.crypto.*;
import javax.crypto.spec.*;
import java.io.*;
import java.security.spec.*;
import java.security.*;
public class Server {
public static void main(String[] args) throws Exception {
System.out.println("Server Started");
// Create key
final char[] password = "secret_password".toCharArray();
final byte[] salt = "random_salt".getBytes();
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
KeySpec spec = new PBEKeySpec(password, salt, 1024, 128);
SecretKey tmp = factory.generateSecret(spec);
SecretKey secret = new SecretKeySpec(tmp.getEncoded(), "AES");
Cipher dcipher = Cipher.getInstance("AES");
dcipher.init(Cipher.DECRYPT_MODE, secret);
ServerSocketChannel ssChannel = ServerSocketChannel.open();
ssChannel.configureBlocking(true);
int port = 12345;
ssChannel.socket().bind(new InetSocketAddress(port));
while (true) {
System.out.println("Waiting for a connection...");
SocketChannel sChannel = ssChannel.accept();
System.out.println(sChannel.getRemoteAddress().toString() +" connected");
ObjectInputStream ois = new ObjectInputStream(sChannel.socket().getInputStream());
SealedObject s = (SealedObject)ois.readObject();
SecretObject decryptedSecretObject = (SecretObject) s.getObject(dcipher);
System.out.println("Server - Packet Data is: '" + decryptedSecretObject.getSecretMessage() + "'");
ois.close();
System.out.println("Connection ended");
}
}
}
</pre>
<h3>Client.java</h3>
<pre class="brush: java">
import java.net.InetSocketAddress;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import javax.crypto.*;
import javax.crypto.spec.*;
import java.io.*;
import java.security.spec.*;
import java.security.*;
public class Client {
public static void main(String[] args) throws Exception {
String server = "localhost";
if(args.length == 1){
server = args[0];
}
System.out.println("Receiver Started");
// Create key
final char[] password = "secret_password".toCharArray();
final byte[] salt = "random_salt".getBytes();
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
KeySpec spec = new PBEKeySpec(password, salt, 1024, 128);
SecretKey tmp = factory.generateSecret(spec);
SecretKey secret = new SecretKeySpec(tmp.getEncoded(), "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, secret);
SocketChannel sChannel = SocketChannel.open();
sChannel.configureBlocking(true);
if (!sChannel.connect(new InetSocketAddress(server, 12345))) {
System.out.println("Cannot connect to Server, make sure it is running");
}
ObjectOutputStream oos = new ObjectOutputStream(sChannel.socket().getOutputStream());
SecretObject secretObject = new SecretObjectImpl("007");
SealedObject so = new SealedObject(secretObject, cipher);
oos.writeObject(so);
System.out.println("Sent Sealed Object");
oos.close();
System.out.println("End Receiver");
}
}
</pre>
<h3>SecretObject.java</h3>
<pre class="brush: java">
import java.io.*;
public interface SecretObject extends Serializable {
String getSecretMessage();
}
</pre>
<h3>SecretObject.java</h3>
<pre class="brush: java">
import java.io.*;
public class SecretObjectImpl implements SecretObject {
private String _secretMessage = "";
public SecretObjectImpl(String secretMessage) {
_secretMessage = secretMessage;
}
public String getSecretMessage() {
return _secretMessage;
}
}
</pre>Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-3933445154357030482013-11-13T12:50:00.001+00:002013-11-13T12:51:49.461+00:00“Unable to locate tools.jar” when running antYou need to set your JAVA_HOME environment variable.<br />
<br />
Try this before the ant command<br />
<br />
<pre>set JAVA_HOME=JDK LOCATION HERE
</pre>
<br />
JDK Location is the root of the JDK installed, such as on mine.<br />
<br />
<pre>C:\Program Files\Java\jdk1.7.0_45
</pre>
<br />
<pre>set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_45
</pre>
<br />
then type <strong>SET</strong> to check if it worked, and now try your ant command.
I also changed my <strong>PATH</strong> to point to the JDK\bin folder before my JRE\bin folder, but I think Java check <strong>JAVA_HOME</strong> first.Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-83585813028634130382013-03-21T12:02:00.000+00:002013-03-21T12:02:07.104+00:00XYZ.sln(1, 1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.If you are getting this error
<br />
<br />
<pre>XYZ.sln(1, 1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.
</pre>
<br />
<br />
Look inside the file for invalid Project or EndProject. Usually it is missing an EndProject, because it works in Visual Studio but fails on our Build Server.Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com6tag:blogger.com,1999:blog-28318385.post-46499444337547879302012-12-13T12:16:00.003+00:002012-12-13T12:16:16.086+00:00could not load microsoft windows media player firefox plugin in Chrome<br />
I was having this issue.<br />
<br />
<br />
<ol>
<li>Check Windows Media Player is installed on your box. Control Panel - Windows Features - Media Features - Windows Media Player.</li>
<li>Install the Firefox Plugin from here <a href="http://www.interoperabilitybridges.com/windows-media-player-firefox-plugin-download">http://www.interoperabilitybridges.com/windows-media-player-firefox-plugin-download </a></li>
<li>Install the Windows Media Player HTML5 Extension for Chrome from here <a href="http://www.interoperabilitybridges.com/wmp-extension-for-chrome">http://www.interoperabilitybridges.com/wmp-extension-for-chrome</a></li>
</ol>
<br />
<br />
Try nowSarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-44719802506413912112012-12-12T11:56:00.000+00:002012-12-13T12:17:14.153+00:00Google Play services won't update and can't remote installI have been having issues for a few months with Google Play and my Nexus One running MIUI.
Whenever I went to <a href="http://play.google.com/">Google Play Store</a> I'd get the following error.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLhYSrgmUSn3xesVu2XbRJQt8hNWBZPv4cUJD3XCtWxXANTqQEWhVd9SI78PYVQC3nqYN2peUoaKvZ_3I_TCq56iG4NiZK5LxyEdfQgALlPG5AkvmDGyarHX8DjnuVZ9InzwSz/s1600/image.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="187" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLhYSrgmUSn3xesVu2XbRJQt8hNWBZPv4cUJD3XCtWxXANTqQEWhVd9SI78PYVQC3nqYN2peUoaKvZ_3I_TCq56iG4NiZK5LxyEdfQgALlPG5AkvmDGyarHX8DjnuVZ9InzwSz/s640/image.png" width="640" /></a></div>
But checking the phone showed that I have the latest version, (I even got the apk and installed manually), also I can't remote install any app that I used to. I wiped Google Play, uninstalled updates, also wiped Google Play Services data, still nothing. I had given it up as because I was on a custom rom, but I noticed the other day that my Google Talk app wasn't working, no matter what I did it wouldn't work.<br />
<br />
So decided to reinstall the gapps from. <a href="http://goo.im/gapps">Goo.im Downloads</a> This fixed my Google Talk issues and it fixed my Google Play issues, I assume Google sends down messages using Google Talk, which then uses IPC to call Google Play to start off the downloads, or not. Hope this helps someone else.Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-38767437886173738742012-12-10T11:28:00.001+00:002012-12-10T11:28:17.404+00:00Least amount of permissions for creating scheduled tasks in Windows 7I am currently looking at creating Scheduled tasks and I needed to find the permissions needed for creating Schedudled Tasks, usually I would use <a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx">ProcMon</a> and look for ACCESS_DENIED but it wasn't helping me.
Firstly I created a user with zero permissions and ran my tool that would create a Task, it threw an error saying it can't.
<blockquote>runas /user:NoPerms TaskScheduler.exe</blockquote>
I then gave permissions to "%SystemRoot%\Tasks" and it still wouldn't work, after some searching I figured out there is another Tasks folder in "%SystemRoot%\System32\Tasks"
That is all that is needed.
Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-10821938740090490592012-11-20T16:15:00.000+00:002012-11-20T16:27:52.545+00:00Disable OpenFeint in Android for Rooted Phones<p>
I really despise OpenFeint integration in any of my games, I noticed on Play store there was an app called CloseFeint which would disable it but the comments aren't great for it.
</p>
<p>
I therefore looked into it, it is adding a few entries to my hosts file.
</p>
<blockquote>
127.0.0.1 api.openfeint.com<br />
127.0.0.1 *.openfeint.com<br />
127.0.0.1 *.scoreloop.com<br />
</blockquote>
<p>
If you know anything about hosts file, you'll know wildcards aren't supported.
</p>
<p>
So my solution?
</p>
<p>
Get this amazing ad blocking hosts app.
</p>
<a href="https://play.google.com/store/apps/details?id=org.adaway">https://play.google.com/store/apps/details?id=org.adaway</a>
<p>
Then if you click Settings/Your Lists you can add your own, so in there add.
</p>
<blockquote>
openfeint.com<br />
api.openfeint.com<br />
gree.net<br />
api.gree.net<br />
scoreloop.com<br />
api.scoreloop.com<br />
</blockquote>
<p>
The gree.net stuff is there because gree.net have recently bought OpenFeint and scoreloop seems to be another one.</p>
<p>
Once you have added these, you'll have to re-apply the lists, its also good for blocking ad's in games and easy to disable if there are apps that **need** access to OpenFeint in order to work.
</p>Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-3896197121802910552012-11-12T11:02:00.001+00:002012-11-12T11:02:36.287+00:00failed to load sesison ubuntuI just came across this issue with upgrading packages in 12.04 before I made the upgrade to 12.10 (since I've been having issues with ATi graphics drivers).
On load I couldn't get into my session.
What I did was CTRL+ALT+F1 to get to console, logged in and then ran
sudo apt-get update && sudo apt-get upgrade
This seemed to installed XWindow stuff that was missing that I think was causing my issue.Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-39666554540101874062012-10-30T00:35:00.001+00:002012-10-30T00:35:03.654+00:00Windows Media Sharing stopped working.I tried everything I could think of to get it working.
The answer was to disable Internet Connection Sharing.Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-59397576923646302982012-09-20T11:11:00.001+01:002012-09-20T11:11:50.646+01:00hg mecurial abort: path is inside nested repo errorJust been having to use Mecurial to get the Orchard source code.
I first used TortoiseHg to get the source and then used the Update command to switch to 1.x "branch" but I'd always get this error.
abort: path 'src\Orchard.Web\Modules\Orchard.Alias\AdminMenu.cs' is inside nested repo 'src\\Orchard.Web\\Modules\\Orchard.Alias'
So after a few attempts, all I did was delete everything apart from the .hg folder and then tried to update, this managed to work.
Who knows if this is the "correct" way to fix it.
Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com1tag:blogger.com,1999:blog-28318385.post-9618297483593772592012-08-07T20:48:00.002+01:002012-08-07T20:48:53.325+01:00System WindowsFirewall: "query user incoming"Or just Windows Media Player Network Sharing failing over mixed network on Windows 7, by default if you are on the same subnet it'll work.
I had Xbox on 192.168.0.250 and sharing it on to my Wireless network of 192.168.1.x range, so I was getting the above error.
I had to go to Windows Firewall in Control Panel, click Advanced Settings, Inbound Rules.
"Windows Media Player Network Sharing Service (HTTP-Streaming-In)"
This is running on Port 10243
and enable the one for "Public" profile.
Then you should be good to go.Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-40561504339118274292012-08-06T10:04:00.001+01:002012-08-06T10:04:12.455+01:00Instant Upload continually syncingI was having an issue with Google+'s feature of Instant Uploading all my pictures, it would never complete so I had to disable it.
To fix this, disable Instant Upload in Accounts & Sync settings, go into Programs and find Google+, clear the data of it and then re-enable it. This should fix it.Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-42207585655092948982012-07-26T10:18:00.004+01:002012-07-26T10:18:52.871+01:00Redgate ANTS Performance Profiler - Could not start IIS.I have had this issue a few times and I always forget how to fix it.
<br />
<br />
<blockquote>
Could not start IIS.
RedGate.Profiler.Engine.Exceptions.CannotStartSessionException
at . .Launch()
at ? . . ? ()
Caused by:
Could not start IIS.
RedGate.Profiler.Engine.Exceptions.CannotStartIisSessionException
at . . ()
at . .Launch()
Caused by:
Could not start w3wp as the specified user. Win32 error code: 1385
RedGate.Profiler.Engine.Exceptions.CannotStartIisSessionException
stack trace:
at ? . ? .?? ()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at . .?? ()
at . .?? ( )
at . . ()
Caused by:
Could not start w3wp as the specified user. Win32 error code: 1385
RedGate.Profiler.Engine.Startup.IIS.IISException
stack trace:
at . .StartProfilingIIS(String , String )
at RedGate.Profiler.Engine.Startup.IIS.IISStarter`1.StartProfilingIIS(String currentUserName, String subprocessVariableValue)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at RedGate.Profiler.Engine.Startup.IIISActuator`1.StartProfilingIIS(String currentUserName, String subprocessVariableValue)
at ? . ? .?? ()
</blockquote>
So I need to run my IIS as a network user in order for it to work through SQL Auth etc, the reason it is failing, is because the user isn't an admin user on my box.
So go to Administrator Tools -> Groups -> Administrators and add your network user here, check names and it should work!Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-54331444067754075782012-07-16T15:30:00.000+01:002012-07-16T15:30:15.511+01:00Solr 3.5 spatial (geofilt) search with distance in resultsTook a bit of tinkering around but here's my query.<br />
<br />
LatLong is my field in my document with a "latitude,longitude" in it.<br />
<br />
d=30. Distance is KMs.<br />
<br />
<br />
http://solrserver/select?<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>indent=true&<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>fl=Name,LatLong,score&<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>fq={!geofilt pt=50000,-0.11111 sfield=LatLong d=30}&<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>sfield=LatLong&<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>pt=
50000,-0.11111&<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>sort=score asc&<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>q={!func}geodist()<br />
<br />
This gets you all documents near a point (pt) and returns them with the distance stored in the score field.<br />
<br />
<br />Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-17608434029954693562012-07-13T15:26:00.000+01:002012-07-13T15:26:18.601+01:00Android not picking up MP3'sMy Android Phone (Nexus one running MIUI) sometimes doesn't find my MP3's, especially after a ROM update.<br />
<br />
I loaded up the MP3 using
<a href="http://www.mp3tag.de/en/">http://www.mp3tag.de/en/</a> and I either update it or just save it, it then seems to fix the ID3 tags and then it is picked up on my phone.<br />
<br />
You may also need to run an app like
https://play.google.com/store/apps/details?id=com.addz.mediascanner <br />
<br />Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-1509078057859911872012-02-21T11:46:00.001+00:002012-02-21T11:46:03.539+00:00requested operation cant be performed on file with user-mapped section openI have been getting this error constantly, I had to kill Visual Studio and restart and sometimes it'd go away.<br />
<br />
Managed to track it down to FxCop trying to scan the assemblies still.<br />
<br />
Killing the FxCop process, killed VS too. Time to uninstall for now me thinks.Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-55090911067344829902012-02-13T10:31:00.000+00:002012-02-13T10:31:00.555+00:00Internet Explorer 8 crashing Background ImageWe have just been having an issue that was causing Internet Explorer 8 on Windows XP and Windows Vista when it had a background image.<br />
<br />
It seems to be related to jQuery 1.7.0 and probably this ticket.<br />
<a href="http://bugs.jquery.com/ticket/10629">http://bugs.jquery.com/ticket/10629</a>
<br />
<br />
Updating to 1.7.1 made the issue go away.<br />
<br />Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com0tag:blogger.com,1999:blog-28318385.post-31703361693322794132011-12-14T20:46:00.000+00:002014-02-21T17:15:31.683+00:00Generic USB Driver Windows 7If you are having issues with finding a driver for a USB Drive, here's a trick.<br />
<br />
<span style="font-family: inherit;">Go to C:\<span style="background-color: rgba(255, 255, 255, 0.496094); line-height: 15px;">Windows\System32\DriverStore\FileRepository\usbstor.inf_</span></span><br />
<span style="font-family: inherit;"><span style="background-color: rgba(255, 255, 255, 0.496094); line-height: 15px;"><br /></span></span>
<span style="font-family: inherit;"><span style="background-color: rgba(255, 255, 255, 0.496094); line-height: 15px;">and get the latest directory, copy the contents to </span></span><br />
<span style="font-family: inherit;"><span style="background-color: rgba(255, 255, 255, 0.496094); line-height: 15px;"><br /></span></span>
<span style="font-family: inherit;"><span style="background-color: rgba(255, 255, 255, 0.496094); line-height: 15px;">C:\Windows\Inf</span></span><br />
<span style="font-family: inherit;"><span style="background-color: rgba(255, 255, 255, 0.496094); line-height: 15px;"><br /></span></span>
<span style="font-family: inherit;"><span style="background-color: rgba(255, 255, 255, 0.496094); line-height: 15px;">Reinsert your USB stick, it should detect it now and install it.</span></span><br />
<span style="font-family: inherit;"><span style="background-color: rgba(255, 255, 255, 0.496094); line-height: 15px;"><br /></span></span>
<span style="font-family: inherit;"><span style="background-color: rgba(255, 255, 255, 0.496094); line-height: 15px;"><br /></span></span>Sarkiehttp://www.blogger.com/profile/03144377073932911068noreply@blogger.com9