Daily Archives

Articles indexed Monday June 25 2012

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

  • Better way to go up/down slope based on yaw?

    - by CyanPrime
    Alright, so I got a bit of movement code and I'm thinking I'm going to need to manually input when to go up/down a slope. All I got to work with is the slope's normal, and vector, and My current and previous position, and my yaw. Is there a better way to rotate whether I go up or down the slope based on my yaw? Vector3f move = new Vector3f(0,0,0); move.x = (float)-Math.toDegrees(Math.cos(Math.toRadians(yaw))); move.z = (float)-Math.toDegrees(Math.sin(Math.toRadians(yaw))); move.normalise(); if(move.z < 0 && slopeNormal.z > 0 || move.z > 0 && slopeNormal.z < 0){ if(move.x < 0 && slopeNormal.x > 0 || move.x > 0 && slopeNormal.x < 0){ move.y += slopeVec.y; } } if(move.z > 0 && slopeNormal.z > 0 || move.z < 0 && slopeNormal.z < 0){ if(move.x > 0 && slopeNormal.x > 0 || move.x < 0 && slopeNormal.x < 0){ move.y -= slopeVec.y; } } move.scale(movementSpeed * delta); Vector3f.add(pos, move, pos);

    Read the article

  • How to make a sum of total for each id

    - by JetJack
    Using Crystal report 7 I want to view the table 1 and sum of table2 table1 id name 001 raja 002 vijay 003 suresh .... table2 id value 001 100 001 200 001 150 002 200 003 150 003 200 ... I want to display all the rows from table1 and sum(values) from table2. How to do this in crystal report Expected Output id name value 001 raja 450 002 vijay 200 003 suresh 350 .... Note: I add the table field directly to the report, i am not added store procedure or views or query in the report. How to do this. Need Crystal report help

    Read the article

  • ZendX jQuery Autocomplete not working in framework

    - by Jan-Dean Fajardo
    I added the ZendX library. Added the helper in controller: public function init() { $this->view->addHelperPath( 'ZendX/JQuery/View/Helper' ,'ZendX_JQuery_View_Helper'); } Created a form for view page: public function indexAction() { // Filter form $this->view->autocompleteElement = new ZendX_JQuery_Form_Element_AutoComplete('txtLocation'); $this->view->autocompleteElement->setAttrib('placeholder', 'Search Location'); $this->view->autocompleteElement->setJQueryParam('data', array('Manila', 'Pasay', 'Mandaluyong', 'Pasig', 'Marikina','Makati')); } Load jQuery and form in view page. <?php echo $this->jQuery(); ?> <form> <?php echo $this->autocompleteElement; ?> </form> The form is visible in the view page. But the autocomplete isn't working. I even don't see any jQuery script in the source page. Have I missed something?

    Read the article

  • Want to Receive dynamic length data from a message queue in IPC?

    - by user1089679
    Here I have to send and receive dynamic data using a SysV message queue. so in structure filed i have dynamic memory allocation char * because its size may be varies. so how can i receive this type of message at receiver side. Please let me know how can i send dynamic length of data with message queue. I am getting problem in this i posted my code below. send.c /*filename : send.c *To compile : gcc send.c -o send */ #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> struct my_msgbuf { long mtype; char *mtext; }; int main(void) { struct my_msgbuf buf; int msqid; key_t key; static int count = 0; char temp[5]; int run = 1; if ((key = ftok("send.c", 'B')) == -1) { perror("ftok"); exit(1); } printf("send.c Key is = %d\n",key); if ((msqid = msgget(key, 0644 | IPC_CREAT)) == -1) { perror("msgget"); exit(1); } printf("Enter lines of text, ^D to quit:\n"); buf.mtype = 1; /* we don't really care in this case */ int ret = -1; while(run) { count++; buf.mtext = malloc(50); strcpy(buf.mtext,"Hi hello test message here"); snprintf(temp, sizeof (temp), "%d",count); strcat(buf.mtext,temp); int len = strlen(buf.mtext); /* ditch newline at end, if it exists */ if (buf.mtext[len-1] == '\n') buf.mtext[len-1] = '\0'; if (msgsnd(msqid, &buf, len+1, IPC_NOWAIT) == -1) /* +1 for '\0' */ perror("msgsnd"); if(count == 100) run = 0; usleep(1000000); } if (msgctl(msqid, IPC_RMID, NULL) == -1) { perror("msgctl"); exit(1); } return 0; } receive.c /* filename : receive.c * To compile : gcc receive.c -o receive */ #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> struct my_msgbuf { long mtype; char *mtext; }; int main(void) { struct my_msgbuf buf; int msqid; key_t key; if ((key = ftok("send.c", 'B')) == -1) { /* same key as send.c */ perror("ftok"); exit(1); } if ((msqid = msgget(key, 0644)) == -1) { /* connect to the queue */ perror("msgget"); exit(1); } printf("test: ready to receive messages, captain.\n"); for(;;) { /* receive never quits! */ buf.mtext = malloc(50); if (msgrcv(msqid, &buf, 50, 0, 0) == -1) { perror("msgrcv"); exit(1); } printf("test: \"%s\"\n", buf.mtext); } return 0; }

    Read the article

  • Eclipse Juno: Can't find fast view panel

    - by otakun85
    Version: Eclipse 4.2 Codename: Juno I don't see a fast view bar in eclipse 4.2. I can't rightclick on a view and enable fast view. The fast view options under General - Perspectives does nothing. Was the fast view feature removed or am I missing something? I've looked up at http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-9b.htm , but that didn't helped either.

    Read the article

  • How can i allow people in my local network to access the web service in my machine?

    - by user1451704
    I have coded a web service using the Axis 2 framework and I can successfully invoke it using a test client (SoapUI) on the local machine after publishing the application in JBoss 5. I can post to the WS endpoint from the local machine and get the expected response. Now i want to allow other machines to access the web service. i changed the "localhost" to "my own fixed IP" adress at the end point location, and turned firewall off, but impossible to access the WS. Note : windows Xp SP3. Any idea ? Thanks in advance !!

    Read the article

  • How to switch between the two spring context in runtime?

    - by Selector
    I have current ApplicationContext and I want to replace it by newAppContext ApplicationContext currentAppContext = getOldAppContext (); ApplicationContext newAppContext = loadAppContext (); If i do: currentAppContext.stop(); currentAppContext.close(); currentAppContext= newAppContext; And then try: currentAppContext.getBean("SampleBean"); I have follow error: java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext How to substitute spring context?

    Read the article

  • How to create factories with attr_accesible?

    - by regedarek
    How to deal with factories and attr_accessible? My example: # model class SomeModel attr_accessible :name, full_name, other_name end #spec require 'spec_helper' describe "test" do it do create(:some_model, name: "test name", user: User.first) #factory end end #error ruby(17122,0x12a055000) malloc: *** error for object 0x8: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug I think the error is because user_id is not in attr_accesible atributes

    Read the article

  • non blocking TCP-acceptor not reading from socket

    - by Abruzzo Forte e Gentile
    I have the code below implementing a NON-Blocking TCP acceptor. Clients are able to connect without any problem and the writing seems occurring as well, but the acceptor doesn't read anything from the socket and the call to read() blocks indefinitely. Am I using some wrong setting for the acceptor? Kind Regards AFG int main(){ create_programming_socket(); poll_programming_connect(); while(1){ poll_programming_read(); } } int create_programming_socket(){ int cnt = 0; p_listen_socket = socket( AF_INET, SOCK_STREAM, 0 ); if( p_listen_socket < 0 ){ return 1; } int flags = fcntl( p_listen_socket, F_GETFL, 0 ); if( fcntl( p_listen_socket, F_SETFL, flags | O_NONBLOCK ) == -1 ){ return 1; } bzero( (char*)&p_serv_addr, sizeof(p_serv_addr) ); p_serv_addr.sin_family = AF_INET; p_serv_addr.sin_addr.s_addr = INADDR_ANY; p_serv_addr.sin_port = htons( p_port ); if( bind( p_listen_socket, (struct sockaddr*)&p_serv_addr , sizeof(p_serv_addr) ) < 0 ) { return 1; } listen( p_listen_socket, 5 ); return 0; } int poll_programming_connect(){ int retval = 0; static socklen_t p_clilen = sizeof(p_cli_addr); int res = accept( p_listen_socket, (struct sockaddr*)&p_cli_addr, &p_clilen ); if( res > 0 ){ p_conn_socket = res; int flags = fcntl( p_conn_socket, F_GETFL, 0 ); if( fcntl( p_conn_socket, F_SETFL, flags | O_NONBLOCK ) == -1 ){ retval = 1; }else{ p_connected = true; } }else if( res == -1 && ( errno == EWOULDBLOCK || errno == EAGAIN ) ) { //printf( "poll_sock(): accept(c_listen_socket) would block\n"); }else{ retval = 1; } return retval; } int poll_programming_read(){ int retval = 0; bzero( p_buffer, 256 ); int numbytes = read( p_conn_socket, p_buffer, 255 ); if( numbytes > 0 ) { fprintf( stderr, "poll_sock(): read() read %d bytes\n", numbytes ); pkt_struct2_t tx_buf; int fred; int i; } else if( numbytes == -1 && ( errno == EWOULDBLOCK || errno == EAGAIN ) ) { //printf( "poll_sock(): read() would block\n"); } else { close( p_conn_socket ); p_connected = false; retval = 1; } return retval; }

    Read the article

  • Dynamic Objects for ASPxGridview

    - by André Snede Hansen
    I have a dictionary that is populated with data from a table, we are doing this so we can hold multiple SQL tables inside this object. This approached cannot be discussed. The Dictionary is mapped as a , and contains SQL column name and the value, and each dictionary resembles one row entry in the Table. Now I need to display this on a editable gridview, preferably the ASPxGridView. I already figured out that I should use Dynamic Objects(C#), and everything worked perfectly, up to the part where I find out that the ASPxGridview is built in .NET 2.0 and not 4.0 where Dynamic objects where implemented, therefor I cannot use it... As you cannot, to my knowledge, add rows to the gridview programmatically, I am out of ideas, and seek your help guys! protected void Page_Load(object sender, EventArgs e) { UserValidationTableDataProvider uvtDataprovider = _DALFactory.getProvider<UserValidationTableDataProvider>(typeof(UserValidationTableEntry)); string[] tableNames = uvtDataprovider.TableNames; UserValidationTableEntry[] entries = uvtDataprovider.getAllrecordsFromTable(tableNames[0]); userValidtionTableGridView.Columns.Clear(); Dictionary<string, string> firstEntry = entries[0].Values; foreach (KeyValuePair<string, string> kvp in firstEntry) { userValidtionTableGridView.Columns.Add(new GridViewDataColumn(kvp.Key)); } var dynamicObjectList = new List<dynamic>(); foreach (UserValidationTableEntry uvt in entries) { //dynamic dynObject = new MyDynamicObject(uvt.Values); dynamicObjectList.Add(new MyDynamicObject(uvt.Values)); } } public class MyDynamicObject : DynamicObject { Dictionary<string, string> properties = new Dictionary<string, string>(); public MyDynamicObject(Dictionary<string, string> dictio) { properties = dictio; } // If you try to get a value of a property // not defined in the class, this method is called. public override bool TryGetMember(GetMemberBinder binder, out object result) { // Converting the property name to lowercase // so that property names become case-insensitive. string name = binder.Name.ToLower(); string RResult; // If the property name is found in a dictionary, // set the result parameter to the property value and return true. // Otherwise, return false. bool wasSuccesfull = properties.TryGetValue(name, out RResult); result = RResult; return wasSuccesfull; } // If you try to set a value of a property that is // not defined in the class, this method is called. public override bool TrySetMember(SetMemberBinder binder, object value) { // Converting the property name to lowercase // so that property names become case-insensitive. properties[binder.Name.ToLower()] = value.ToString(); // You can always add a value to a dictionary, // so this method always returns true. return true; } } Now, I am almost certain that his "Dynamic object" approach, is not the one I can go with from here on. I hope you guys can help me :)!

    Read the article

  • Latest 100 mentions - Twitter api

    - by laurens
    I'm looking to achieve the following: For a specific person, for example BarackObama, I'd like to get the last 100 times/tweets he was mentioned. Not his own tweets but the tweets of others containing @BarackObama. In the end I'd like to have: the person who mentioned, location, datetime. This content should be written to a flat file. I've been experimenting with the Twitter API and Python, with success but haven't yet succeeded achieving the above problem. I know there is a dev sections on the twitter website but they don't provide any example of code!! https://dev.twitter.com/docs/api/1/get/statuses/mentions count=100 .... For me the scripting language or way of doing is not relevant it's the result. I just read on the internet that python and Twitter api are a good match. Thanks a lot in advance!!

    Read the article

  • Calling server side method as filling value inside a textbox from calendar extender

    - by Dharmendra Singh
    I have a text box which i m filling of date from the calendar extender and the code is as below:- <label for="input-one" class="float"><strong>Date</strong></label><br /> <asp:TextBox ID="txtDate" runat="server" CssClass="inp-text" Enabled="false" AutoPostBack="true" Width="300px" ontextchanged="txtDate_TextChanged"></asp:TextBox> <asp:ImageButton ID="btnDate2" runat="server" AlternateText="cal2" ImageUrl="~/App_Themes/Images/icon_calendar.jpg" style="margin-top:auto;" CausesValidation="false" onclick="btnDate2_Click" /> <ajaxToolkit:CalendarExtender ID="calExtender2" runat="server" Format="dddd, MMMM dd, yyyy" OnClientDateSelectionChanged="CheckDateEalier" PopupButtonID="btnDate2" TargetControlID="txtDate" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="txtDate" ErrorMessage="Select a Date" Font-Bold="True" Font-Size="X-Small" ForeColor="Red"></asp:RequiredFieldValidator><br /> Javascript code is :- function CheckDateEalier(sender, args) { sender._textbox.set_Value(sender._selectedDate.format(sender._format)) } My requirement is that as the date is entered in to the textbox, I want to call this method: public void TimeSpentDisplay() { string date = txtDate.Text.ToString(); DateTime dateparsed = DateTime.ParseExact(date, "dddd, MMMM dd, yyyy", null); DateTime currentDate = System.DateTime.Now; if (dateparsed.Date > currentDate.Date) { divtimeSpent.Visible = true; } if (dateparsed.Date < currentDate.Date) { divtimeSpent.Visible = true; } if (dateparsed.Date == currentDate.Date) { divtimeSpent.Visible = false; } } Please help me that how i achieve this as i m calling this method inside txtDate_TextChanged method but the event is not firing as the text is changed inside the textbox. Please suggest how I can achieve this or give me an alternate idea to fulfill my requirement.

    Read the article

  • Multiple dispatching issue

    - by user1440263
    I try to be synthetic: I'm dispatching an event from a MovieClip (customized symbol in library) this way: public function _onMouseDown(e:MouseEvent){ var obj = {targetClips:["tondo"],functionString:"testFF"}; dispatchEvent(new BridgeEvent(BridgeEvent.BRIDGE_DATA,obj)); } The BridgeEvent class is the following: package events { import flash.events.EventDispatcher; import flash.events.Event; public class BridgeEvent extends Event { public static const BRIDGE_DATA:String = "BridgeData"; public var data:*; public function BridgeEvent(type:String, data:*) { this.data = data; super(type, true); } } } The document class listens to the event this way: addEventListener(BridgeEvent.BRIDGE_DATA,eventSwitcher); In eventSwitcher method I have a simple trace("received"). What happens: when I click the MovieClip the trace action gets duplicated and the output window writes many "received" (even if the click is only one). What happens? How do I prevent this behaviour? What is causing this? Any help is appreciated. [SOLVED] I'm sorry, you will not believe this. A colleague, to make me a joke, converted the MOUSE_DOWN handler to MOUSE_OVER.

    Read the article

  • My android app crash before load main.xml

    - by Saverio Puccia
    my android app crash before load main.xml. This is the exception thrown java.lang.RuntimeException: Unable to resume activity...: java.lang.NullPointerException What happens? For completeness I enclose my manifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="saverio.puccia.nfcauth" android:versionCode="1" android:versionName="1.0" > //permission <uses-sdk android:minSdkVersion="10" /> <uses-permission android:name="android.permission.NFC"></uses-permission> <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission> //main declaration <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".NFCAuthActivity" android:label="@string/app_name" > //intent filter declaration <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.NDEF_DISCOVER" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> </application> </manifest> LOGCAT 06-25 11:03:23.670: E/AndroidRuntime(4323): FATAL EXCEPTION: main 06-25 11:03:23.670: E/AndroidRuntime(4323): java.lang.RuntimeException: Unable to resume activity {saverio.puccia.nfcauth/saverio.puccia.nfcauth.NFCAuthActivity}: java.lang.NullPointerException 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2456) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2484) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1998) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.access$600(ActivityThread.java:127) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.os.Handler.dispatchMessage(Handler.java:99) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.os.Looper.loop(Looper.java:137) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.main(ActivityThread.java:4507) 06-25 11:03:23.670: E/AndroidRuntime(4323): at java.lang.reflect.Method.invokeNative(Native Method) 06-25 11:03:23.670: E/AndroidRuntime(4323): at java.lang.reflect.Method.invoke(Method.java:511) 06-25 11:03:23.670: E/AndroidRuntime(4323): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) 06-25 11:03:23.670: E/AndroidRuntime(4323): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) 06-25 11:03:23.670: E/AndroidRuntime(4323): at dalvik.system.NativeStart.main(Native Method) 06-25 11:03:23.670: E/AndroidRuntime(4323): Caused by: java.lang.NullPointerException 06-25 11:03:23.670: E/AndroidRuntime(4323): at saverio.puccia.nfcauth.NFCAuthActivity.onResume(NFCAuthActivity.java:103) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1157) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.Activity.performResume(Activity.java:4539) 06-25 11:03:23.670: E/AndroidRuntime(4323): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2446) 06-25 11:03:23.670: E/AndroidRuntime(4323): ... 12 more 06-25 11:03:23.670: W/ActivityManager(1998): Force finishing activity r.intent.getComponent().flattenToShortString()

    Read the article

  • capturing video from ip camera

    - by Ruby
    I am trying to capture video from ip camera into my application , its giving exception com.sun.image.codec.jpeg.ImageFormatException: Not a JPEG file: starts with 0x0d 0x0a at sun.awt.image.codec.JPEGImageDecoderImpl.readJPEGStream(Native Method) at sun.awt.image.codec.JPEGImageDecoderImpl.decodeAsBufferedImage(Unknown Source) at test.AxisCamera1.readJPG(AxisCamera1.java:130) at test.AxisCamera1.readMJPGStream(AxisCamera1.java:121) at test.AxisCamera1.readStream(AxisCamera1.java:100) at test.AxisCamera1.run(AxisCamera1.java:171) at java.lang.Thread.run(Unknown Source) its giving exception at image = decoder.decodeAsBufferedImage(); Here is the code i am trying private static final long serialVersionUID = 1L; public boolean useMJPGStream = true; public String jpgURL = "http://ip here/video.cgi/jpg/image.cgi?resolution=640×480"; public String mjpgURL = "http://ip here /video.cgi/mjpg/video.cgi?resolution=640×480"; DataInputStream dis; private BufferedImage image = null; public Dimension imageSize = null; public boolean connected = false; private boolean initCompleted = false; HttpURLConnection huc = null; Component parent; /** Creates a new instance of AxisCamera */ public AxisCamera1(Component parent_) { parent = parent_; } public void connect() { try { URL u = new URL(useMJPGStream ? mjpgURL : jpgURL); huc = (HttpURLConnection) u.openConnection(); // System.out.println(huc.getContentType()); InputStream is = huc.getInputStream(); connected = true; BufferedInputStream bis = new BufferedInputStream(is); dis = new DataInputStream(bis); if (!initCompleted) initDisplay(); } catch (IOException e) { // incase no connection exists wait and try // again, instead of printing the error try { huc.disconnect(); Thread.sleep(60); } catch (InterruptedException ie) { huc.disconnect(); connect(); } connect(); } catch (Exception e) { ; } } public void initDisplay() { // setup the display if (useMJPGStream) readMJPGStream(); else { readJPG(); disconnect(); } imageSize = new Dimension(image.getWidth(this), image.getHeight(this)); setPreferredSize(imageSize); parent.setSize(imageSize); parent.validate(); initCompleted = true; } public void disconnect() { try { if (connected) { dis.close(); connected = false; } } catch (Exception e) { ; } } public void paint(Graphics g) { // used to set the image on the panel if (image != null) g.drawImage(image, 0, 0, this); } public void readStream() { // the basic method to continuously read the // stream try { if (useMJPGStream) { while (true) { readMJPGStream(); parent.repaint(); } } else { while (true) { connect(); readJPG(); parent.repaint(); disconnect(); } } } catch (Exception e) { ; } } public void readMJPGStream() { // preprocess the mjpg stream to remove the // mjpg encapsulation readLine(3, dis); // discard the first 3 lines readJPG(); readLine(2, dis); // discard the last two lines } public void readJPG() { // read the embedded jpeg image try { JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(dis); image = decoder.decodeAsBufferedImage(); } catch (Exception e) { e.printStackTrace(); disconnect(); } } public void readLine(int n, DataInputStream dis) { // used to strip out the // header lines for (int i = 0; i < n; i++) { readLine(dis); } } public void readLine(DataInputStream dis) { try { boolean end = false; String lineEnd = "\n"; // assumes that the end of the line is marked // with this byte[] lineEndBytes = lineEnd.getBytes(); byte[] byteBuf = new byte[lineEndBytes.length]; while (!end) { dis.read(byteBuf, 0, lineEndBytes.length); String t = new String(byteBuf); System.out.print(t); // uncomment if you want to see what the // lines actually look like if (t.equals(lineEnd)) end = true; } } catch (Exception e) { e.printStackTrace(); } } public void run() { System.out.println("in Run..................."); connect(); readStream(); } @SuppressWarnings("deprecation") public static void main(String[] args) { JFrame jframe = new JFrame(); jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); AxisCamera1 axPanel = new AxisCamera1(jframe); new Thread(axPanel).start(); jframe.getContentPane().add(axPanel); jframe.pack(); jframe.show(); } } Any suggestions what I am doing wrong here??

    Read the article

  • Understanding "this" keyword

    - by Raffaele
    In this commit there is a change I cannot explain deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); becomes deferred.done( arguments ).fail( arguments ); AFAIK, when you invoke a function as a member of some object like obj.func(), inside the function this is bound to obj, so there would be no use invoking a function through apply() just to bound this to obj. Instead, according to the comments, this was required because of some preceding $.Callbacks.add implementation. My doubt is not about jQuery, but about the Javascript language itself: when you invoke a function like obj.func(), how can it be that inside func() the this keyword is not bound to obj?

    Read the article

  • Why does "return ERROR" only work with exceptions?

    - by ThreaT
    In the struts.xml I use: <result name="error">error</result> Then in my action I use: addActionError("ERROR RETURNED"); return ERROR; When I submit the form then it just goes to a blank page and does nothing. However, if I FORCE an exception to be thrown in the action then it goes to the error page and shows the ActionError message. So am I doing this wrong? If so, how should I tell struts to show an error page using "if statements" instead of relying solely on expensive try catches? EDIT 1: I'm using struts 2 version: 2.1.8.1 EDIT 2: For example, here is my action code that I'm using to test: String test = ""; int number = 0; try { if (number == 1) { System.out.println("number 1: " + number); test = SUCCESS; } else if (number == 2) { System.out.println("number 2: " + number); addActionError("ERROR RETURNED?"); addActionMessage("TESTTEST"); test = ERROR; } else if (number == 3) { System.out.println("number 3: " + number); addActionError("ERROR RETURNED?"); addActionMessage("TESTTEST"); test = INPUT; } else { System.out.println("number 4: " + number); test = LOGIN; } } catch (Exception e) { addActionError("ERROR RETURNED? " + e); } return test; And here is my JSP code: <s:form action="number_save" method="post"> <s:textfield name="number" label="Enter number" /> </s:form> <s:actionerror /> <s:fielderror /> <s:actionmessage /> EDIT 3: Here is a longer version of my struts.xml: <action name="number" method="numberCreate" class="NumberActionBean"> <result>number.jsp</result> </action> <action name="error"> <result>error.jsp</result> </action> <action name="number_save" method="numberSave" class="NumberActionBean"> <interceptor-ref name="defaultStack"></interceptor-ref> <result name="success" type="redirect">index</result> <result name="input" type="redirect">number</result> <result name="error">error</result> <result name="login" type="redirect">login</result> <result name="none">number</result> </action> EDIT 4: My error.jsp is simply a <s:actionerror /> tag with the general taglibs and html tags...

    Read the article

  • Why my jquery function is not firing on Firefox

    - by Cristian Boariu
    I have some trouble with some jquery method (for some checkboxes I want them to fire on checked/unchecked so I can do something then). This method works perfectly on Chrome and IE but not on latest FF. jQuery(function () { jQuery(':checkbox').change(function () { var counter = jQuery('.count').text(); var thisCheck = jQuery(this); if (thisCheck.is(':checked')) { counter++; //apply green color to the selected row jQuery(this).closest('tr').addClass('checked'); } else { counter--; //remove green color to the selected row jQuery(this).closest('tr').removeClass('checked'); } jQuery('.count').html(counter); //enable export button when there are selected emails to be exported if (counter > 0) { jQuery(".exportButton").removeAttr("disabled", ""); } else { jQuery(".exportButton").attr("disabled", "disabled"); } }); }); Basically it's simply not firing...Even with Debug is not catching the first line (function declare nor other lines too). If I move this javascript(without function declare) inside jQuery(document).ready(function ($) { all works nice on Firefox too... Yes, I do use jQuery.noConflict(); before jQuery(document).ready(function ($) { Do you know why this happens?

    Read the article

  • Automatic web browsing for windows phone

    - by Elias
    There's a website (telephonic company) where I get a statistic information about the amount of data transferred by my phone during the current month. To access that information, I need: * Access the website and login with username and passwod (html form) * Then choose an option in a combo box (html select) * And finally click on a link that shows the information (html a) I want to develop an app that does all this process automatically, and shows only the statistic data. There's a way to do this in C#?

    Read the article

  • Why does decorating a class break the descriptor protocol, thus preventing staticmethod objects from behaving as expected?

    - by Robru
    I need a little bit of help understanding the subtleties of the descriptor protocol in Python, as it relates specifically to the behavior of staticmethod objects. I'll start with a trivial example, and then iteratively expand it, examining it's behavior at each step: class Stub: @staticmethod def do_things(): """Call this like Stub.do_things(), with no arguments or instance.""" print "Doing things!" At this point, this behaves as expected, but what's going on here is a bit subtle: When you call Stub.do_things(), you are not invoking do_things directly. Instead, Stub.do_things refers to a staticmethod instance, which has wrapped the function we want up inside it's own descriptor protocol such that you are actually invoking staticmethod.__get__, which first returns the function that we want, and then gets called afterwards. >>> Stub <class __main__.Stub at 0x...> >>> Stub.do_things <function do_things at 0x...> >>> Stub.__dict__['do_things'] <staticmethod object at 0x...> >>> Stub.do_things() Doing things! So far so good. Next, I need to wrap the class in a decorator that will be used to customize class instantiation -- the decorator will determine whether to allow new instantiations or provide cached instances: def deco(cls): def factory(*args, **kwargs): # pretend there is some logic here determining # whether to make a new instance or not return cls(*args, **kwargs) return factory @deco class Stub: @staticmethod def do_things(): """Call this like Stub.do_things(), with no arguments or instance.""" print "Doing things!" Now, naturally this part as-is would be expected to break staticmethods, because the class is now hidden behind it's decorator, ie, Stub not a class at all, but an instance of factory that is able to produce instances of Stub when you call it. Indeed: >>> Stub <function factory at 0x...> >>> Stub.do_things Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'function' object has no attribute 'do_things' >>> Stub() <__main__.Stub instance at 0x...> >>> Stub().do_things <function do_things at 0x...> >>> Stub().do_things() Doing things! So far I understand what's happening here. My goal is to restore the ability for staticmethods to function as you would expect them to, even though the class is wrapped. As luck would have it, the Python stdlib includes something called functools, which provides some tools just for this purpose, ie, making functions behave more like other functions that they wrap. So I change my decorator to look like this: def deco(cls): @functools.wraps(cls) def factory(*args, **kwargs): # pretend there is some logic here determining # whether to make a new instance or not return cls(*args, **kwargs) return factory Now, things start to get interesting: >>> Stub <function Stub at 0x...> >>> Stub.do_things <staticmethod object at 0x...> >>> Stub.do_things() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'staticmethod' object is not callable >>> Stub() <__main__.Stub instance at 0x...> >>> Stub().do_things <function do_things at 0x...> >>> Stub().do_things() Doing things! Wait.... what? functools copies the staticmethod over to the wrapping function, but it's not callable? Why not? What did I miss here? I was playing around with this for a bit and I actually came up with my own reimplementation of staticmethod that allows it to function in this situation, but I don't really understand why it was necessary or if this is even the best solution to this problem. Here's the complete example: class staticmethod(object): """Make @staticmethods play nice with decorated classes.""" def __init__(self, func): self.func = func def __call__(self, *args, **kwargs): """Provide the expected behavior inside decorated classes.""" return self.func(*args, **kwargs) def __get__(self, obj, objtype=None): """Re-implement the standard behavior for undecorated classes.""" return self.func def deco(cls): @functools.wraps(cls) def factory(*args, **kwargs): # pretend there is some logic here determining # whether to make a new instance or not return cls(*args, **kwargs) return factory @deco class Stub: @staticmethod def do_things(): """Call this like Stub.do_things(), with no arguments or instance.""" print "Doing things!" Indeed it works exactly as expected: >>> Stub <function Stub at 0x...> >>> Stub.do_things <__main__.staticmethod object at 0x...> >>> Stub.do_things() Doing things! >>> Stub() <__main__.Stub instance at 0x...> >>> Stub().do_things <function do_things at 0x...> >>> Stub().do_things() Doing things! What approach would you take to make a staticmethod behave as expected inside a decorated class? Is this the best way? Why doesn't the builtin staticmethod implement __call__ on it's own in order for this to just work without any fuss? Thanks.

    Read the article

  • Jquery/CSS help needed to make fallback for IE and older browsers

    - by matt_50
    Wondering if any of you can help me: I've made a signup modal that uses a CSS transform to switch between two methods of signing up. I've decided to try a 'card flip' type effect. Have a look at this JSfiddle in any browser that supports CSS 3D transforms - click the 'old fashioned way' text to 'flip' the modal (simplified for demo purposes): http://jsfiddle.net/voodoo6/cnTMz/8/ Then take a look in IE8/9 - as the 'back' is taller than the front and IE does;t support 'backface-visibility: hidden;' the reverse can be seen below the front. I've been trying to use JQuery and conditional CSS to 'display:none' the 'back' on load in IE (and older browsers), then add a 'display:block;' class to show it on click, problem is, I'm a JQuery beginner and have been struggling to get it to work! Not even sure if this is the best approach? Can anybody suggest an approach that would get this working in less-capable browsers? Thanks for any advice..

    Read the article

  • Accessing a web service and a HTTP interface using certificate authentication

    - by ADC
    It is the first time I have to use certificate authentication. A commercial partner expose two services, a XML Web Service and a HTTP service. I have to access both of them with .NET clients. What I have tried 0. Setting up the environment I have installed the SSLCACertificates (on root and two intermediate) and the client certificate in my local machine (win 7 professional) using certmgr.exe. 1. For the web service I have the client certificate (der). The service will be consumed via a .NET proxy. Here's the code: OrderWSService proxy = new OrderWSService(); string CertFile = "ClientCert_DER.cer"; proxy.ClientCertificates.Add(new System.Security.Cryptography.X509Certificates.X509Certificate(CertFile)); orderTrackingTO ot = new orderTrackingTO() { order_id = "80", tracking_id = "82", status = stateOrderType.IN_PREPARATION }; resultResponseTO res = proxy.insertOrderTracking(ot); Exception reported at last statement: The request failed with an empty response. 2. For the HTTP interface it is a HTTPS interface I have to call through POST method. The HTTPS request will be send from a .NET client using HTTPWebRequest. Here's the code: string PostData = "MyPostData"; //setting the request HttpWebRequest req; req = (HttpWebRequest)HttpWebRequest.Create(url); req.UserAgent = "MyUserAgent"; req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded"; req.ClientCertificates.Add(new System.Security.Cryptography.X509Certificates.X509Certificate(CertFile, "MyPassword")); //setting the request content byte[] byteArray = Encoding.UTF8.GetBytes(PostData); Stream dataStream = req.GetRequestStream(); dataStream.Write(byteArray, 0, byteArray.Length); dataStream.Close(); //obtaining the response WebResponse res = req.GetResponse(); r = new StreamReader(res.GetResponseStream()); Exception reported at last statement: The request was aborted: Could not create SSL/TLS secure channel. 3. Last try: using the browser In Chrome, after installing the certificates, if I try to access both urls I get a 107 error: Error 107 (net::ERR_SSL_PROTOCOL_ERROR) I am stuck.

    Read the article

  • Iframe Javascript call to Flex

    - by Vince Lowe
    I have a flex application with an iframe layered on top. I want to make a call from the iframe to flex with javascript. So far i have tried this: This is the Object containing the swf embed in the ROOT document <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="IPRS_Dispatcher" width="1400" height="1000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"> <param name="movie" value="DispatcherMain.swf" /> <param name="quality" value="high" /> <!-- <param name="bgcolor" value="${bgcolor}" /> --> <param name="allowScriptAccess" value="sameDomain" /> <param name='flashVars' value='strLang=english&strIPRSSrvHost=&strGPSSrvHost=192.168.1.130&strGPSSrvSoapPort=8081&strGPSSrvFwdPort=26000&strLoginMode=simple&strSOSSrvHost=192.168.1.80&strSOSSrvSoapPort=8082&strSOSSrvFwdPort=26001&strSOSLoginMode=simple&strUserSIP=&strUserPswd=&nDelayForMapReadySecs=10&nGPSUpdatesRateSecs=120&nGPSSubscriptionsIntervalMinutes=10&nLat=35.0&nLng=32.5&nZoomLevel=5&strClientServiceVersion=2.1.36.19&nPathDotsSize=1&nPathWidth=5&bHideAnnounce=false&bHideEmergencyPan=true&strMapMarkerLabelMode=name&key=ABQIAAAAYbXZyR09wFj6QsiYucHpGxQEO34WZEWuIFq1A7yobGXPE-K5exQV9ZYR6NIkF8LCR8wsYvlhOIYsfA' /> <embed id="IPRS_Dispatcher2" src="DispatcherMain.swf" flashVars='strLang=english&strIPRSSrvHost=&strGPSSrvHost=192.168.1.130&strGPSSrvSoapPort=8081&strGPSSrvFwdPort=26000&strLoginMode=simple&strSOSSrvHost=192.168.1.80&strSOSSrvSoapPort=8082&strSOSSrvFwdPort=26001&strSOSLoginMode=simple&strUserSIP=&strUserPswd=&nDelayForMapReadySecs=10&nGPSUpdatesRateSecs=120&nGPSSubscriptionsIntervalMinutes=10&nLat=35.0&nLng=32.5&nZoomLevel=5&strClientServiceVersion=2.1.36.19&nPathDotsSize=1&nPathWidth=5&bHideAnnounce=false&bHideEmergencyPan=true&strMapMarkerLabelMode=name&key=ABQIAAAAYbXZyR09wFj6QsiYucHpGxQEO34WZEWuIFq1A7yobGXPE-K5exQV9ZYR6NIkF8LCR8wsYvlhOIYsfA' width="1400" height="1000" name="IPRS_Dispatcher" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"> <!-- bgcolor="${bgcolor}" --> </embed> </object> I have added addcallback for the function i want to expose ExternalInterface.addCallback("sendToFlash", callFromJavaScript); FYI public function callFromJavaScript(str):void { LogAddItem( 30, str); } In my IFRAME i have added the function function callToFlash(str) { var swf = parent.top.$("#IPRS_Dispatcher"); var bool = swf.sendToFlash(str); } Now getting error in chrome - Uncaught TypeError: Object [object Object] has no method 'sendToFlash' UPDATE 25/06/2012 - output from console.log(swf) [ <embed src=?"DispatcherMain.swf" width=?"100%" height=?"100%" align=?"middle" id=?"IPRS_Dispatcher" quality=?"high" name=?"IPRS_Dispatcher" wmode=?"opaque" allowfullscreen=?"true" allowscriptaccess=?"always" pluginspage=?"http:?/?/?www.adobe.com/?go/?getflashplayer" flashvars=?"strOEM=mt&strSplashImage=./?assets/?loadinglogo.jpg&strLang=english&strSelectableLangs=english,chinese, portuguese_brazil,german,french,spanish&strIPRSSrvHost=85.118.26.10&strGPSSrvHost=85.118.26.16&strGPSSrvSoapPort=8081&strGPSSrvFwdPort=26000&strLoginMode=simple&strUserSIP=&strUserPswd=&strSOSSrvHost=85.118.26.17&strSOSSrvSoapPort=8082&strSOSSrvFwdPort=26001&strClientServicePort=&strSOSLoginMode=simple&themeColor=a7c3e3&showRTTPriority=false&showGPSUpdateRate=true&nSamePosErrMeters=300&nDelayForMapReadySecs=10&nGPSUpdatesRateSecs=65535&nGPSSubscriptionsIntervalMinutes=10&nLat=48.311058&nLng=11.636753&nZoomLevel=13.0&strClientServiceVersion=2.1.36.04&bDispatcherEndsSessions=true&nSOSSubscriptionsIntervalMinutes=1&GPSKATime=20&SOSKATime=20&nPathDotsSize=2&nPathWidth=5&bHideAnnounce=false&bHideEmergencyPan=false&bHideDebugLog=false&showMutedColumn=false&strLogFilter=&strMapMarkerLabelMode=name&key=ABQIAAAAfJEcVYS6-jYp2UOUy8Wh5xSCeXAFBxztfWxjY5w1WzTnKjnSVRS7Uu5XoOIwTg2R_tq_c0QSCPxSHw" type=?"application/?x-shockwave-flash">? ]

    Read the article

  • PropelBundle database:create for postgres

    - by Karol85
    I've installed propel bundle for symfony2. my database configuration is: propel: dbal: driver: pgsql user: postgres password: postgres dsn: pgsql:host=localhost;port=5432;dbname=test_database options: {} attributes: {} When i wan to create this database from console (console propel: database:create) i have got strange error : Unable to open PDO connection [wrapped: SQLSTATE[08006] [7] FATAL: database "pgsql" does not exist. i created pgsql database on my localhost and everything was good. Database "test_database" was succesfull created. Can somebody explain me why i got this previous error? On mysql i've created database without any problems.

    Read the article

  • Java classpath and config file

    - by user1228291
    I'm having some trouble finding a config file with classpath. I use : InputStream stream = myclass.class.getResourceAsStream("properties.file"); The properties.file is located under config directory. When running the program with eclipse, it works. I just added config folder in the classpath in the launch configuration. But If I want to run the exported jar like this : java -jar -cp C:\project\lib;C:\project\config myclass.jar I get the oh wonderful java.lang.NullPointerException because it can't find the file. This sounds classic and stupid but I can't find a clue. What does eclipse do that I don't ? Thanks

    Read the article

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