Daily Archives

Articles indexed Wednesday April 11 2012

Page 4/17 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Need help in retrive date format with am/pm in codeignitor

    - by JigneshMistry
    I have got one problem. which is as follow I have converted date to my local time as below $this->date_string = "%Y/%m/%d %h:%i:%s"; $timestamp = now(); $timezone = 'UP45'; $daylight_saving = TRUE; $time = gmt_to_local($timestamp, $timezone, $daylight_saving); $this->updated_date = mdate($this->date_string,$time); And Storing this field in to database. now at retrive time i want like this format "11-04-2011 4:50:00 PM" I have used this code $timestamp = strtotime($rs->updated_date); $date1 = "%d-%m-%Y %h:%i:%s %a"; $updat1 = date($date1,$timestamp); but this will give me only "11-04-2011 4:50:00 AM" but I have stored in like it was PM. Can any one help me out. thanks.

    Read the article

  • javascript onmouseover hide a div block

    - by Loki
    SO this is my code so far: JS: <script type="text/javascript"> function Hide(srcField) { var x = srcField.getAttribute('name'); var string = new RegExp("hide_ID",'gi'); switch (x) { case "1": var dataRows= document.getElementsByID("obrazovanje"); alert (dataRows[0].innerHTML); dataRows[0].className.replace('',string); break; case "2": var dataRows= document.getElementsByID("rad_iskustvo"); dataRows[0].className.replace('',string); break; case "3": var dataRows= document.getElementsByID("strani_jezici"); dataRows[0].className.replace('',string); break; case "4": var dataRows= document.getElementsByID("znanja_vjestine"); dataRows[0].className.replace('',string); break; case "5": var dataRows= document.getElementsByID("osobine_interesi"); dataRows[0].className.replace('',string); break; } } </script> CSS: .hide_ID, { display:none } HTML: <a name="1"><h4><span name="1" onmouseover="Hide(this)">OBRAZOVANJE:</span></h4></a> <div ID="obrazovanje"> <ul> <li>2001.-2005. elektrotehnicar</li> <li>2009.-2012. racunarstvo</li> </ul> </div> the idea is that i want to hide the div block when i hover over the title that's in h4, but it doesn't seem to hide it... any ideas? i started using replace but it still didn't work, before that it was just 'dataRows[0].className = "hide_ID"' but that didn't work either.

    Read the article

  • Android Scoreloop, OpenFeint etc al

    - by theblitz
    I am looking to use one of the social networks in my Android program. Most important for me is the ability to build a continuous leadership board in which players move up and down depending their wins/loses to others. The idea is for players to challenge others head-to-head. The winner gains points and the loser loses points. Equally important, I want this feature to include the possibility to "charge" the player game coins. Scoreloop includes the possibility of challenges but they are there in order to win coins off other players. In other words, they are the means to the end. In my case I need it to be the other way around. The "ends" is to be higher in the leadership board and the "means" are to play others with coins. Scoreloop do have a continuos leadership board but it is not accessible from the program. I tried looking at OpenFeint but their site is a real mess. It is impossible to understand from there exactly what is and isn't available. I signed up and tried to add my program. I ended up adding it four times and cannot delete it!

    Read the article

  • No parameterless constructor defined for this object when simply copying site

    - by jaffa
    I'm getting the above error. All I have done is copied an existing site and set-up debugging to use a different port using IISExpress in Visual Studio. Any ideas why I would suddenly get this error? Normally I get this error when StructureMap cannot for some reason resolve a dependency to inject into a controller. But this has me stumped. The code-base is the same. All I've done is copied the code into another folder!?!

    Read the article

  • Connect to MySQL via PHP script tunnel

    - by Neo
    Here's the question, I need to connect to a remote MySQL database from my C# Application, problem is the MySQL instance will block all access to all IP's apart from localhost, this can not be changed as its too much of a security issue. The question is, is it possible to connect via a tunnel instead to a php script hosted on the server, this would then act as the mysql connection. Any ideas and suggestions?

    Read the article

  • MSAccess: select N records from each category

    - by Jaume
    I can't solve this on MS Access SQL. I have a foo table with this fields: id, title, category, date I need to show 6 records showing the 2 most recent items from each category For example, I have: ID TITLE CAT DATE ------------------------ 1 aaa cat1 12/03/12 2 sdfs cat2 12/03/12 3 asg cat2 13/03/12 4 flkgjfl cat3 11/03/12 5 dgdg cat1 18/03/12 6 dfgd cat1 15/03/12 7 dgdgd cat3 18/03/12 8 dfgd cat3 12/03/12 9 uiuou cat1 14/03/12 10 ghj cat4 11/03/12 So, I need something like: ID TITLE CAT DATE ---------------------------------- 5 dgdg cat1 18/03/2012 6 dfgd cat1 15/03/2012 3 asg cat2 13/03/2012 2 sdfs cat2 12/03/2012 7 dgdgd cat3 18/03/2012 8 dfgd cat3 12/03/2012 Thank you in advance.

    Read the article

  • Record Name field in DNS responce

    - by Lescott
    I just read about DNS protocol, and found, that the name field can be writen in two ways: lenght of the next label the label lenght of the next label the label ... zero-byte pointer to the previous name field Next is the original article fragment: The Resource Record Name field is encoded in the same way as the Question Name field unless the name is already present elsewhere in the DNS message, in which case a 2-byte field is used in place of a length-value encoded name and acts as a pointer to the name that is already present. So, my question is, how can I determine the first or the second way is using in a package?

    Read the article

  • CComPtr pass by reference

    - by Mahesh
    I have a situation where I need to pass a CComPtr<IXmlReader> to a function by reference. Does the called parameter takes the ownership from the callee parameter (or) the reference count is increased? void foo( CComPtr<IXmlReader> & pReader ) { // There is no reassignment of the CComPtr. // Just call the IXmlReader methods. } CComPtr<IXmlReader> pReader; foo( pReader ); // Is pReader still valid after the function return ? Thanks.

    Read the article

  • Motion detection in compressed domain (JPEG/Mpeg4/H264)

    - by paft
    everyone! I process video from IP cameras and have wrote a motion detection algorithm based on decompressed video analysis. But i really something more fast. I've found several papers about compressed domain analysis but have failed to find any implementations. Can anyone recommend me some code? found materials: http://www.ist-live.org/intranet/school-of-informatics-university-of-bradford001-7/41410206.pdf/view http://doc.rero.ch/lm.php?url=1000,43,4,20061128120121-NA/Bracamonte_Javier_-_A_Low_Complexity_Change_Detection_Algorithm_20061128.pdf

    Read the article

  • NSWindowController window?

    - by Ilija Tovilo
    I have a menu-bar based application, which displays a window, when the icon is clicked. It all works fine on Mac OS X Lion, but for some reason, an error occurs on Snow Leopard an sooner versions of Mac OS X. Anytime [TheWindowController window] is called the method stops, but the app keeps running. Because of this, I don't think that the window is just nil, it's corrupt, in some way. I have no Idea why this happens, and like I said, it only happens in Mac OS X Snow Leopard. Btw. I use ARC, if that matters at all. Thank you!

    Read the article

  • Return an Object in Java

    - by digby12
    I've been struggling to work out how to return an object. I have the following array of objects. ArrayList<Object> favourites; I want to find an object in the array based on it's "description" property. public Item finditem(String description) { for (Object x : favourites) { if(description.equals(x.getDescription())) { return Object x; else { return null; Can someone please show me how I would write this code. Thanks.

    Read the article

  • Intercommunication between Java Chat Servers

    - by Pravingate
    I have a application in which I am using socket programming , having this(image) scenario. Where number of clients will try to connect Broadcast server. Now here I am managing load through LVS(Load balancer). so as a example shown in image, suppose 200 clients will wish to login for broadcast they will be distributed as 100 users on server 1 and another 100 users on server 2.clients will get connected to servers using TCP connection. Now I am maintaining user information on server side in arraylist which will be stored in heap memory,Now the problem is if client wish to broadcast to all logged in users, but that particular client is logged in server 1. and so client will not be able to broadcast another 100 users from server 2. Because both ther servers are unaware about each others state. please suggest to solve this scenario by whatever means you want.

    Read the article

  • Strange issues with view switcher after object animator animations

    - by Barry Irvine
    I have two LinearLayout views that contain a number of edit texts and checkboxes for entering user information (name, email address etc). When a validation fails on one of these fields a gone textview is displayed showing the validation error. I have enclosed the two layouts within a ViewSwitcher and I animate between the two views using the ObjectAnimator class. (Since the code needs to support older versions of Android I am actually using the nineoldandroids backwards compatibility library for this). The bulk of the work is performed in my switchToChild method. If I flip the views more than twice then I start to run into strange errors. Firstly although the correct child view of the view animator is displayed it seems that the other view has focus and I can click on the views beneath the current one. I resolved this issue by adding a viewSwitcher.bringChildToFront at the end of the first animation. When I do this however and perform a validation on the 2nd view the "gone" view that I have now set to visible is not displayed (as if the linearlayout is never being re-measured). Here is a subset of the XML file: <ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/TitleBar" android:scrollbarAlwaysDrawVerticalTrack="true" android:scrollbarStyle="outsideOverlay" android:scrollbars="vertical" > <ViewSwitcher android:id="@+id/switcher" android:layout_width="fill_parent" android:layout_height="wrap_content" > <LinearLayout android:id="@+id/page_1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <!-- Lots of subviews here --> <LinearLayout android:id="@+id/page_2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > And this is the main method for flipping between the views: private void switchToChild(final int child) { final ViewSwitcher viewSwitcher = (ViewSwitcher) findViewById(R.id.switcher); if (viewSwitcher.getDisplayedChild() != child) { final Interpolator accelerator = new AccelerateInterpolator(); final Interpolator decelerator = new DecelerateInterpolator(); final View visibleView; final View invisibleView; switch (child) { case 0: visibleView = findViewById(R.id.page_2); invisibleView = findViewById(R.id.page_1); findViewById(R.id.next).setVisibility(View.VISIBLE); findViewById(R.id.back).setVisibility(View.GONE); break; case 1: default: visibleView = findViewById(R.id.page_1); invisibleView = findViewById(R.id.page_2); findViewById(R.id.back).setVisibility(View.VISIBLE); findViewById(R.id.next).setVisibility(View.GONE); break; } final ObjectAnimator visToInvis = ObjectAnimator.ofFloat(visibleView, "rotationY", 0f, 90f).setDuration(250); visToInvis.setInterpolator(accelerator); final ObjectAnimator invisToVis = ObjectAnimator.ofFloat(invisibleView, "rotationY", -90f, 0f).setDuration(250); invisToVis.setInterpolator(decelerator); visToInvis.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator anim) { viewSwitcher.showNext(); invisToVis.start(); viewSwitcher.bringChildToFront(invisibleView); // If I don't do this the old view can have focus } }); visToInvis.start(); } } Does anyone have any ideas? This is really confusing me!

    Read the article

  • Passing ByteArray from flash (as3) to AMFPHP (2.0.1)

    - by Mauro
    i have a problem passing ByteArray from flash (as3) to amfphp to save an image. With old version of amfphp, all worked in the past… now, with new version i have many problem. I'm using version 2.0.1 and the first problem is that i have to do this, for access to my info: function SaveAsJPEG($json) { $string = json_encode($json); $obj = json_decode($string); $compressed = $obj->{'compressed'}; } in the past i wrote only: function SaveAsJPEG($json) { $compressed = $json['compressed']; } Anyway… now i can take all data (if i use " $json['compressed']" i receive an error) but i can't receive my ByteArray data. From flash i write this: var tempObj:Object = new Object(); tempObj["jpgStream "]= createBitStream(myBitmmapData); // return ByteArray tempObj["compressed"] = false; tempObj["dir"] = linkToSave; tempObj["name"] = this.imageName; So.. in my php class i receive all correct info, except "jpgStream" that seems "null". Do you have any idea?

    Read the article

  • ASP.NET (VB) - Close an opened SQL connection inside Function

    - by B1GB0Y
    Can anyone tell me how I close an opened SQL connection inside a Function? I call a Select Function like this: Function Selec(ByVal SQLStr As String) As SqlDataReader Dim SQLConn As New SqlConnection() Dim SQLCmd As New SqlCommand() SQLConn.ConnectionString = Session("bd") SQLConn.Open() SQLCmd.Connection = SQLConn SQLCmd.CommandText = SQLStr Selec = SQLCmd.ExecuteReader End Function And in another page I do a While method to retrieve me the data like this: (Note: BDcon.BD is the name of the Class that have Functions) Dim write as New BDcon.BD Dim menu As SqlDataReader = writeBD.Selec("SELECT something from Table") While menu.Read 'Do something End While menu.Close 'This close just the DataReader and not the SqlConnection Finally I want to Close my SQL Connection by Function like this: Function Close() As SqlConnection Dim SQLConn As New SqlConnection() SQLConn.ConnectionString = Session("bd") SQLConn.Close() End Function I think that the problem is on the Close() Function, I want to close the connection but I don't know how to call my Opened Conneciton. Please anyone can help me? Thanks in advance :)

    Read the article

  • Producer and Consumer Threads Hang

    - by user972425
    So this is my first foray into threads and thus far it is driving me insane. My problem seems to be some kind of synchronization error that causes my consumer thread to hang. I've looked at other code and just about everything I could find and I can't find what my error is. There also seems to be a discrepancy between the code being executed in Eclipse and via javac in the command line. Intention - Using a bounded buffer (with 1000 slots) create and consume 1,000,000 doubles. Use only notify and wait. Problem - In Eclipse the consumer thread will occasionally hang around 940,000 iterations, but other times completes. In the command line the consumer thread always hangs. Output - Eclipse - Successful Producer has produced 100000 doubles. Consumer has consumed 100000 doubles. Producer has produced 200000 doubles. Consumer has consumed 200000 doubles. Producer has produced 300000 doubles. Consumer has consumed 300000 doubles. Producer has produced 400000 doubles. Consumer has consumed 400000 doubles. Producer has produced 500000 doubles. Consumer has consumed 500000 doubles. Producer has produced 600000 doubles. Consumer has consumed 600000 doubles. Producer has produced 700000 doubles. Consumer has consumed 700000 doubles. Producer has produced 800000 doubles. Consumer has consumed 800000 doubles. Producer has produced 900000 doubles. Consumer has consumed 900000 doubles. Producer has produced 1000000 doubles. Producer has produced all items. Consumer has consumed 1000000 doubles. Consumer has consumed all items. Exitting Output - Command Line/Eclipse - Unsuccessful Producer has produced 100000 doubles. Consumer has consumed 100000 doubles. Producer has produced 200000 doubles. Consumer has consumed 200000 doubles. Producer has produced 300000 doubles. Consumer has consumed 300000 doubles. Producer has produced 400000 doubles. Consumer has consumed 400000 doubles. Producer has produced 500000 doubles. Consumer has consumed 500000 doubles. Producer has produced 600000 doubles. Consumer has consumed 600000 doubles. Producer has produced 700000 doubles. Consumer has consumed 700000 doubles. Producer has produced 800000 doubles. Consumer has consumed 800000 doubles. Producer has produced 900000 doubles. Consumer has consumed 900000 doubles. Producer has produced 1000000 doubles. Producer has produced all items. At this point it just sits and hangs. Any help you can provide about where I might have misstepped is greatly appreciated. Code - Producer thread import java.text.DecimalFormat;+ " doubles. Cumulative value of generated items= " + temp) import java.util.*; import java.io.*; public class producer implements Runnable{ private buffer produceBuff; public producer (buffer buff){ produceBuff = buff; } public void run(){ Random random = new Random(); double temp = 0, randomElem; DecimalFormat df = new DecimalFormat("#.###"); for(int i = 1; i<=1000000; i++) { randomElem = (Double.parseDouble( df.format(random.nextDouble() * 100.0))); try { produceBuff.add(randomElem); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } temp+= randomElem; if(i%100000 == 0) {produceBuff.print("Producer has produced "+ i ); } } produceBuff.print("Producer has produced all items."); } } Consumer thread import java.util.*; import java.io.*; public class consumer implements Runnable{ private buffer consumBuff; public consumer (buffer buff){ consumBuff = buff; } public void run(){ double temp = 0; for(int i = 1; i<=1000000; i++) { try { temp += consumBuff.get(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(i%100000 == 0) {consumBuff.print("Consumer has consumed "+ i ); //if(i>999000) //{System.out.println("Consuming item " + i);} } consumBuff.print("Consumer has consumed all items."); } } Buffer/Main import java.util.*; import java.io.*; public class buffer { private double buff[]; private int addPlace; private int getPlace; public buffer(){ buff = new double[1000]; addPlace = 0; getPlace = 0; } public synchronized void add(double add) throws InterruptedException{ if((addPlace+1 == getPlace) ) { try { wait(); } catch (InterruptedException e) {throw e;} } buff[addPlace] = add; addPlace = (addPlace+1)%1000; notify(); } public synchronized double get()throws InterruptedException{ if(getPlace == addPlace) { try { wait(); } catch (InterruptedException e) {throw e;} } double temp = buff[getPlace]; getPlace = (getPlace+1)%1000; notify(); return temp; } public synchronized void print(String view) { System.out.println(view); } public static void main(String args[]){ buffer buf = new buffer(); Thread produce = new Thread(new producer(buf)); Thread consume = new Thread(new consumer(buf)); produce.start(); consume.start(); try { produce.join(); consume.join(); } catch (InterruptedException e) {return;} System.out.println("Exitting"); } }

    Read the article

  • Basic Google search using a shell script

    - by Lri
    Something like this but using just basic shell scripting: #!/usr/bin/env python import urllib import json base = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&' query = urllib.urlencode({'q' : "something"}) response = urllib.urlopen(base + query).read() data = json.loads(response) print data['responseData']['results'][0]['url'] Any more convenient alternatives to ajax.googleapis.com? If not, how should you encode the URL and parse JSON?

    Read the article

  • MDX filter members in a sum-function

    - by Radagast2005
    I have an SSAS cube containing customers and their purchased memberships (let's say magazines). I want to calculate the retention. I.e. how many customers remain a customer. To do this I specify a set (males, 30yrs, 1 january 2011). I want to see if this set - identified by a customer number - is still present in the following months. I named my set MySet2. What I try to do is: sum(measures.amount, [membership].[name].&[X], MySet2, [date].[date].currentmember) However, the result is incorrect. The number is far to low. I suspect it still tries to account for all the males of 30 years old, but after a year they're not 30 anymore. What am I missing? I looked at scope and filter, but I'm not sure how to apply it.

    Read the article

  • Android listview array adapter selected

    - by João Melo
    i'm trying to add a contextual action mode to a listview, but i'm having some problems with the selection, if i make aList1.setSelection(position) it doesn't select anything, and if i make List1.setItemChecked(position, true) it works but it only changes the font color a little and i want it to change the background or something more notable, is there any way to detect the selection and manually and change the background, or i'm missing something? the list: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <ListView android:id="@+id/list1" android:layout_width="match_parent" android:layout_height="match_parent" android:choiceMode="singleChoice" android:drawSelectorOnTop="false"> </ListView> </RelativeLayout> the adapter: public class ServicesRowAdapter extends ArrayAdapter<String[]> { private final Activity context; private final ArrayList<String[]> names; static class ViewHolder { public TextView Id; public TextView Date; public RelativeLayout statusbar,bglayout; } public ServicesRowAdapter(Activity context, ArrayList<String[]> names) { super(context, R.layout.servicesrowlayout, names); this.context = context; this.names = names; } @Override public View getView(int position, View convertView, ViewGroup parent) { View rowView = convertView; if (rowView == null) { LayoutInflater inflater = context.getLayoutInflater(); rowView = inflater.inflate(R.layout.servicesrowlayout, null); ViewHolder viewHolder = new ViewHolder(); viewHolder.Id = (TextView) rowView.findViewById(R.id.idlabel); viewHolder.Date = (TextView) rowView.findViewById(R.id.datelabel); rowView.setTag(viewHolder); } ViewHolder holder = (ViewHolder) rowView.getTag(); holder.Date.setText(names.get(position)[2]); holder.Id.setText(names.get(position)[1]); return rowView; } } with the use of a layout: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" > <TextView android:id="@+id/idlabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:gravity="right" android:text="@+id/idlabel" android:textSize="20dp" android:width="70dp" > </TextView> <TextView android:id="@+id/datelabel" android:layout_centerVertical="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@+id/datelabel" android:textSize="20dp" android:layout_marginLeft="90dp" > </TextView> </RelativeLayout

    Read the article

  • HTML Tag for the full current URL - IonCube

    - by Amash
    I am creating a website using IonCube. I can use some PHP coding in the HTML page templates, however, I would like to know how to get the FULL URL plus a link when I click on it. For example, My current URL is: http://example.com/site_search.php?option_1=1&option_2=1 and when I click on a link, it directs me to another added option, so the result will be: http://example.com/site_search.php?option_1=1&option_2=1&option_3&option_4=8 As you have seen, these are options, and users can select anything. I appreciate your help - Thanks

    Read the article

  • Ruby on Rails Decryption

    - by user812120
    0 down vote favorite share [g+] share [fb] share [tw] The following function works perfect in PHP. How can it be translated in Ruby on Rails. Please note that both privateKey and iv are 32 characters long. mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $privateKey, base64_decode($enc), MCRYPT_MODE_CBC, $iv) I tried to use the following in Ruby but got a bad decrypt error. cipher = OpenSSL::Cipher.new('aes-256-cbc') cipher.decrypt cipher.key = privateKey cipher.iv = iv decrypted = '' << cipher.update(encrypted) << cipher.final

    Read the article

  • get_bookmarks() object doesn't return link_category

    - by ninja
    I'm trying to fetch all link-categories from the built in Wordpress linklist (or bookmarks if you will). To do this, I simply stored all links in a variable like this: <?php $lists = get_bookmarks(); foreach($lists as $list) { $cats[] = $list->link_category; } ?> To my surprise even var_dump'ing $cats gave me "String(0)", so I var_dump'ed out $lists instead, and it gave me this: array(8) { [0]=> object(stdClass)#5126 (13) { ["link_id"]=> string(1) "1" ["link_url"]=> string(27) "http://codex.wordpress.org/" ["link_name"]=> string(13) "Documentation" ["link_image"]=> string(0) "" ["link_target"]=> string(0) "" ["link_description"]=> string(0) "" ["link_visible"]=> string(1) "Y" ["link_owner"]=> string(1) "1" ["link_rating"]=> string(1) "0" ["link_updated"]=> string(19) "0000-00-00 00:00:00" ["link_rel"]=> string(0) "" ["link_notes"]=> string(0) "" ["link_rss"]=> string(0) "" } Now, codex.wordpress.org is a default link that comes with wordpress, it's in a category called "Linklist", and as you can see, the object contains everything about that link, EXCEPT the categoryname. According to the codex this object should contain a field named "link_category", so I'm getting confused here. Am I missing something? Is the function broke? Regards NINJA

    Read the article

  • Issue in achartengine jar file

    - by Anshuman
    Actually i have created an app in which i have used achartengine to contruct graph. It was running ok, but today i saw an update for android SDK to r17. Once i upadated the sdk the app i had build started crash. In the logcat i show the following error report. Why this happen, is it because the jar file i have used is deprecated. 03-27 14:44:26.320: E/AndroidRuntime(4360): java.lang.NoClassDefFoundError: [Lorg.achartengine.chart.PointStyle; 03-27 14:44:26.320: E/AndroidRuntime(4360): at in.com.example.ChartEngineActivity.onCreate(ChartEngineActivity.java:58) 03-27 14:44:26.320: E/AndroidRuntime(4360): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 03-27 14:44:26.320: E/AndroidRuntime(4360): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) 03-27 14:44:26.320: E/AndroidRuntime(4360): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 03-27 14:44:26.320: E/AndroidRuntime(4360): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 03-27 14:44:26.320: E/AndroidRuntime(4360): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 03-27 14:44:26.320: E/AndroidRuntime(4360): at android.os.Handler.dispatchMessage(Handler.java:99) 03-27 14:44:26.320: E/AndroidRuntime(4360): at android.os.Looper.loop(Looper.java:130) 03-27 14:44:26.320: E/AndroidRuntime(4360): at android.app.ActivityThread.main(ActivityThread.java:3683) 03-27 14:44:26.320: E/AndroidRuntime(4360): at java.lang.reflect.Method.invokeNative(Native Method) 03-27 14:44:26.320: E/AndroidRuntime(4360): at java.lang.reflect.Method.invoke(Method.java:507) 03-27 14:44:26.320: E/AndroidRuntime(4360): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 03-27 14:44:26.320: E/AndroidRuntime(4360): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 03-27 14:44:26.320: E/AndroidRuntime(4360): at dalvik.system.NativeStart.main(Native Method)

    Read the article

  • Pluralsight Meet the Author Podcast on Structuring JavaScript Code

    - by dwahlin
    I had the opportunity to talk with Fritz Onion from Pluralsight about one of my recent courses titled Structuring JavaScript Code for one of their Meet the Author podcasts. We talked about why JavaScript patterns are important for building more re-useable and maintainable apps, pros and cons of different patterns, and how to go about picking a pattern as a project is started. The course provides a solid walk-through of converting what I call “Function Spaghetti Code” into more modular code that’s easier to maintain, more re-useable, and less susceptible to naming conflicts. Patterns covered in the course include the Prototype Pattern, Revealing Module Pattern, and Revealing Prototype Pattern along with several other tips and techniques that can be used. Meet the Author:  Dan Wahlin on Structuring JavaScript Code   The transcript from the podcast is shown below: [Fritz]  Hello, this is Fritz Onion with another Pluralsight author interview. Today we’re talking with Dan Wahlin about his new course, Structuring JavaScript Code. Hi, Dan, it’s good to have you with us today. [Dan]  Thanks for having me, Fritz. [Fritz]  So, Dan, your new course, which came out in December of 2011 called Structuring JavaScript Code, goes into several patterns of usage in JavaScript as well as ways of organizing your code and what struck me about it was all the different techniques you described for encapsulating your code. I was wondering if you could give us just a little insight into what your motivation was for creating this course and sort of why you decided to write it and record it. [Dan]  Sure. So, I got started with JavaScript back in the mid 90s. In fact, back in the days when browsers that most people haven’t heard of were out and we had JavaScript but it wasn’t great. I was on a project in the late 90s that was heavy, heavy JavaScript and we pretty much did what I call in the course function spaghetti code where you just have function after function, there’s no rhyme or reason to how those functions are structured, they just kind of flow and it’s a little bit hard to do maintenance on it, you really don’t get a lot of reuse as far as from an object perspective. And so coming from an object-oriented background in JAVA and C#, I wanted to put something together that highlighted kind of the new way if you will of writing JavaScript because most people start out just writing functions and there’s nothing with that, it works, but it’s definitely not a real reusable solution. So the course is really all about how to move from just kind of function after function after function to the world of more encapsulated code and more reusable and hopefully better maintenance in the process. [Fritz]  So I am sure a lot of people have had similar experiences with their JavaScript code and will be looking forward to seeing what types of patterns you’ve put forth. Now, a couple I noticed in your course one is you start off with the prototype pattern. Do you want to describe sort of what problem that solves and how you go about using it within JavaScript? [Dan]  Sure. So, the patterns that are covered such as the prototype pattern and the revealing module pattern just as two examples, you know, show these kind of three things that I harp on throughout the course of encapsulation, better maintenance, reuse, those types of things. The prototype pattern specifically though has a couple kind of pros over some of the other patterns and that is the ability to extend your code without touching source code and what I mean by that is let’s say you’re writing a library that you know either other teammates or other people just out there on the Internet in general are going to be using. With the prototype pattern, you can actually write your code in such a way that we’re leveraging the JavaScript property and by doing that now you can extend my code that I wrote without touching my source code script or you can even override my code and perform some new functionality. Again, without touching my code.  And so you get kind of the benefit of the almost like inheritance or overriding in object oriented languages with this prototype pattern and it makes it kind of attractive that way definitely from a maintenance standpoint because, you know, you don’t want to modify a script I wrote because I might roll out version 2 and now you’d have to track where you change things and it gets a little tricky. So with this you just override those pieces or extend them and get that functionality and that’s kind of some of the benefits that that pattern offers out of the box. [Fritz]  And then the revealing module pattern, how does that differ from the prototype pattern and what problem does that solve differently? [Dan]  Yeah, so the prototype pattern and there’s another one that’s kind of really closely lined with revealing module pattern called the revealing prototype pattern and it also uses the prototype key word but it’s very similar to the one you just asked about the revealing module pattern. [Fritz]  Okay. [Dan]  This is a really popular one out there. In fact, we did a project for Microsoft that was very, very heavy JavaScript. It was an HMTL5 jQuery type app and we use this pattern for most of the structure if you will for the JavaScript code and what it does in a nutshell is allows you to get that encapsulation so you have really a single function wrapper that wraps all your other child functions but it gives you the ability to do public versus private members and this is kind of a sort of debate out there on the web. Some people feel that all JavaScript code should just be directly accessible and others kind of like to be able to hide their, truly their private stuff and a lot of people do that. You just put an underscore in front of your field or your variable name or your function name and that kind of is the defacto way to say hey, this is private. With the revealing module pattern you can do the equivalent of what objective oriented languages do and actually have private members that you literally can’t get to as an external consumer of the JavaScript code and then you can expose only those members that you want to be public. Now, you don’t get the benefit though of the prototype feature, which is I can’t easily extend the revealing module pattern type code if you don’t like something I’m doing, chances are you’re probably going to have to tweak my code to fix that because we’re not leveraging prototyping but in situations where you’re writing apps that are very specific to a given target app, you know, it’s not a library, it’s not going to be used in other apps all over the place, it’s a pattern I actually like a lot, it’s very simple to get going and then if you do like that public/private feature, it’s available to you. [Fritz]  Yeah, that’s interesting. So it’s almost, you can either go private by convention just by using a standard naming convention or you can actually enforce it by using the prototype pattern. [Dan]  Yeah, that’s exactly right. [Fritz]  So one of the things that I know I run across in JavaScript and I’m curious to get your take on is we do have all these different techniques of encapsulation and each one is really quite different when you’re using closures versus simply, you know, referencing member variables and adding them to your objects that the syntax changes with each pattern and the usage changes. So what would you recommend for people starting out in a brand new JavaScript project? Should they all sort of decide beforehand on what patterns they’re going to stick to or do you change it based on what part of the library you’re working on? I know that’s one of the points of confusion in this space. [Dan]  Yeah, it’s a great question. In fact, I just had a company ask me about that. So which one do I pick and, of course, there’s not one answer fits all. [Fritz]  Right. [Dan]  So it really depends what you just said is absolutely in my opinion correct, which is I think as a, especially if you’re on a team or even if you’re just an individual a team of one, you should go through and pick out which pattern for this particular project you think is best. Now if it were me, here’s kind of the way I think of it. If I were writing a let’s say base library that several web apps are going to use or even one, but I know that there’s going to be some pieces that I’m not really sure on right now as I’m writing I and I know people might want to hook in that and have some better extension points, then I would look at either the prototype pattern or the revealing prototype. Now, really just a real quick summation between the two the revealing prototype also gives you that public/private stuff like the revealing module pattern does whereas the prototype pattern does not but both of the prototype patterns do give you the benefit of that extension or that hook capability. So, if I were writing a library that I need people to override things or I’m not even sure what I need them to override, I want them to have that option, I’d probably pick a prototype, one of the prototype patterns. If I’m writing some code that is very unique to the app and it’s kind of a one off for this app which is what I think a lot of people are kind of in that mode as writing custom apps for customers, then my personal preference is the revealing module pattern you could always go with the module pattern as well which is very close but I think the revealing module patterns a little bit cleaner and we go through that in the course and explain kind of the syntax there and the differences. [Fritz]  Great, that makes a lot of sense. [Fritz]  I appreciate you taking the time, Dan, and I hope everyone takes a chance to look at your course and sort of make these decisions for themselves in their next JavaScript project. Dan’s course is, Structuring JavaScript Code and it’s available now in the Pluralsight Library. So, thank you very much, Dan. [Dan]  Thanks for having me again.

    Read the article

  • Powershell progress dialogs

    - by Norgean
    Creating nested progress dialogs in Powershell is easy. Let the code speak for itself: for ($i = 1; $i -le 2; $i++) {     Write-Progress -ID 1 -Activity "Outer loop" -Status "Tick $i" -percentComplete ($i / 2*100)     for ($j = 1; $j -le 3; $j++)     {         Write-Progress -ID 2 -Activity "Mid loop" -Status "Tick $j" -percentComplete ($j / 3*100)         for ($k = 1; $k -le 3; $k++)         {             Write-Progress -ID 3 -Activity "Inner loop" -Status "Tick $k" -percentComplete ($k / 3*100)             Sleep(1)         }     } } I.e. some text that explains what we're doing (Activity and Status), and ID numbers. Easy.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >