|
|
 | Category: Web
|
| As mentioned before, we are in the process of evaluating Wordpress as a candidate for our future blogging platform. This evaluation includes importing all information from the current blog to the possibly new one. Wordpress offers several ways to import data from another system. There are plugins for the major blogging platforms like Blogger, TypePad, LiveJournal and Wordpress that can be found in the Wordpress admin under Tools - Import. You can also search for importer or import to find more plugins. Since Wohill is not put on any of these blogging platforms but instead is self-developed we can not use any of these plugins. However, there is a tool that can be found in the same place that allows importing from an RSS-feed. Since Wohill has a validated RSS-feed, this is what I have used. Worth mentioning is that I have downloaded Wordpress which means that data tables are created in the same database as the one we use today. What I want said by that is that it is possible to copy data from the old data tables to the new ones without the RSS-importer. But since it exists and importer it is easier and we will use it. It worked fine. The basic information gets in there. I had problems with the author though. I tried using the author-tag and the dc:creator-tag but neither worked. This was however solved by manually setting the author using SQL-queries in PHPMyAdmin after the import. The RSS-import only imports posts and we still have comments, tags etc. to take care of and I don't want to add them manually. There might be a plugin that works for this as well but I solved it this way to get the comments in and associated with the right posts. Since the data tables from the current and the new platform resides in the same database we can use some SQL to fix this. I used the following to copy the comments from the old comments table to the new. # Insert comments INSERT INTO wp_comments (comment_author, comment_author_email, comment_author_url, comment_content, comment_date, comment_post_ID, comment_approved) SELECT a.name, a.email, a.website, a.body, a.publishDate, b.ID, '1' FROM old_comments_table a inner join wp_posts b on (a.postId = b.guid and a.approved = '1') | The comments get in there and also associated with the right posts. The comment count on the posts has not been adjusted though. I searched the web and found a for this. Use this code straight off as it is and this issue will be taken care of as well. # Update comment count on existing posts UPDATE wp_posts wpp LEFT JOIN (SELECT comment_post_id AS c_post_id, count(*) AS cnt FROM wp_comments WHERE comment_approved = 1 GROUP BY comment_post_id) wpc ON wpp.id=wpc.c_post_id SET wpp.comment_count=wpc.cnt WHERE wpp.post_type IN ('post', 'page') AND (wpp.comment_count!=wpc.cnt OR (wpp.comment_count != 0 AND wpc.cnt IS NULL)); |
|  |
 | Category: Web
|
| I found this great chat tool the other day - . I have been searching for one for a while now and even started developing one myself. However this seems to meet all my expectations and more since it's very functional and free. You start by creating an account. In the settings you specify things like the name of the chat room, description, allowed users (guest, Facebook, Twitter). Further on you can design it with some colors and background image and have 1-5 moderators connected to the chat room. The chat room can also be linked to MySpace, Facebook and Twitter. A chatroom can be open or locked with a password and the same goes for the right to broadcast.  Users can also broadcast using camera and microphone. This can be controlled by the moderator. There is also functionality for showing the desktop, sharing a whiteboard, play a YouTube video and edit a group document. You can at any time click a user of the chatroom to see more info. If a user is logged in with Facebook or Twitter there is actually something to see here. Otherwise you are able to send private messages or ignore a user. As an administrator you can also ban the user or close the camera.  In a I mentioned the Wibiya web toolbar. It uses TinyChat as the chat tool and as default with temporary chat rooms. If you go through the process of registering and setting up the chatroom you can use this in the Wibiya toolbar as well. This allows you to moderate the chat room which is otherwise not currently possible.  |  |
 | Category: Web
|
| I am in the process of looking at moving our blog to (more about this later). While doing this I discovered a web toolbar on another blog. Normally I am not a fan of these things but this one is not installed in the web browser but instead in the actual framework which means that it pops up at the bottom of the page with several useful functions both for me as the owner and admin but also for the visitors. I decided to give it a try when we introduce the next version of Wohill - since it's both very easy to install and to inactivate. The web toolbar comes from .  If you are going to install it to Wordpress you simply download a php file, upload it to the plugins directory of your wordpress installation (wp-content/plugins/). Then activate it via the wordpress admin as descrived in the . Some of the things that you get from this toolbar is: - Site search - Translation functionality - Integration with Flickr - Integration with your Facebook fan page - Integration with Twitter - Sharing functionality for different social sites - Online count - Chat room |  |
 | Category: Web
|
| This is not very new information but I found it recently and tried it and liked it. is a bookmark web application that is more visual than for example delicious, but also more elegant in my opinion.Visual because each bookmark is represented by an image or a picture. More elegant because of its design and usability. You can integrate with many other social services and sites like delicious, twitter, facebook, tumblr, flickr etc. You can follow other people and see what they bookmark. This means that you can browse all user's, the ones you follow or your own. For some reason they have disabled the possibility to import bookmarks from other bookmarking sites which makes it a bit more hard to start using this since you probably already gathered thousands of other bookmarks. If they fix this I might start using it but until then probably not...  If you are using it, my account is if you would like to folllow. And for the curious ones, it is built using . |  |
 |
|
| Once, several months ago, some data accidentally got deleted during a Data Loader run. We managed to recover this data thanks to a script that restored the data from the recycle bin (more on that later). But there could be situations when all data can not be recovered or when you're interested in only parts of data from some time ago. When this happened we decided to use the manual backup routine offered in the Salesforce admin. Goto Setup -> Data Management -> Data Export Press the 'Export Now' button to start a job right now\'Schedule Export Now you have to define what you want to export. You can choose all objects and also attachments. If you choose scheduled export you also have to define when to do the export and if you want that job repeated.  When the job has been done you are notified via mail and have 48 hours to login and download the zip-files. After 48 hours the files are deleted and you have to do another export or wait for the next scheduled one.  We have been considering alternative solutions. I will get back on that if it becomes real. |  |
 |
|
| Suddenly the other day this window popped up in all our Salesforce environments. As it says you have the possibility as an admin to enable chatter for your organization.  You simply press "Set Up Chatter" and this window is displayed.  Here you can press "Edit" and check the "Enable" box and Chatter will be enabled for your organization.  Now, as you will be notified of and also notice, your interface has changed. Chatter requires the new interface theme and therefore it was turned on by default.  If you decide that you don't want to use Chatter anymore you can disable it easily by unchecking the Enable box. You can find this page under Setup -> Customize -> Chatter -> Settings. One soon realizes that the new user interface does not change back though when disabling Chatter. This has to be done separately. Goto Setup -> Customize -> User Interface and uncheck the checkbox for this and save and you will get back the old UI.  If you try it however you will see that it is pretty cool! |  |
 |
|
| If you have a solution where BigMachines is connected to Salesforce, this is the way how two import a Salesforce field to a commerce process main document attribute. Make sure you have the API name of the Salesforce field that you want to import. Then make sure you have the attribute variable name of the main document of the commerce process to which you want to import the value of the Salesforce field to. Now, you have to do two things:1. Create an integration XSL file. 2. Add this integration to the Commerce process action to make the integration take place when creating a new quote. If you have a custom action for editing an quote, add to this one as well. 1. The Generator Here is an example file for the generator on how to import the Id of a specific Record Type in Salesforce. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0"> <xsl:output method="xml"/> <xsl:variable name="main_doc" select="/transaction/data_xml/document[@data_type=0]"/> <xsl:strip-space elements="*"/> <xsl:template match="/"> <!-- Begin SOAP XML --> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Header> <QueryOptions xmlns="urn:partner.soap.sforce.com"> <batchSize>2000</batchSize> </QueryOptions> <SessionHeader xmlns="urn:partner.soap.sforce.com"> <sessionId> <xsl:value-of select="/transaction/user_info/session_id"/> </sessionId> </SessionHeader> </soap:Header> <soap:Body> <query xmlns="urn:partner.soap.sforce.com"> <queryString> Select Id, Name From RecordType where Name = 'A Record Type' </queryString> </query> </soap:Body> </soap:Envelope> <!-- End SOAP XML --> </xsl:template> </xsl:stylesheet>
| 1. The Parser <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf2="urn:partner.soap.sforce.com" xmlns:sf="urn:sobject.partner.soap.sforce.com"> <xsl:output method="xml"/> <xsl:template match="*"> <data_xml> <document document_var_name="documentVarName"> <commerceProcessMainDocAttribute> <xsl:value-of select="//sf:Id"/> </commerceProcessMainDocAttribute> </document> </data_xml> </xsl:template> </xsl:stylesheet>
|
The attribute 'commerceProcessMainDocAttribute' is as the name says the attribute of the main document in the commerce process. The tag inside this tag specifies which Salesforce field to be put in this attribute. You can choose from the ones selected in the Generator query. You can find the name of 'document_var_name' in process definitions -> Documents (List) -> The top document (click on it). The variable name is what you're searching for. Further on, when specifying the integrator XSL you have to specify an id. This should be the on the form <document_var_name>.<commerceProcessMainDocAttribute> in this case. 2. Add integration file to actions Press the link 'Commerce Process' and make the new integration XSL file as selected on the integration tab. This is all that has to be done! It is also possible to import it further on to a specific configuration, but that's for another time. |  |
 |
|
| I have created two record types for a custom object in Salesforce. One of them is enabled for some of the profiles. This means that when creating a new record of this object, the record type that is enabled will be the default. If both were enabled the user would have to, as a first step, select which record type to choose when creating a new instance of the object. If only one is enabled it is perfectly possible though to convert a record to be of the other record type with some Apex in Salesforce. I was creating some new functionality in the product configurator the other day. The product configurator is connected to Salesforce via web services and has the function to configure products and generate agreements in a more advance way than Salesforce can provide. In the product configurator I created several records of this custom object which were to be inserted into Salesforce when done. I needed to set the record type for the one that wasn't enabled. When all fields had been created and ready for insert into Salesforce I got the error message: "Record Type ID: id value not valid for the users profile". It turned out that the reason for this was that this record type was not enabled for the profile of the current user. Once adding it made the error message go away. These are the steps to made the adjustment: - Enter the profile(s) that you need to add this to. Click the profile but not in edit mode. - Then scroll down to the Record Type Settings section and click edit for the object in matter and select the specific record type in the list 'Available Record Types' and add it to 'Selected' Record Types.   Now try again and it should work! |  |
 |
|
| I was notified of a plugin to Notepad++ by a BigMachines developer posted about in the . Installing this makes the BML coding a little bit simplier and I think it was a great job and initiative of the creator .
BML stands for BigMachines Language and is used within the framework for coding actions, library functions etc. It's a little bit like JavaScript in its syntax.
To install the plugin to your as yet another language for it to support, here are the instructions to follow - taken from the BigMachines forum with approval from Sergey. The reason I'm putting it here is to make it more available.
1. Download and install the latest version of Notepad++. This has been tested with 5.6.4.
2. If you ARE NOT using any User Defined Languages in Notepad++, then just put the attached userDefineLang.xml into %APPDATA%\Notepad++ (or other directory if you've chosen the other directory for settings during the installation.
3. If you ARE using other User Defined Languages, then you'll need to append contents of the attached file to existing userDefineLang.xml. explains how.
4. Put bmi.xml file into Program Files\Notepad++\plugins\APIs. Or if you've installed to different directory, then put it to that directory\plugins\APIs.
5. Start/restart Notepad++ and open file with or paste BML code.
6. Go to Settings --> Preferences menu. Choose Backup/Auto-Completion tab, check both checkboxes in Auto-Completion section and choose Function completion. Press OK.
7. Choose BML as language in the Language menu (it will be next to the last one)
8. Enjoy syntax highlighting for all reserved words, functions and comments and tooltip text for most commonly used functions.
Files:
Check that I wrote a while ago on how to change the comment line color in Notepad++ in case you would like to customize a bit. |  |
 | Category: Java
|
| Last week I posted some Java code to on the file system. This week, I will add some code to print the contents of each of the chosen files that was browsed for. If you look back at the code for browsing for files there was this section where the chosen files were processed. We didn't do anything but printing the absolute file path to each file. /* Loop through all files */ for (int i=0;iSystem.out.println(files[i].getAbsoluteFile()); } | I have modified code that I found at since it didn't fully compile and to be a class to call instead of run directly. This code processes a File and stores the content of the file line by line in a string variable which is later returned from the function 'fileStructure'. import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; public class FileInput { File file; FileInputStream fis; BufferedInputStream bis; BufferedReader d; String line; public FileInput(File inFile) { file = inFile; fis = null; bis = null; d = null; line = ""; } public String fileStructure() { String retStr = ""; try { fis = new FileInputStream(file); bis = new BufferedInputStream(fis); d = new BufferedReader(new InputStreamReader(bis)); while (line != null) { line = d.readLine(); if ((line != null)) { retStr = retStr + '\n' + line; } } fis.close(); bis.close(); d.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return retStr; } }
| Now we can use this class in the class 'FileTest' to print the contents of each browsed file instead of just the file names. /* Loop through all files */ for (int i=0;i FileInput fi= new FileInput(files[i]); fileContent = ltrim(rtrim(fi.fileStructure())); System.out.println(fileContent); } |
|  |
 | Category: Java
|
| I needed some code to be able to browse for files on the file system with Java so I put together this code that you could use to browse for files on the file system. You can modify it to only browse files, directories or both: chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); /* FILES_ONLY DIRECTORIES_ONLY FILES_AND_DIRECTORIES */ | You can specify which file types (file extensions) you wish to allow the browser to find. In my case I have allowed xml and xsl: FileFilter filter = new FileNameExtensionFilter("File Extensions","xsl","xml"); | The 'FileTest' class. It outputs the chosen file names and their absolute paths on the console. import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.filechooser.FileFilter; import javax.swing.filechooser.FileNameExtensionFilter; public class FileTest extends JPanel implements ActionListener { JButton go; JFileChooser chooser; String choosertitle; String fileContent = ""; File[] files; static final long serialVersionUID = 0; public FileTest() { go = new JButton("Browse"); go.addActionListener(this); add(go); } public void actionPerformed(ActionEvent e) { chooser = new JFileChooser(); chooser.setCurrentDirectory(new java.io.File(".")); chooser.setDialogTitle(choosertitle); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setMultiSelectionEnabled(true); FileFilter filter = new FileNameExtensionFilter("File Extensions","xsl","xml"); chooser.setFileFilter(filter); /* Disable the "All files" option */ chooser.setAcceptAllFileFilterUsed(false); if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { files = chooser.getSelectedFiles(); /* Loop through all files */ for (int i=0;i<files.length;i++) { System.out.println(files[i].getAbsoluteFile()); } } else { System.out.println("No Selection "); } } public Dimension getPreferredSize(){ return new Dimension(200, 100); } /* remove leading whitespace */ public static String ltrim(String source) { return source.replaceAll("^\\s+", ""); } /* remove trailing whitespace */ public static String rtrim(String source) { return source.replaceAll("\\s+$", ""); } public static void main(String s[]) { JFrame frame = new JFrame("Browse for files"); FileTest panel = new FileTest(); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } } ); frame.getContentPane().add(panel,"Center"); frame.setSize(panel.getPreferredSize()); frame.setVisible(true); } } | |
|  |
 |
|
| How to disable a Record Type in Salesforce Using record types you can provide different sales/business processes to your users with different picklist values and different page layouts. When creating a new record type you can choose if you want to enable it for one or several profiles. If you enable it, it will (if more than one are enabled ) appear as a choice that comes up before you create a new object. Let's take the Opportunity as an example. I need three record types and first I decide to have all three enabled, i.e. to have as choices in the beginning of a creation of an object instance. Find the record types for the Opportunity here: When you are creating a new record type you get the option to enable it for all or some profiles. If they are enabled they will appear as choices as explained before. Important though is thay they have to be active. If they are not active they can not be used. Now we have three record types for the Opportunity: And in the profile for the Contract Manager for example we can see that three Opportunity Record Types has been enabled. To disable a record type from only one or some profiles you can simply click on edit and select or deselect which should be available. But if you want to disable a record type from all profiles and don't want to go through the work of entering each profile separately you simply open the record type and inactivate it. This way it will automatically be disabled and removed as selected from the profiles. If you want to enable a record type again though after this you don't seem to get the same option as when first creating the Record Type, i.e. to enable for one or several profiles at once. Instead you would have to enter each profile separately and reselect it again. Read more about Record Types in Salesforce Online Help. Search for 'Managing Record Types'. And for those of you that can not find this page when googling I can mention that it is this Help page that is referred to, i.e. you would have to be logged onto Salesforce.  |  |
 |
|
| I have been trying a few through the past years, no deep-diving but rather using what I need for the moment.
The very first time I needed Ajax I created my own functionality with the help from some tutorials on . After that I started with Dojo for simple Ajax calls which made life much easier. Then I moved on and tried Ext.js also for Ajax calls but also using its json object. I have briefly looked at Prototype and Rico and now latest I have gotten into jQuery, I really like its simplicity and variety.
But I am curious in how other people/developers reason. Here are the JavaScript frameworks that I know of and found when browsing for a while. What's your opinion and why? Any other options?
|  |
 | Category: Web
|
| I was a bit out of inspiration and surfed the net for some new cool apps and found this . It is difficult to master. I made one attempt and came out with this result.  I tried to hum and sing and say different words but with no good result. It was when i started tapping my fingers against the desk that I started seeing some results. The faster you tap the more you make it go clock-wise and if you slow down on the tapping it goes counter clock-wise. I wouldn't say I have talent with this voice drawing but I am certainly doing a better job that with a pencil in my hand  , I don't even know what this is suppose to be but it could probably go under modern art. Or what do you say Randolph (co-blogger)? By the way, here is someone who has succeeded than me. |  |
 |
|
| For a specific task I needed the functionality that you can see on the Google search box. And by that I mean that as letters are typed into the search box, the results are displayed in a dynamic box below. Further on I can whenever I choose to, press the arrow down key to start navigating over the result list. And when pressing enter the specific row that is highlighted is chosen.  If you start trying this yourself you'll find out that you probably need to do some magic with CSS and JavaScript to make it work like this. I am sure this is fun work but would take some time if you decide to implement it completely on your own. A simpler and very easy and fast way to get it done is to use a solution ready for use and there is a plugin for JQuery that does exactly this. Here are five steps to get it done (with dummy data). 1. Download 2. Download the 3. Include the JavaScript libraries on your web page 4. Add an input field 5. Add three JavaScript rows Here's an example script that works: <html> <head> <script type="text/javascript" src="js/jquery.js"></script>
<link rel="stylesheet" href="js/jquery-autocomplete/demo/main.css" type="text/css" /> <link rel="stylesheet" href="js/jquery-autocomplete/jquery.autocomplete.css" type="text/css" /> <script type="text/javascript" src="js/jquery-autocomplete/lib/jquery.bgiframe.min.js"></script> <script type="text/javascript" src="js/jquery-autocomplete/lib/jquery.dimensions.js"></script> <script type="text/javascript" src="js/jquery-autocomplete/jquery.autocomplete.js"></script> <script type="text/javascript"> $(document).ready(function(){ var data = "blue green white red yellow black pink purple brown orange".split(" "); $("#myInput").autocomplete(data); }); </script> </head> <body> <div style="margin:50px"> autocomplete search box: <input id="myInput" /> (try b) </div> </body> </html> |
See with the above piece of code. A way to move on with this would for example be to instead of using the dummy string as above, to create a string/array with all search data when the pages loades using ajax to a background database. |  |
 |
|
| "A code kata poses a problem for you to be solved - challenging your programming abilities, problem solving skills, creativity and discipline. But the final solution is only one part of the exercise..." |
On you can play with code in different languages (the goal is to enable every JVM-based language), solving different problems from easy to advanced levels finding multiple solutions and also learning from other people's solutions. All to become a better developer. You've probabaly got to be a coding geek to enjoy it, but if you are - this could be a fun and very learnful place to hang out at. For example one Coding Kata of the less advance type is to create a solution to decipher your kids' secret language, i.e. backwards talk. So your job would be to create a function which takes a string as input, reverses it and return that reversed string. Once you're done you check in your solution and you can see other solutions as well and discuss them. This becomes very interesting when working with more advanced problems I can imagine. I see a future for this kind of collaboration. I think I will bring this to work! Other similar places are and . |  |
 | Category: Web
|
| SlideShare has been around for quite some time and many people already know it from the integrations with LinkedIn, Facebook and Xing for example. However I would like to push for it for those of you who are not familiar with it yet.
| |  |
If you have composed your own presentation on a specific product or topic that could be of use for someone else that you would consider sharing, this would be the place to do it. There are already loads of presentations on many different subjects. I for example needed to setup a simple Salesforce presentation a while ago on a short notice and browsed through the many already uploaded slides and got quite some help and ideas to manage the task. There are also a lot of information about Lotus Notes, Lotus Connections, Google. etc. You name it! Further on, there are so-called Channels that you can follow to get notified on new content on the subject. Speaking about Salesforce, there are for example the . Interesting for developers to know might be that there is an based on the REST model. |  |
 |
|
| A while ago I wrote a about the different choices there is if we want to modify the Salesforce Partner Edit Page. I wrote that we have the option to create a new custom object or to keep the Partner/Opportunity Partner objects but instead make other suggestions. The two solutions had their pros and cons and I chose to do the solution where keeping the Partner objects with one small difference; we decided to list the current partners on the same page at the bottom and not as an inline VF-page on the Opportunity detail. I created the whole solution and it worked like a charm.  However when testing with different profiles at the end of the development I realized that there was an issue with access. The way our security is set up combined with the way the Partner object works made it impossible to let other users than System Administrators access the page - at least if you don't want to ease up on the security. There were problems with both reading and inserting the partner objects for users with those profiles. I realized that OpportunityPartners can be listed and read by other users though. The solution was therefore to use the OpportunityPartner object to list the Partners (see the Partners list in the screen shot above). As you might know a corresponding OpportunityPartner object is created when creating a Partner object and vice versa. When it comes to inserting new partners I solved it by using a new custom object that is solely used to hold partner information temporary on the page and getting the user input. All users have access to this custom object and therefore they will have access to the page. In the extension however, new real Partner objects are created using the values of the temporary ones. If you need to do this yourself and have problems, let me know and I could probably give you a hint. Cheers! |  |
 |
|
| I would say it's most common to deploy new functionality or changes to existing functionality to the production environment from the test environment since that's the obvious choice. But how can deletions be deployed to production for say a trigger, class or a page? There's nothing to deploy... Let's assume you want to delete a trigger from production. We are doing this in Eclipse and from the test environment only. 1. Open the project for the Test environment in Eclipse 2. Right-click on the trigger and choose 'Delete'. Delete both local and on server 3. Right-click on project and choose 'Force.com'. Click on 'Refresh from Server'. For some reason I have sometimes problems with this updating mechanism. You can also choose 'Add/Remove Metadata Components...'. That should do the trick. 4. Now deploy to server. Right-click on project, choose 'Force.com' and click on 'Deploy to Server'. After specifying username, password, token and environment and clicking forward you will see a window asking you to specify what you want to do. - Do you want to add any new components (if any)? - Do you want to overwrite components? - Do you want to delete components (if any)? The delete options are marked in red and are only visible if you have deleted something in the test environment and Eclipse can see that it still exist in the production environment. 5. Deselect all options to start with and then check the option(s) that you want to delete and continue.  Done! |  |
 | Category: Web
|
| I found this odd but a bit cool service called on the swedish blog . The idea is that you create a message which can be set with a password (optional). After creating it you get an URL where to reach it. You provide this URL to the receiver via email, mouth or something else and once the receiver accesses it it can only be read that one time. It is at the very same time deleted from the database. Creating...  Receiving...  It does feel a bit like Mission: Impossible. I wish I could have come up with the idea. It seems simple to develop and you just want to try it  |  |
 |
|
| I found a good page in the Eclipse Help pages for Force.com which explains the architecture of a controller extension and custom controller. These are the steps (in general) that happens when a VIsualforce page is requested, loaded, managed and closed.
1. User requests a page
ONLOAD: 2. The constructors are called for a possible associated controller or controller extension. 3. The assignTo attributes on any custom components on the page are executed 4. Expressions are evaluated. 5. The action attribute on the page tag component is called. 6. Other method calls are made (getter and setters). 7. The resulting HTML is sent to the browser.
POSSIBLE ACTIONS: 8. If the page contains a form component, the view state i updated whenever the page is updated 9. As the user interacts with the page, action methods and getter and setters methods are called as the page contacts the controller as required.
CLOSING: - When the user is redirected to another page, the view state and controller objects are deleted. |  |
 |
|
| We got a request to modify the page that opens when you want to add a partner for an Opportunity.  Sounds like an easy task to start with. However it turns out to be a bit difficult. The page is a standard page built into the application and can not be changed. The obvious option would then be to create your own Visualforce page instead and override the New button on the Opportunity related list for Partner to point to this Visualforce page instead. However that is not possible either. You can not override the button nor delete it or or create any new buttons. We came up with two options. None of them has been implemented at this stage. #1 Create a custom object- Create a custom object to use instead of the OpportunityPartner object. - Remove the related lists for Partner from the Account- and the Opportunity page layouts. - Create a VisualForce page to represent the new Partner Edit page. - Create new related lists for the custom object and add to the page layout for this object. - Add New buttons to the related lists and tie it to the new VisualForce-page. - Run a data loader job to copy data from the existing OpportunityPartner objects to the new custom object. - Think twice before deleting any OpportunityPartner or Partner objects. We tried that once and deleted lots of Opportunities. - Create new reports and remove old reports - Other dependencies in Apex classes or integrations? #2 Keep the OpportunityPartner object- Remove the related lists on the page layouts for the Account and the Opportunity - Create a VisualForce page to represent the new Partner Edit page. - Create a button on the Opportunity detail which is tied to this VisualForce-page. - Create another VisualForce page that should simulate the Opportunity Partner/Partner related list. - Add this VisualForce-page as inline VisualForce to the Opportunity detail. - Since the OpportunityPartner object is only queryable and retrievable there might be a problem with the Visualforce Page simulating the Partner Edit page. In this case the Partner object could be used instead as the standard controller since a creation of either of the objects creates an instance of the other. Option #1 is more clean and future safe. However it is more expensive in terms of time and also contains more risk of missing something. Option #2 works good enough and is not as expensive. Doesn't feel too good to move away from standard behaviour on a standard object though and it is not as future safe. |  |
 | Category: Web
|
| Since Google Buzz started there is suddenly a need for managing your Google profile. Your profile is more or less visible and clickable depending on how well you have entered your personal information. You have to open your profile and add information and also (optional) choose a username for your profile URL (otherwise it is just a long number). Get your profile by logging into Google at and click on 'Edit profile'. You can also goto and search for your name. This is how a profile can look like ().  You can via Buzz in Gmail search for other Buzz users to follow. Just click 'add' if they seem interesting. You are probably already following many of your Gmail friends. When looking at the people you follow you can click their profiles (if these are enabled) to see more information. It is also possible to go directly to other peoples profiles and follow their buzz from there. A profile's url is on the syntax http://www.google.com/profiles/username. I have seen several offical profiles without any information which doesn't look too professional. Check for more information, tips and trix about Buzz. Here are a couple of interesting ones that I have found so far: - - - - |  |
 |
|
| I was modifying a test class for a trigger when I bumped into this error message - "List has no rows for assignement to SObject". This means that an object instance that is to be assigned a value from a SOQL query does not get assigned, i.e. the SOQL query return no value. My case was something like this: Opportunity opp = [select id, StageName where id = :someId] |
If the SOQL query for some reason would not a return a result row the error message would be raised. A way to solve this is to assign the result of the SOQL-query to an Opportunity array instead. Opportunity[] opps = [select id, StageName where id = :someId] |
and then check with conditions: if (opps.size() > 0) { /* At least one row has been returned from the SOQL query If we for example are only expecting one opportunity as result then get a handle on it like this */ opps[0].CloseDate = date.today(); } else { // Query was empty }
update opp[0]; |
This way no error is raised. |  |
 | Category: Web
|
| Now you can create and save a PDF for any website for free with either by typing in the url by hand on the site or by calling the website url with querystring parameters via a link or directly in the address field of the web browser. This link: would look like this in HTML: <a href="http://pdfmyurl.com?url=www.wohill.com/random">Download a random wohill page as a PDF</a>
|
As you can see the whole blog framework with one page is created as a PDF. It could be interesting here to point to just the blog entry and being able to offer random articles as PDF-pages for example. That will be a smaller project for a rainy day... There are also advanced options for the PDF such as specifying the filename, choosing landscape or portrait, adding text, adding header or footer etc. Read more on the first page of PDFmyURL.com. |  |
 | Category: Web
|
| Interesting tool. I am not sure if I like it or not. It doesn't look too good for most sites though. I was aware that some people still uses a low resolution but I didn't think it was this bad. However I interpret it the way that they have taken into account also parameters like when visitors don't have their browser window expanded to the maximum or when visiting with a mobile device (and the site is not specifically enabled fior that).  Something to consider anyway. for your own site! |  |
 |
|
| If you have created an Apex class which uses Attachments in some way you might need to create Attachments as test data for the testMethod in order to get the coverage to be able to deploy. The attachment has three required fields: Body, Name and ParentIdBut how is the body, which is the attachment, created programmatically? I found this solution in a Salesforce community and also later on the Salesforce blog: PageReference pdf = Page.testPDF; pdf.getParameters().put('p','p'); pdf.setRedirect(true); // Grab the PDF! Blob b = pdf.getContent(); // Create and insert attachment Attachment attachment = new Attachment(Name='An attachment',body=b,parentId=accId); insert attachment; |
The above assumes that you have a valid accountId 'accId' serving as the parent of the attachment and that you have created a Visualforce page 'testPDF' which is rendered as PDF. Could look like this: <apex:page renderas="pdf"> <!-- Begin Default Content REMOVE THIS --> <h1>Congratulations</h1> This is your new Page <!-- End Default Content REMOVE THIS --> </apex:page> |
|  |
 |
|
| Notepad++ is probably the best developer tool you got when it comes to web programming - Clean and simple. I recently installed a new plugin for the BigMachines BML language - read more about how to do that . Works great by the way! Today when I was creating a new library function for the commerce process I started to annoy myself that the color of the single line commenting were so much brighter than the block comment and hard to read. Now, instead of keep being annoyed we could do something about it and it's very simple. - Open the file ' userDefineLang.xml' which should be located in %APPDATA%\Notepad++. - There's a tag named 'Styles' which child tags are named 'WordsStyle'. The one with name 'COMMENT LINE' is the one I want to change the color of. So I just copy the color of the block comment tag (with name 'COMMENT') and use for the line comment tag instead. Should look like this: | <WordsStyle name="COMMENT LINE" styleID="2" fgColor="808080" bgColor="FFFFFF" fontName="" fontStyle="0" /> |
Save and restart and we're done! |  |
 |
|
| Did you know that you can read Twitter statuses tagged with hashtags directly on Google? That is if you're using the Chrome web browser. Search for the words 'Twitter' and any valid hashtag and you will be presented with a scrollable html div which displays the latest tweets with this hashtag. It doesn't seem to update in real-time though.  |  |
|