Daily Archives

Articles indexed Wednesday December 22 2010

Page 10/32 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • How to Upload a file from client to server using OFBIZ?

    - by SIVAKUMAR.J
    Hi all, Im new to ofbiz.So is my question is have any mistake forgive me for my mistakes.Im new to ofbiz so i did not know some terminologies in ofbiz.Sometimes my question is not clear because of lack of knowledge in ofbiz.So try to understand my question and give me a good solution with respect to my level.Because some solutions are in very high level cannot able to understand for me.So please give the solution with good examples. My problem is i created a project inside the ofbiz/hot-deploy folder namely "productionmgntSystem".Inside the folder "ofbiz\hot-deploy\productionmgntSystem\webapp\productionmgntSystem" i created a .ftl file namely "app_details_1.ftl" .The following are the coding of this file <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> <script TYPE="TEXT/JAVASCRIPT" language=""JAVASCRIPT"> function uploadFile() { //alert("Before calling upload.jsp"); window.location='<@ofbizUrl>testing_service1</@ofbizUrl>' } </script> </head> <!-- <form action="<@ofbizUrl>testing_service1</@ofbizUrl>" enctype="multipart/form-data" name="app_details_frm"> --> <form action="<@ofbizUrl>logout1</@ofbizUrl>" enctype="multipart/form-data" name="app_details_frm"> <center style="height: 299px; "> <table border="0" style="height: 177px; width: 788px"> <tr style="height: 115px; "> <td style="width: 103px; "> <td style="width: 413px; "><h1>APPLICATION DETAILS</h1> <td style="width: 55px; "> </tr> <tr> <td style="width: 125px; ">Application name : </td> <td> <input name="app_name_txt" id="txt_1" value=" " /> </td> </tr> <tr> <td style="width: 125px; ">Excell sheet &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </td> <td> <input type="file" name="filename"/> </td> </tr> <tr> <td> <!-- <input type="button" name="logout1_cmd" value="Logout" onclick="logout1()"/> --> <input type="submit" name="logout_cmd" value="logout"/> </td> <td> <!-- <input type="submit" name="upload_cmd" value="Submit" /> --> <input type="button" name="upload1_cmd" value="Upload" onclick="uploadFile()"/> </td> </tr> </table> </center> </form> </html> the following coding is present in the file "ofbiz\hot-deploy\productionmgntSystem\webapp\productionmgntSystem\WEB-INF\controller.xml" ...... ....... ........ <request-map uri="testing_service1"> <security https="true" auth="true"/> <event type="java" path="org.ofbiz.productionmgntSystem.web_app_req.WebServices1" invoke="testingService"/> <response name="ok" type="view" value="ok_view"/> <response name="exception" type="view" value="exception_view"/> </request-map> .......... ............ .......... <view-map name="ok_view" type="ftl" page="ok_view.ftl"/> <view-map name="exception_view" type="ftl" page="exception_view.ftl"/> ................ ............. ............. The following are the coding present in the file "ofbiz\hot-deploy\productionmgntSystem\src\org\ofbiz\productionmgntSystem\web_app_req\WebServices1.java" package org.ofbiz.productionmgntSystem.web_app_req; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.DataInputStream; import java.io.FileOutputStream; import java.io.IOException; public class WebServices1 { public static String testingService(HttpServletRequest request, HttpServletResponse response) { //int i=0; String result="ok"; System.out.println("\n\n\t*************************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response)- Start"); String contentType=request.getContentType(); System.out.println("\n\n\t*************************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response)- contentType : "+contentType); String str=new String(); // response.setContentType("text/html"); //PrintWriter writer; if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) { System.out.println("\n\n\t**********************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response) after if (contentType != null)"); try { // writer=response.getWriter(); System.out.println("\n\n\t**********************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response) - try Start"); DataInputStream in = new DataInputStream(request.getInputStream()); int formDataLength = request.getContentLength(); byte dataBytes[] = new byte[formDataLength]; int byteRead = 0; int totalBytesRead = 0; //this loop converting the uploaded file into byte code while (totalBytesRead < formDataLength) { byteRead = in.read(dataBytes, totalBytesRead,formDataLength); totalBytesRead += byteRead; } String file = new String(dataBytes); //for saving the file name String saveFile = file.substring(file.indexOf("filename=\"") + 10); saveFile = saveFile.substring(0, saveFile.indexOf("\n")); saveFile = saveFile.substring(saveFile.lastIndexOf("\\")+ 1,saveFile.indexOf("\"")); int lastIndex = contentType.lastIndexOf("="); String boundary = contentType.substring(lastIndex + 1,contentType.length()); int pos; //extracting the index of file pos = file.indexOf("filename=\""); pos = file.indexOf("\n", pos) + 1; pos = file.indexOf("\n", pos) + 1; pos = file.indexOf("\n", pos) + 1; int boundaryLocation = file.indexOf(boundary, pos) - 4; int startPos = ((file.substring(0, pos)).getBytes()).length; int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length; //creating a new file with the same name and writing the content in new file FileOutputStream fileOut = new FileOutputStream("/"+saveFile); fileOut.write(dataBytes, startPos, (endPos - startPos)); fileOut.flush(); fileOut.close(); System.out.println("\n\n\t**********************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response) - try End"); } catch(IOException ioe) { System.out.println("\n\n\t*********************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response) - Catch IOException"); //ioe.printStackTrace(); return("exception"); } catch(Exception ex) { System.out.println("\n\n\t*********************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response) - Catch Exception"); return("exception"); } } else { System.out.println("\n\n\t********************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response) else part"); result="exception"; } System.out.println("\n\n\t*************************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response)- End"); return(result); } } I want to upload a file to the server.The file is get from user "<input type="file"..> tag in the "app_details_1.ftl" file & it is updated into the server by using the method "testingService(HttpServletRequest request, HttpServletResponse response)" in the class "WebServices1".But the file is not uploaded. Give me a good solution for uploading a file to the server. Thanks & Regards, Sivakumar.J

    Read the article

  • Looking for Kiosk-style / camera store easy photo memory card to CD/DVD burning program for Windows-7 Notebook? For non techie user.

    - by Rob
    I'm looking for a Kiosk-style / camera shop easy photo memory card to CD/DVD burning program? For non technie user. The kind of system you see in a camera shop / store, e.g. in the UK, Jessops and Boots stores. This is for my Dad who is adept at general PC usage as a notebook owner, but would prefer something fairly simple. The task of burning photos to CD/DVD, in their original photo file .jpg form, i.e. NOT as CD or DVD video or slideshow, is what I'm looking for. I'm guessing this might be possible in Picasa, but all the options available might be superfluous and confusing. He could probably learn to use that but thought I would try simpler options first. Looking for something that guides the user through the steps/stages of the process, 'Wizard' style. Any suggestions? Platform: HP Windows 7 Home notebook with CD/DVD burner and SD memory card slot.

    Read the article

  • How to get the installed Memory Type

    - by balexandre
    Windows 7 could be better at this, it tells everything about the computer CPU but only the Memory amount Microsoft should add information about DDR type, speed and maybe CL as well. While this never happens, What's the best and easy way to check the installed memory so we can buy and upgrade it? I was thinking a simple software so I don't need to install the full SiSoft Sandra for example, just looking for something small, only for the memory part.

    Read the article

  • Is it possible to run bash builtin from non bash script?

    - by tig
    Is it possible to run for example history -w for underlying bash shell from ruby script? Or better is it possible to run builtin command for bash shell knowing only its pid? The only way I found is to trap signal like trap "history -w" SIGUSR1 and then send signal to process, but I am not sure that it is a good practice and USR1 is not used by bash, also this way I can execute max 2 commands (USR1 and USR2). And I have to define trap before using it. I am on Mac so there is not SIGRTMIN..SIGRTMAX.

    Read the article

  • Screen Flickering: Hardware or Software?

    - by Wesley
    I have a Samsung N120 netbook (upgraded to 2GB DDR2 RAM) and there has been a screen flickering issue for some time now. However, I have not been able to accurately determine whether it is a software or hardware issue. Here are some of the symptoms: The flicker is white-colored and shows up as vertical lines. Flickering or not, there may be occasionally some random blue patterns (no image distortion) The screen tends to flicker more when the screen is not tilted back all the way. When tilting the screen back and forth, the screen will usually flicker. Some images on the screen may randomly distort without full-on flickering. The screen will flicker only on certain websites, but not on others. A certain part of a webpage may constantly be distorted randomly, even when scrolling. While flickering, the mouse will not move though I'm moving my finger along the touchpad. A connected external monitor does not have any problems. The flickering is completely random and does not seem to follow any CPU/GPU usage trends. Flickering usually gets worse when the screen brightness is turned higher. There will be flickering on battery and while plugged in. Search up "Samsung N120 - Screen Flickering" on YouTube for an idea of what the flickering looks like. However, there is no visible distortions and the flickering seems to stop when the screen has dimmed. Since the problems started, I tried formatting and using Windows 7, then formatted again and went back to Windows XP. The screen was also replaced sometime during this past summer. The uninstallation of the Samsung Battery Manager (on the original install of XP) seemed to reduce the flicker partially, but eventually got worse. So, what could possibly be the problem?

    Read the article

  • Snow Leopards Desktop Icons keeps Resizing Repeatedly

    - by Arashi
    I'm using a new macbook 10.6.5. I've been using mac OS for years. However, the problem that I'm getting is that the desktop icons keep resizing repeatedly. It keeps going to the biggest size possible and its driving me crazy. I've been resizing it back to medium size all the time. But when I start doing something at the finder it starts resizing by itself once again. Is there a fix to this problem? Please help.

    Read the article

  • Windows 64bit Sandboxing software alternatives

    - by Pacifika
    As you might know sandboxing software doesn't work in 64bit Windows due to patchguard. What are the alternatives for a person looking to test untrusted / temporary software? Edit: @Nick I'd prefer an alternative to VMs as I'm not happy with the extended startup time, the extra login sequences and the memory overhead that accompanies booting a VM solution to test something out ocassionally as a home user. Also it's another system that needs to be kept secure and up to date.

    Read the article

  • PHP: Alternative to SESSIONS

    - by iamjonesy
    Hi, I have a PHP application that relies on session variables quite a lot. After login the user get redirected to a page that executes code to set up a load of session variables depending on who the user is. The application is using data from different sources and the sessions are used to store ID numbers to query the databases. So when the user goes to a page that will query their asset management system their ID for that particular database is called via the session. I've had a LOT of problems with session variables recently. Sometimes only one session file is created during the lifetime of the app, and sometimes each session request results in a new session id (still haven't managed to find out why!). My question is this. Is there an alternative to using session variables for this? Like globals or some other way? Any help most appreciated! Regards, Jonesy

    Read the article

  • C# WebClient OpenRead url

    - by Octopus-Paul
    So i have this program that fetch a page using a short link (I used Google url shortener) to build my example i used the code from Using WebClient in C# is there a way to get the URL of a site after being redirected? using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Net; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { MyWebClient client = new MyWebClient(); client.OpenRead("http://tinyurl.com/345yj7x"); Uri uri = client.ResponseUri; Console.WriteLine(uri.AbsoluteUri); Console.Read(); } } class MyWebClient : WebClient { Uri _responseUri; public Uri ResponseUri { get { return _responseUri; } } protected override WebResponse GetWebResponse(WebRequest request) { WebResponse response = base.GetWebResponse(request); _responseUri = response.ResponseUri; return response; } } } I do not understant a thing: when i do client.OpenRead("http://tinyurl.com/345yj7x"); this downloads the page that the url points to? If this method downloads the page, I need something to get me only the url, so if there a method to get only some headers, or only the url please let me know.

    Read the article

  • how to consume .net webservices

    - by Rajesh Rolen- DotNet Developer
    please tell that can we consume .net web services in php or not. if yes then please tell me how can we do it. i am to create a web service which takes values and save it in database also it will take values and reply some data as a standard xml format. i know how to create web service and how to use it in asp.net but don't know how to use/call it from php. thing is that i will not be writing code in php to consume but wants to know that do i need to take care of any special thing or need to do some extra code to make it available and use by php developers. i am to create web service in .net framework 2.0 Thanks

    Read the article

  • Access to field in extended flatpage in django

    - by Stanislav Feldman
    How to access field in extended flatpage in django? I wrote this: class ExtendedFlatPage(FlatPage): teaser = CharField(max_length=150) class ExtendedFlatPageForm(FlatpageForm): teaser = CharField(max_length=150) class Meta: model = ExtendedFlatPage class ExtendedFlatPageAdmin(FlatPageAdmin): form = ExtendedFlatPageForm fieldsets = ( (None, {'fields': ('url', 'title', 'teaser', 'content', 'sites',)}), ) admin.site.unregister(FlatPage) admin.site.register(ExtendedFlatPage, ExtendedFlatPageAdmin) And creation in admin is ok. But then in flatpages/default.html I tried this: <html> <body> <h1>{{ flatpage.title }}</h1> <strong>{{ flatpage.teaser }}</strong> <p>{{ flatpage.content }}</p> </body> </html> And there was no flatpage.teaser! What is wrong?

    Read the article

  • Retrieve Value From Xml Attributes

    - by Chong
    hi everyone, i want to get some value from xml file filtering with xml attribute. my xml format is like below. <Object type="System.Windows.Forms.TextBox"> <Property name="Name">RadioButton1</Property> <Property name="Size">86, 24</Property> <Property name="Text">RadioButton1</Property> <Property name="Location">175, 126</Property> </Object> for example, if name = "Name" then i will add its value to name textbox. if name = "Size" then i will add its value to size textbox. regards Chong

    Read the article

  • Overloading Console.ReadLine possible? (or any static class method)

    - by comecme
    I'm trying to create an overload of the System.Console.ReadLine() method that will take a string argument. My intention basically is to be able to write string s = Console.ReadLine("Please enter a number: "); in stead of Console.Write("Please enter a number: "); string s = Console.ReadLine(); I don't think it is possible to overload Console.ReadLine itself, so I tried implementing an inherited class, like this: public static class MyConsole : System.Console { public static string ReadLine(string s) { Write(s); return ReadLine(); } } That doesn't work though, cause it is not possible to inherit from System.Console (because it is a static class which automatically makes is a sealed class). Does it make sense what I'm trying to do here? Or is it never a good idea to want to overload something from a static class?

    Read the article

  • How to add backgroud music in my website done in Joomla?

    - by Nishant Shrivastava
    Hello Experts, I am willing to add a music which runs in the background of my website.The site is generated in Joomla.Does anyone knows about any component (or any way) through which I can add a music which runs in the background of the website. I know it can be achieved via embed tag in the index page of the selected template,but one additional requirement is whenever any visitor clicks on any other Link, it should continue but not start from the begining.Is it feasible? Can anyone help me regarding this?

    Read the article

  • How can you force a floating div to be the height of its parent?

    - by ErnieStings
    HTML markup: <div class="planRisk"> <div class="innerPlanRiskRight"> <div class="rmPlanFrequency">10 </div> <div class="rmPlanSeverity"> 5</div> <div class="rmPlanRiskFactor">50 </div> <div class="rmPlanNumSolutions">2</div> <div class="rmPlanPercentComplete">34% </div> <div class="rmPlanDeletePlanRisk"> X </div> </div> <div class="rmPlanRiskTitle"> Pandemic Influenza</div> </div> CSS: .planRisk{background-color:#DEECD1; border:1px solid #BEBEBE;} .innerPlanRiskRight{float:right; color:#000000;} .rmPlanFrequency{float:left; width:46px;background-color:#d9dee1; text-align:center; border-right:1px solid #ebebeb; padding:0.2em;} .rmPlanSeverity{float:left; width:46px; background-color:#dbe1d4; text-align:center; border-right:1px solid #ebebeb; padding:0.2em;} .rmPlanRiskFactor{float:left; width:46px; background-color:#e5d5da; text-align:center; border-right:1px solid #ebebeb; padding:0.2em;} .rmPlanNumSolutions{float:left; width:46px; background-color:#dae4e4; text-align:center; border-right:1px solid #ebebeb; padding:0.2em;} .rmPlanPercentComplete{float:left; width:46px; background-color:#dddddd; text-align:center; padding:0.2em; } .rmPlanDeletePlanRisk{float:left; width:30px; background-color:#DEECD1; text-align:center; padding:0.2em;} .rmPlanRiskTitle{padding:0.2em; } .rmPlanSolutionContainer{background-color:#f0f9e8; border: 0 1px 1px; border-left:1px solid #CDCDCD; border-right:1px solid #cdcdcd; } .innerSolutionRight{float:right;} .rmPlanSolution{border-bottom:1px solid #CDCDCD; padding-left:1em;} .rmPlanSolutionPercentComplete{float:left; width:46px; background-color:#E2EADA; padding-left:0.2em; padding-right:0.2em; text-align:center;} .rmPlanDeleteSolution{float:left; width:30px; text-align:center; padding-left:0.2em; padding-right:0.2em; }

    Read the article

  • How to remove particular element form array

    - by Rahul Mehta
    Hi, I have the following array: Array ( [userid] => 1 [alias] => rahul [firstname] => rahul [lastname] => Khan2 [password] => Ý2jr™``¢(E]_Ø=^ [email] => [email protected] [url] => 4cfe07dbf35d6.jpg [avatar_url] => 4cfe07efd2e1c.jpg [thumb] => 4cfe07ebc8955.jpg [crop_url] => 4cfe07dbf35d6.jpg [crop_position] => [100,100,200,200] [updatedon] => 0000-00-00 00:00:00 [createdon] => 0000-00-00 00:00:00 ) I want to remove the element url ,and crop_url How i can i remove these from array.

    Read the article

  • c# scope/typing/assignment question

    - by Shannow
    Hi there another quick question. I would like to create a variable object so that depending on the value of something, it gets cast as needed. e.g. var rule; switch (seqRuleObj.RuleType) { case SeqRuleObj.type.Pre : rule = new preConditionRuleType(); rule = (preConditionRuleType)seqRuleObj.Rule; break; case SeqRuleObj.type.Post : rule = new postConditionRuleType(); rule = (postConditionRuleType)seqRuleObj.Rule; break; case SeqRuleObj.type.Exit : rule = new exitConditionRuleType(); rule = (exitConditionRuleType)seqRuleObj.Rule; break; default : break; } String result; foreach (sequencingRuleTypeRuleConditionsRuleCondition cond in rule.ruleConditions.ruleCondition) { ....../ blah } so basically this will not work. c# will not allow me to create an new object in every case as the name is aleady defined. i can just paste the foreach loop into each case but that to me is such a waste, as the objects are exactly the same in all but name.

    Read the article

  • DocProject vs Sandcastle Help File Builder GUI

    - by Nathan
    I have several C# projects along with some internal library components that I'm trying to document together. Sandcastle seems to be the place to go to generate documentation from C#. I would like to know which of the two, DocProject or Sandcastle Help File Builder GUI is better and supports the features I need. I would like to compile only each projects own part of the document and then have it all integrated together in the end. (i.e. the library components in one documentation project and each project in it's own documentation project, then all of the above in a single root using the Help 2 viewer)

    Read the article

  • Ignore duplicates in regex pattern

    - by gAMBOOKa
    I have a regex pattern that searches for words in a text file. How do I ignore duplicates? For instance, take a look at this code $pattern = '/(lorem|ipsum|daboom|pahwal|ababaga)/i'; $num_found = preg_match_all( $pattern, $string, $matches ); echo "$num_found match(es) found!"; echo "Matched words: " . implode( ',', $matches[0] ); If I have more than one say lorem in the article, the output will be something like this 5 matches found! Matched words: daboom,lorem,lorem,lorem,lorem I want the pattern to only find the first occurrence, and ignore the rest, so the output should be: 2 matches found! Matched words: daboom,lorem

    Read the article

  • FB Connect going in an infinite loop with google chrome

    - by Mitesh
    Hi, I am having the following php code which i am trying for testing FB Connect <?php define('FACEBOOK_APP_ID', 'YOUR_APP_ID'); define('FACEBOOK_SECRET', 'YOUR_APP_SECRET'); function get_facebook_cookie($app_id, $application_secret) { enter code here $args = array(); parse_str(trim($COOKIE['fbs' . $app_id], '\"'), $args); ksort($args); $payload = ''; foreach ($args as $key = $value) { if ($key != 'sig') { $payload .= $key . '=' . $value; } } if (md5($payload . $application_secret) != $args['sig']) { return null; } return $args; } $cookie = get_facebook_cookie(FACEBOOK_APP_ID, FACEBOOK_SECRET); ? <!DOCTYPE html <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" <body <?php if ($cookie) { ? Your user ID is <?= $cookie['uid'] ? <br / Your Acess Token is <br / <?php $user = json_decode(file_get_contents( 'https://graph.facebook.com/me?access_token=' . $cookie['access_token'])); if($user) { echo "<br /Display Name = " . $user-name; echo "<br /First Name = " . $user-first_name; echo "<br /Last Name = " . $user-last_name; echo "<br /Birthday = " . $user-birthday; echo "<br /Home Town = " . $user-hometown-name; echo "<br /Location = " . $user-location-name; echo "<br /Email = " . $user-email . "<br /"; } ? <?php } else { ? <fb:login-button perms="email,user_birthday,publish_stream"</fb:login-button <?php } ? <div id="fb-root">&lt;/div> <script src="http://connect.facebook.net/en_US/all.js"></script> <script> FB.init({appId: '<?= FACEBOOK_APP_ID ?>', status: true, cookie: true, xfbml: true}); FB.Event.subscribe('auth.login', function(response) { window.location.reload(); }); </script> </body </html The problem faced by me is it works fine with IE and Firefox, however when done the same with google chrome I am running into an infinite loop when I click on reload/refresh button of chrome after logging in. Any hints as to why is it happening with chrome? Also how can it be avoided. Thanks, Mitesh

    Read the article

  • linking against a static library

    - by ant2009
    Hello gcc Version: 4:4.4.4-1ubuntu2 GNU Make 3.81 I have the following library called net_api.a and some header files i.e. network_set.h I have include the header file in my source code in my main.c file #include <network_set.h> I have the following static library and header in the following directory ./tools/net/lib/net_api.a ./tools/net/inc/network_set.h In my Makefile I have tried to link using the following, code snippet: INC_PATH = -I tools/net/inc LIB_PATH = -L tools/net/lib LIBS = -lnet_api $(TARGET): $(OBJECT_FILES) $(CC) $(LDFLAGS) $(CFLAGS) $(INC_PATH) $(LIB_PATH) $(LIBS) $(OBJECT_FILES) -o $(TARGET) main.o: main.c $(CC) $(CFLAGS) $(INC_PATH) $(LIB_PATH) -c main.c However, when I compile I get the following errors: network_set.h error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘network_String’ Many thanks for any suggestions,

    Read the article

  • Simple continuously running XMPP client in python

    - by tom
    I'm using python-xmpp to send jabber messages. Everything works fine except that every time I want to send messages (every 15 minutes) I need to reconnect to the jabber server, and in the meantime the sending client is offline and cannot receive messages. So I want to write a really simple, indefinitely running xmpp client, that is online the whole time and can send (and receive) messages when required. My trivial (non-working) approach: import time import xmpp class Jabber(object): def __init__(self): server = 'example.com' username = 'bot' passwd = 'password' self.client = xmpp.Client(server) self.client.connect(server=(server, 5222)) self.client.auth(username, passwd, 'bot') self.client.sendInitPresence() self.sleep() def sleep(self): self.awake = False delay = 1 while not self.awake: time.sleep(delay) def wake(self): self.awake = True def auth(self, jid): self.client.getRoster().Authorize(jid) self.sleep() def send(self, jid, msg): message = xmpp.Message(jid, msg) message.setAttr('type', 'chat') self.client.send(message) self.sleep() if __name__ == '__main__': j = Jabber() time.sleep(3) j.wake() j.send('[email protected]', 'hello world') time.sleep(30) The problem here seems to be that I cannot wake it up. My best guess is that I need some kind of concurrency. Is that true, and if so how would I best go about that? EDIT: After looking into all the options concerning concurrency, I decided to go with twisted and wokkel. If I could, I would delete this post.

    Read the article

  • NuGet JustMock

    - by mehfuzh
    As most of us already know JustMock got  a free edition. The free edition is not a stripped down of the features of the full edition but I would rather say its a strip down of the type you can mock. Technically, free version runs on  proxy as full version runs on proxy + profiler. In full version, It switches to profiler when you are mocking final methods or sealed class or anything else that can not be done using inheritance. Like in full version you can mock non public methods , in free version you can still do it but it has to be virtual for protected or must be done through InternalsVisibleTo attribute for internal virtual methods (If you have access to the source and can apply the attribute). Now, you can get a copy of free edition from the product page. Install it and off you go. But it is also exposed to NuGet. Those of you are not familiar with NuGet (that will be odd). But still NuGet is the centralized package manager from Microsoft that cuts the workflow of manual inclusion of  libraries in your project. I think NuGet in future will limit the scope of  “.vsi” packages and installers because of its ease (except in some cases). Its similar to ruby gems. In ruby, virtually you can install any library in this way “gems  install <target_library>” and you are off to go. It will check the dependencies, install them or less prompt with the steps you need to do.   Now sticking to the post, to get started you first need to install NuGet package manager. Once you have completed the step pressing “Ctrl + W, Ctrl + Z” it will bring up an console like one below:   Once you are here, you just have to type “install-package justmock” Next, it will should print the confirmation when the installation is complete: Moving to visual studio solution explorer, you will now see:   Finally, NuGet is still in its early ages and steps that are shown here may not remain the same in coming releases, but feel free to enjoy what is out there right now. Regarding JustMock free edition, there is a nice post by Phil Japikse at Introducing JustMock Free Edition. I think its worth checking if not already.   Have fun and happy holidays!

    Read the article

  • Cost effective way to host site / VPS / yourself?

    - by Herr Kaleun
    Hello Friends, i am paying about 55 USD for a VPS every month that makes it about 660 USD a year. For the current traffic, it's good enought but, my question is, wouldn't i be better off, if i would buy for example, a server and plug it to the ISP myself? For example a Mac mini or a MacPro ? Where is the downside of such an example? It's ok if you just specify the mandatory things to watch for such a setup.

    Read the article

  • Transferring FSMO roles over vpn

    - by Tom Bowman
    I have a server located at one of our offices which is quite old and is due to be upgraded soon, this server holds the FSMO roles, I have another server in another office, both are DC's in the same domain and both are replicated, both run Server 2003 standard. I need to transfer the FSMO roles from the old server to the the one I have in the other office before I upgrade. Also I am looking at bringing in Exchange 2010 server however I cant install/configure that until I transfer the roles as it needs to be at the same site as the schema master. My question really is as both servers replicate over a vpn, how quickly will the roles transfer and will there be downtime as I need to make sure that while the transfer is running, both servers will service logon's and share files. or would it be better to do it out of hours? many thanks and apologies if I've missed out anything Regards Tom

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >