www.nuneworld.net

September 19, 2014

Detect enter pressed ASP.Net on textbox

Filed under: info — Tags: , — admin @ 2:02 pm

In code behind add attributes to your text box like this:


txtSearch.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btnTest.ClientID + "').click();return false;}} else {return true}; ");

September 3, 2014

UNABLE TO FIND CONNECTION…FOR OBJECT WEB.CONFIG

Filed under: info — Tags: , — admin @ 12:40 pm

Unable to find connection ‘your_conection_string’ for object  ’Web.config’. The connection string could not be found in application settings, or the data provider associated with the connection string could not be loaded.

Here’s what you need to do to start trouble-shooting the problem.

  • Close the dataset window with the error.
  • Right click the dataset in the solution explorer
  • Select “Open with…” from the context menu
  • Select “Source Code (Text) Editor” from the list and press the “OK” button

Your code will now be opened in text mode so you can view the XML. Near the top of the file, you’ll see a <connections> element with several <connection> elements within it.  Most datasets should only have one <connection> element.

If you have two <connection> elements when you remove one of them then also   change element DataSource DefaultConnectionIndex=”1″ to DataSource DefaultConnectionIndex=”0″

also in your web config your connection string should have providerName=”System.Data.SqlClient”

August 21, 2014

Disable a button control during postback in ASP.Net

Filed under: Software — admin @ 3:09 pm

Button disable technique for full .NET postbacks.

<asp:Button runat="server" ID="BtnSubmit"
  OnClientClick="this.disabled = true; this.value = 'Submitting...';"
  UseSubmitBehavior="false"
  OnClick="BtnSubmit_Click"
  Text="Submit Me!" />

July 1, 2014

Write binary file Windows phone 7

Filed under: info — Tags: , , , , — admin @ 8:34 am

using (MemoryStream stream = new MemoryStream())

{
stream.Seek(0, SeekOrigin.Begin);
String datum = “zzza-” + DateTime.Now.ToString(”ddMMyyyyhhmmss”) + “.txt”;
IsolatedStorageFile fileStorage = IsolatedStorageFile.GetUserStoreForApplication();
BinaryWriter Writer = new BinaryWriter(new IsolatedStorageFileStream(datum, FileMode.OpenOrCreate, fileStorage));                         Writer.Write(stream.ToArray());
Writer.Close();
}

June 12, 2014

File contains Microsoft.Xna.Framework.Media.Song but trying to load as Microsoft.Xna.Framework.Audio.SoundEffect

Filed under: Software — Tags: , , , — admin @ 11:39 pm

Click on your media (.mp3) file in Content folder and in properties file set content processor to sound effect.
Content importer: MP3 AUDIO FILE
Content processor: Sound effects
Right click your project, clean solution and now run your project …
be happy ;)

May 27, 2014

Conversion to Dalvik format failed with error 1

Filed under: Software — Tags: , , , — admin @ 1:08 pm

Conversion to Dalvik format failed with error 1 when exporting and signing apk in Eclipse:

Disable “Build Automatically” on “Project menu” and rebuild it manually (Right click on project -> Build project). Then try export the application again.

This should fix your problem

May 21, 2014

All major shortcuts for eclipse

Filed under: info — Tags: , — admin @ 11:07 pm
Use
Ctrl + SHIFT + L which will open a list of all major shortcuts for eclipse.
  • For single line java code comment : Ctrl + / (Forwards Slash) and
  • Single line uncomment : Ctrl + \ (Backslash)
  • For multiple line java code comment : Ctrl + Shift + / (Forwards Slash) and
  • Multiline uncomment : Ctrl + Shift + \ (Backslash)
  • For single line xhtml code comment/uncomment : Ctrl + Shift + c
  • For multiple line xhtml code comment : Ctrl + Shift + / (Forwards Slash)
  • For multiple uncomment : Ctrl + Shift + \ (Backward Slash)

May 14, 2014

C# a generic error occurred in GDI+ Solution

Filed under: Software — Tags: , , — admin @ 3:13 pm

check permissions to folder where your file is hosted. This problem is mostly occurred for the security reasons, you may not enough permission to write file and so on

May 12, 2014

Show line numbers in Eclipse java code

Filed under: Software — Tags: , , — admin @ 12:15 pm

Window Menu -> Preferences -> General -> Editors -> Text Editors -> check Show line numbers

Eclipse hangs at the Android SDK Content Loader

Filed under: info — Tags: , , — admin @ 9:56 am

when opening eclipse, your eclipse loading proces hangs at Android sdk content loader stuck at 0%, and loading is stoped than you should try this:

  1. Make sure that eclipse is not active. If it is active kill eclipse from the processes tab of the task manager
  2. Open %USERPROFILE%/(in Windows C:\users\YOURLOGINNAME\.android)
  3. Go to .android folder (This may be a hidden folder)
  4. Delete the folder “cache” which is located inside .android folder
  5. Delete the file ddms.cfg which is located inside .android folder
  6. Start eclipse
  7. Be happy :)

May 9, 2014

Corner radius Android get flipped

Filed under: Software — Tags: , , , — admin @ 12:12 pm

There is a bug in earlier versions of android, where they have incorrectly implemented ‘corners’ attribute of ‘Shape’ class. When specifying the corners separately, the bottom left and right corners get flipped.

So you can create separate folder for resource and place with identification of version or you can write a condition which checks the target version and accordingly you can set the correct background.

private void getPreICSButtonBackground() {
    if(Build.VERSION.SDK_INT >= 3.0){
        leftButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.btn_rounded_left));
        rightButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.btn_rounded_right));
    }
}

Where in ‘R.drawable.btn_rounded_left’ corners are implemented like

<corners android:topLeftRadius="5dp" android:topRightRadius="0dp"
    android:bottomLeftRadius="5dp" android:bottomRightRadius="0dp" />

and if it is running on earlier versions, then set the background having corners as


<corners android:topLeftRadius="5dp" android:topRightRadius="0dp"
    android:bottomLeftRadius="0dp" android:bottomRightRadius="5dp" />

April 14, 2014

Create and write file Windos phone

Filed under: Software — Tags: , , , — admin @ 11:05 am


String datum = "infoFile-" + DateTime.Now.ToString("ddMMyyyyhhmmss") + ".txt";
IsolatedStorageFile fileStorage = IsolatedStorageFile.GetUserStoreForApplication();
StreamWriter Writer = new StreamWriter(new IsolatedStorageFileStream(datum,FileMode.OpenOrCreate, fileStorage));
Writer.WriteLine(resultXml);
Writer.Close();

February 20, 2014

Invalid length for a Base-64 char array or string.

Filed under: Software — Tags: , , — admin @ 2:32 am

If you are using encryption for the string, you probably passing string to the url and when you are passing your string you dont use Server.UrlEncode. Use Server.UrlEncode(string) before redirecting and that will properly escape the + into a %urlchar .

Decoding the querystring values is done already when it’s parsed into the Request.QueryString collection so you dont need to use Server.UrlDecode(String)

January 17, 2014

Object cannot be cast from DBNull to other types.

Filed under: Software — admin @ 3:06 pm

When using sqlDatasource  when Retrieving the Just-Inserted ID with SqlDataSource  like is described in this post and if you receiving Exception Details: System.InvalidCastException: Object cannot be cast from DBNull to other types. first thing you should do is to check if you have initialized connection string to your  sqlDatasource like this:

<asp:SqlDataSource ID=”SqlDataSource1″
ConnectionString=”<%$ ConnectionStrings:someConnectionString %>” runat=”server” InsertCommand=”insert test_value (sodrzina) values(@Sodrzina) SELECT @NewProductID = SCOPE_IDENTITY()” oninserted=”SqlDataSource1_Inserted”>

January 16, 2014

How to unlock Android phone after too many pattern attempts without factory reset

Filed under: Software — Tags: , , , , , , — admin @ 10:45 pm

So you or somebody were playing with your phone pattern now, you have black screen saying: To unlock sing in with your google account, but your wifi is disabled and you are unable to confirm your account.

One thing to tell you : No you can’t do anything with ADB if USB debugging is turned off… That setting must be on in order to execute any ADB commands. if your usb debugging is turned off go and do hard reset to your phone else you can try some of methods listed below.

There are lot of methods on net  how to enable wifi on android phone.

http://en.miui.com/thread-5684-1-1.html
http://biznet.gotdns.org/how-to-unlock-android-after-too-many-pattern-attempts-with-airplane-mode-switch-on/

but for my phone  i was receiving errors like:

sqlite3 not found , permissions denied, killed (adb shell svc wifi enable)

I was desperate so one thing that  i can  think off  was to try make simple android app that will enable my wifi , (if you install sdk you will be able to upload apk, but another thing shout be enabled in your phone is  Allow installation of non-Market apps) because i was sure that this option is enebaled i start eclipse and make simple apk that will just enable wifi. I upload  my apk to phone and voila wifi was ON . Here you can find how to upload .apk from adb

Here is code used for the apk.

Start your eclpse and in manifest add this permissinos:

<uses-permission android:name=”android.permission.ACCESS_WIFI_STATE” />
<uses-permission android:name=”android.permission.CHANGE_WIFI_STATE” />

and in your onCreate method after setContentView add this two lines:

WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
wifi.setWifiEnabled(true);

and build your app on telephone directly or make .apk and upload to the phone.

if you cant wait to unlock your phone here download my apk, hope someone will help.


Older Posts »

Powered by WordPress