Posts

Showing posts from 2011

India Inflation Rate

From http://www.tradingeconomics.com/india/inflation-cpi "The inflation rate in India was last reported at 10.1 percent in September of 2011. From 1969 until 2010, the average inflation rate in India was 7.99 percent reaching an historical high of 34.68 percent in September of 1974 and a record low of -11.31 percent in May of 1976. Inflation rate refers to a general rise in prices measured against a standard level of purchasing power. The most well known measures of Inflation are the CPI which measures consumer prices, and the GDP deflator, which measures inflation in the whole of the domestic economy. This page includes: India Inflation Rate chart, historical data and news."

Why Can't I Edit a Drupal Node That I Have Permission to Edit?

http://redfinsolutions.com/blog/why-cant-i-edit-drupal-node-i-have-permission-edit Edit your node and check what input type it is set to use Go to Site Configuration > Input Formats and then make sure that the corresponding input type is configured to allow the role to use that type.

Google Search By Image

Been waiting years for this! Works very well in recognizing identical pictures and even locations and landmarks from personal photographs.. But does not seem powerful enough for facial recognition yet. Inside Google Search · Search by Image Google Search By Image: Use A Snapshot As Your Search Query

Liquid Benchmark Exchange Traded Scheme (Liquid BeES)

For those looking for the equivalent of a retail bond market in India

Android browser simulate desktop browser

Start debug mode by typing about:debug in address window Use the new settings now available in the browser menu to simulate a desktop browser. The browser will now ignore mobile websites and stay at the main website for all addresses.

ubuntu youtube download

sudo apt-get install youtube-dl youtube-dl http://www.youtube.com/watch?v=QY8g_IsI_gY

File and string compare

On the Mac, you can simply use diff on the terminal to compare files. Original 2011 link - Tool for comparing strings directly The tool I use most often now (2022) is diffchecker

Drupal block visibility PHP

//To show a block only on user pages or certain nodes $ShowBlock = false; $ShowBlock = ((arg(0) == 'user') && is_numeric(arg(1)) && (arg(2) == null));  if ($ShowBlock)     return $ShowBlock; // Is user page     $ShowBlock = ((arg(0) == 'node') && (arg(2) == null)); if (!$ShowBlock)     return $ShowBlock; // Not node page     $ShowBlock = (arg(1)==1 || arg(1)==13926 || arg(1)==13927 || arg(1)==13928 || arg(1)==13929 || arg(1)==13930); return $ShowBlock; // Front page or not ?>

Drupal FBConnect

// Creating content profile programmatically bypassing validations function hook_user($op, &$edit, &$user, $category = NULL) { global $user; // Create a near empty content profile if ($op == 'insert' && $edit['fb_avatar'] == 1) { $node = array(); $node['type'] = 'profile'; $node['name'] = 'Profile'; $node['status'] = 1; $node['format'] = 0; $node['comment'] = 0; $node['promote'] = 0; $node['sticky'] = 0; $node['uid'] = $edit['uid']; $node['title'] = 'Facebook user - '.$edit['name']; $node = (object)$node; $node->field_aa[0]['value'] = 'asdf'; $node->field_bb[0]['value'] = 100; $node->created = time(); $node->validated = TRUE; node_save($node); }

Drupal reset cron

// Delete cron with PHP  $num_deleted = 0; $num_deleted = db_delete('variable')           ->condition('name', 'cron_semaphore')           ->execute(); $num_deleted += db_delete('variable')           ->condition('name', 'cron_last')           ->execute(); if ($num_deleted > 0)         echo "Cron cleared. Clear cache!"; -- // Delete flood with PHP  $num_deleted = 0;         $num_deleted = db_delete('flood')           ->execute();     if ($num_deleted > 0)         echo "Flood cleared."; -- // Delete cron with SQL DELETE FROM `variable` WHERE name = 'cron_semaphore'; DELETE FROM `variable` WHERE name = 'cron_last'; // And CLEAR CACHE before running cron again.

Mac OSX Cannot empty trash because item is in use

Cannot empty trash because item is in use System Relaunching finder from "force quit applications" (command+option+esc) seems to work just as well.

Programmatically creating missing content profiles with default values bypassing validation

$sql = "select u.uid, u.name from users u where u.uid not in (select n.uid from node n where n.type='profile')"; $result = db_query($sql); while ($data = db_fetch_object($result)) { $node = array(); $node['type'] = 'profile'; $node['name'] = 'Profile'; $node['status'] = 1; $node['format'] = 0; $node['comment'] = 0; $node['promote'] = 0; $node['sticky'] = 0; $node['uid'] = $data->uid; $node['title'] = $data->name; $node = (object)$node; $node->field_cck1[0]['value'] = 1000; $node->field_cck2[0]['value'] = 100; $node->created = time(); $node->validated = TRUE; node_save($node); }

mysql repair table

Drupal Error : Table 'watchdog' is marked as crashed and should be repaired in /includes/database.mysqli.inc SQL query: REPAIR TABLE `watchdog` Or from phpMyAdmin : 1. Login to phpMyAdmin 2. Choose the affected database. If you only have one database, it should choose it by default so you don't need to do anything. 3. In the main panel, you should see a list of your database tables. Check the boxes by the tables that need repair. 4. At the bottom of the window just below the list of tables, there is a drop down menu. Choose "Repair Table"

drupal 6x - moving back from image cck to userpic

If you ever used image cck for user pictures and need to move back to the default built-in user pictures functionality, use this to migrate your data update users u, content_type_profile c, node n, files f set u.picture = f.filepath where f.fid=c.field_profpic_fid and c.nid = n.nid and n.uid = u.uid

Android power user codes

*#*#4636#*#* This code shows following 4 menus on screen: Phone information Battery information Battery history Usage statistics *#*#7594#*#* This code can be used to change the "End Call / Power" button action in your phone. *#*#273283*255*663282*#*#* This code opens a File copy screen where you can backup your media files e.g. Images, Sound, Video and Voice memo. *#*#197328640#*#* This code can be used to enter into Service mode. You can run various tests and change settings in the service mode. WLAN, GPS and Bluetooth Test Codes: *#*#232339#*#* OR *#*#526#*#* OR *#*#528#*#* - WLAN test (Use "Menu" button to start various tests) *#*#232338#*#* - Shows WiFi MAC address *#*#1472365#*#* - GPS test *#*#1575#*#* - Another GPS test *#*#232331#*#* - Bluetooth test *#*#232337#*# - Shows Bluetooth device address *#*#8255#*#* This code can be used to launch GTalk Service Monitor. Codes to get Firmware version information: *#*#4986*2650468#*#* - P

Split and then join a file on linux - for email backup etc

On OSX terminal ssh to centos Split: split -b 25000000 -d httpdocs.tar.gz httpdocsgz (gmail does not accept attachments over 25M) Mail: echo "site backup" | mutt -s "site backup0" -a httpdocsgz00 xyz@gmail.com echo "site backup" | mutt -s "site backup0" -a httpdocsgz01 xyz@gmail.com etc Join back: cat httpdocsgz* > httpdocs.tar.gz (after downloading)

rename files with a wildcard in OSX terminal

Windows: ren *.cbr *.rar OSX: for FILE in *.cbr;do mv "${FILE}" "${FILE%.cbr}.rar";done

centos linux plesk db user add error

You may receive a “Table ‘mysql.servers’ doesn’t exist” error message while adding a database user in Plesk OR while restarting the Mysql service. The complete error message look like: Error: Connection to the database server has failed: Table 'mysql.servers' doesn't exist solution: [root@server ~]# mysql_fix_privilege_tables --user=admin --password= --verbose Link1 Link2

Mac OSX Bootcamp time fix using RealTimeIsUniversal

Link: 1. Boot Windows 2. Click Start --> Run and type regedit. Click OK 3. The Windows Registry Editor should pop up. Navigate within the explorer to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation 4. Click on the TimeZoneInformation "folder" from the navigation pane if you haven't already done so. 5. This assumes the correct key doesn't exist. If it does, you will just change the existing key's value: Right click on the white space within the folder (If you don't have a right mouse button, you may need to download a program called applemouse to emulate the "control-click" of the apple 1-button mouse). Select new --> DWORD Value. Title the key "RealTimeIsUniversal" (No quotes). Set the value to "1" (No quotes again). Hexidecimal should be fine. 6. Either reboot and set the clock in MacOS or set the clock in Windows. You should now be able to reboot into either OS and have a correct clock

Free tool for converting CBR to Kindle format

http://calibre-ebook.com/download_osx

Demat accounts in india

A comprehensive comparison

WF4 Persistence tester code + multiple approvals and rejections

(Also look at a much more detailed approval/rejection solution on MSDN ) The below solution simply uses a Flow Chart level boolean variable and a FlowDecision element to show one approval/rejection scenario. The flow has one task activity and one approval. If the 2nd is rejected, it goes back to the first one. We can configure any number of such sequential related activities. The test code is configured for persistence too so you can end your app anytime and restart any persisted workflows later. Open the sln, change the connection string and hit ctrl+f5 to test. Use the below SQL on your DB if you forget to note the GUIDs from the console output. (Look at t he previous post to see how to configure the persistence tables on your DB for WF4) select * from [System.Activities.DurableInstancing] . [InstancesTable] select * from [System.Activities.DurableInstancing] . [RunnableInstancesTable] ******************** SubmitTaskName.cs ********************

WF 4 sample code

WF 4 Persistence, Tracking, and Bookmarks examples

Sample SendMail CodeActivity for WF4

using  System; using  System.Collections.Generic; using  System.Linq; using  System.Text; using  System.Activities; using  System.Net.Mail; using  System.Net; namespace  MDM.Workflow.Activities.Core {      public   class   SendMail  :  CodeActivity < SmtpStatusCode >     {          public   InArgument < string > SmtpHost {  get ;  set ; }          public   InArgument < int > Port {  get ;  set ; }          public   InArgument < bool > UseDefaultCredentials {  get ;  set ; }          public   InArgument < NetworkCredential > Credentials {  get ;  set ; }          public   InArgument < MailMessage > Message {  get ;  set ; }                   protected   override   SmtpStatusCode  Execute( CodeActivityContext  context)         {              try             {                  SmtpClient  SmtpClient1 =  new   SmtpClient (SmtpHost.Get(context));                 SmtpClient1.Port = Port.Get(context);                 SmtpClient1.UseDefaultCredentials = U

Sample WebServicesCall CodeActivity for WF4

using  System; using  System.Collections.Generic; using  System.Linq; using  System.Text; using  System.Activities; using  System.Net; using  System.IO; namespace  MDM.Workflow.Activities.Core {      public   class   WebServicesCall  :  CodeActivity < string >     {          public   InArgument < string > WebRequestUrl {  get ;  set ; }          public   InArgument < string > SoapIn {  get ;  set ; }          public   InArgument < string > SoapAction {  get ;  set ; }          public   InArgument < string > ContentType {  get ;  set ; }          public   InArgument < string > Accept {  get ;  set ; }          public   InArgument < string > Method {  get ;  set ; }          protected   override   string  Execute( CodeActivityContext  context)         {              string  ResponseText;              HttpWebRequest  HttpWebRequest1 = ( HttpWebRequest ) WebRequest .Create(WebRequestUrl.Get(context));             HttpWebRequest1.Headers.Add

Collapse Selection in Solution Explorer extension (For Visual Studio users)

Very useful VS2010 extension

visual studio 2010 undo bug

visual studio 2010 misses steps during undo/redo

.net 4.0 - List.Find() is now List.First()

See on: social.msdn forums.create.msdn

Alternative to Sony PC suite for syncing phone with Outlook 2010

http://www.fjsoft.at/en/downloads.php

Drupal update shell commands

The command line is much faster than doing it with a UI or FTP. It's assumed you know to get shell access to your server and basic linux commands. Replace all sample names below with the latest names and urls. Using cp because mv does not overwrite folders. Using \cp to avoid any alias cp command. Set site to maintenance mode before either process. Run http://update.php after each process. Core update process: cd root wget --no-check-certificate https://ftp.drupal.org/files/projects/drupal-7.43.tar.gz tar -xizf drupal-6.20.tar.gz \cp -R -f drupal-6.20/* . rm -rf drupal-6.20 rm -rf drupal-6.20.tar.gz Modules: cd sites/all/modules wget http://ftp.drupal.org/files/projects/date-6.x-2.7.tar.gz and so on su tar -xizf date-6.x-2.7.tar.gz and so on exit su

Archive

Show more